diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix index 3d34cf6..69088f0 100644 --- a/modules/desktop/hyprland.nix +++ b/modules/desktop/hyprland.nix @@ -76,8 +76,29 @@ in { "SUPER, Super_L, exec, ${lib.getExe pkgs.nwg-drawer}" ]; bind = let + # screenshotScript = pkgs.writeScript "screenshot" '' + # ${lib.getExe pkgs.grimblast} --freeze --notify copy area + # ''; screenshotScript = pkgs.writeScript "screenshot" '' - ${lib.getExe pkgs.grimblast} --freeze --notify copy area + temp_file=$(mktemp) + trap 'rm -f "$temp_file"' EXIT + + ${lib.getExe pkgs.grimblast} --freeze save area - > "$temp_file" || exit 1 + + cat "$temp_file" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t image/png + + action=$(${pkgs.libnotify}/bin/notify-send "Screenshot Captured" \ + --app-name="Screenshot" \ + --urgency=normal \ + --action="default=Edit Image" \ + --icon "$temp_file" \ + "Click to open in Swappy") + + case "$action" in + default) + ${lib.getExe pkgs.swappy} -f "$temp_file" + ;; + esac ''; in [ "$mod, R, exec, ${lib.getExe pkgs.rofi-wayland} -show run"