pinwheel: Add screenshot annotation with satty

Shift-prefixed screenshot bindings pipe the capture to satty, and notifications use a short timeout so they are not captured.
This commit is contained in:
Alexander Heldt committed 2026-10-27 09:59:09 +01:00
1 parent b74c715164
commit a74e75d9ab
1 file changed
+26 -15
+26 -15
View File
@@ -9,28 +9,39 @@ let
hyprlandEnabled = config.mod.hyprland.enable;
grimblast = inputs.hyprland-contrib.packages.${pkgs.stdenv.hostPlatform.system}.grimblast;
area = "${pkgs.libnotify}/bin/notify-send 'ps: selected area' && ${grimblast}/bin/grimblast copy area";
screen = "${pkgs.libnotify}/bin/notify-send 'ps: selected screen' &&${grimblast}/bin/grimblast copy output";
satty = "${pkgs.satty}/bin/satty --filename - --copy-command ${pkgs.wl-clipboard}/bin/wl-copy --initial-tool brush --actions-on-enter save-to-clipboard,exit --early-exit copy";
# Short timeout so the notification is gone before the capture happens.
# Output captures are instant, so they wait for it to disappear.
notify = msg: "${pkgs.libnotify}/bin/notify-send -t 500 'ps: ${msg}'";
waitForNotify = "${pkgs.coreutils}/bin/sleep 0.6";
area = "${notify "selected area"} && ${grimblast}/bin/grimblast copy area";
screen = "${notify "selected screen"} && ${waitForNotify} && ${grimblast}/bin/grimblast copy output";
annotateArea = "${notify "annotate area"} && ${grimblast}/bin/grimblast save area - | ${satty}";
annotateScreen = "${notify "annotate screen"} && ${waitForNotify} && ${grimblast}/bin/grimblast save output - | ${satty}";
bind = keys: cmd: {
_args = [
keys
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${cmd}")'')
];
};
in
{
home-manager.users.alex = {
home.packages = [ grimblast ];
home.packages = [
grimblast
pkgs.satty
];
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind = [
{
_args = [
"SUPER + Print"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${area}")'')
];
}
{
_args = [
"SUPER + CTRL + Print"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${screen}")'')
];
}
(bind "SUPER + Print" area)
(bind "SUPER + CTRL + Print" screen)
(bind "SUPER + SHIFT + Print" annotateArea)
(bind "SUPER + CTRL + SHIFT + Print" annotateScreen)
];
};
};