{ inputs, pkgs, lib, config, ... }: let hyprlandEnabled = config.mod.hyprland.enable; grimblast = inputs.hyprland-contrib.packages.${pkgs.stdenv.hostPlatform.system}.grimblast; 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 pkgs.satty ]; wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ (bind "SUPER + Print" area) (bind "SUPER + CTRL + Print" screen) (bind "SUPER + SHIFT + Print" annotateArea) (bind "SUPER + CTRL + SHIFT + Print" annotateScreen) ]; }; }; }; }