From 5c02e4b809110827c2c312affb820426376314e2 Mon Sep 17 00:00:00 2001 From: "Reid \"reidlab" Date: Thu, 21 Nov 2024 19:42:00 -0800 Subject: [PATCH] worst screenshot script ever --- modules/desktop/hyprland.nix | 43 ++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix index bd7c806..4090a43 100644 --- a/modules/desktop/hyprland.nix +++ b/modules/desktop/hyprland.nix @@ -95,7 +95,21 @@ in { temp_file=$(mktemp) trap 'rm -f "$temp_file"' EXIT - ${lib.getExe pkgs.grimblast} --freeze save area - > "$temp_file" || exit 1 + mode="$1" + case "$mode" in + fullscreen) + mode="output" + ;; + area) + mode="area" + ;; + *) + echo "usage: $0 [fullscreen|area]" >&2 + exit 2 + ;; + esac + + ${lib.getExe pkgs.grimblast} --freeze save "$mode" - > "$temp_file" || exit 0 # exit successful, highly unlikely that grimblast failed, and it is more likely that the user cancelled the screenshot cat "$temp_file" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t image/png @@ -113,10 +127,6 @@ in { esac ''; in [ - "$mod, R, exec, ${lib.getExe pkgs.rofi-wayland} -show run" - ", print, exec, ${screenshotScript}" - "$mod, T, exec, ${lib.getExe pkgs.wezterm}" - "$mod, Q, killactive, " "$mod, F, togglefloating, " "$mod, P, pseudo, " # dwindle @@ -129,8 +139,8 @@ in { "$mod, down, movefocus, d" # example special workspace (scratchpad) - "$mod, S, togglespecialworkspace, magic" - "$mod SHIFT, S, movetoworkspace, special:magic" + "$mod, grave, togglespecialworkspace, magic" + "$mod SHIFT, grave, movetoworkspace, special:magic" # scroll through workspaces with mod + scroll "$mod, mouse_down, workspace, e+1" @@ -139,9 +149,24 @@ in { "$mod, bracketleft, workspace, e-1" "$mod, bracketright, workspace, e+1" - ", XF86LaunchA, exec, ${screenshotScript}" - ", XF86LaunchB, exec, ${lib.getExe pkgs.rofi-rbw-wayland} -a copy -t password --clear-after 20" + "$mod, R, exec, ${lib.getExe pkgs.rofi-wayland} -show run" + "$mod, T, exec, ${lib.getExe pkgs.wezterm}" + "$mod, L, exec, ${lib.getExe config.modules.desktop.hyprlock.package}" + # screenshot + # area + ", Print, exec, ${screenshotScript} area" + "$mod SHIFT, S, exec, ${screenshotScript} area" + # fullscreen + ", Print, exec, ${screenshotScript} fullscreen" + "$mod SHIFT CTRL, S, exec, ${screenshotScript} fullscreen" + + ", XF86LaunchA, exec, ${screenshotScript} area" + ", XF86LaunchB, exec, ${lib.getExe pkgs.rofi-rbw-wayland} -a copy -t password --clear-after 20" + ", XF86ScreenSaver, exec, ${lib.getExe config.modules.desktop.hyprlock.package}" + + # alt-tab emulation + # doesnt activate when we let go of alt sadly "ALT, Tab, exec, ${lib.getExe pkgs.rofi-wayland} -show window" ] ++ ( # workspaces