diff options
Diffstat (limited to 'modules/user/desktop/sessions/sway.nix')
| -rw-r--r-- | modules/user/desktop/sessions/sway.nix | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/modules/user/desktop/sessions/sway.nix b/modules/user/desktop/sessions/sway.nix index 3684853..631235a 100644 --- a/modules/user/desktop/sessions/sway.nix +++ b/modules/user/desktop/sessions/sway.nix @@ -9,7 +9,10 @@ config = { gtk.enable = lib.mkDefault config.desktop.sessions.sway.enable; home.packages = lib.mkIf config.desktop.sessions.sway.enable [ + # needed for various scripts pkgs.grim + pkgs.jq + pkgs.libnotify pkgs.slurp ]; @@ -153,26 +156,16 @@ grim = "${pkgs.grim}/bin/grim"; launcher = "${pkgs.fuzzel}/bin/fuzzel"; mod = config.wayland.windowManager.sway.config.modifier; - screenshotDir = "~/Pictures/Screenshots"; + scripts = { + screenshot = pkgs.writeShellScript "screenshot" (builtins.readFile ../scripts/screenshot.sh); + }; terminal = "${pkgs.foot}/bin/foot"; in { "${mod}+Return" = "exec ${terminal}"; "${mod}+R" = "exec ${launcher}"; "${mod}+B" = "exec ${pkgs.librewolf}/bin/librewolf"; - "${mod}+Shift+S" = "exec ${(pkgs.writeShellScript "screenshot" '' - screenshot_type=$(printf 'monitor\nregion' | ${launcher} --mesg='What would you like to screenshot?' --hide-prompt --dmenu --minimal-lines --width=34) - screenshot_filename=$(date +'%F_%H.%M.%S.png') - - send_notif() { - ${pkgs.libnotify}/bin/notify-send -u low "Screenshot taken" "Screenshot saved as $screenshot_filename" - } - - case $screenshot_type in - 'monitor') ${grim} -o $(${pkgs.sway}/bin/swaymsg -rt get_workspaces | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .output') ${screenshotDir}/$screenshot_filename && send_notif ;; - 'region') ${grim} -g "$(${pkgs.slurp}/bin/slurp)" ${screenshotDir}/$screenshot_filename && send_notif ;; - esac - '')}"; + "${mod}+Shift+S" = "exec ${scripts.screenshot}"; "${mod}+Alt+L" = "exec ${pkgs.swaylock}/bin/swaylock"; "${mod}+Alt+K" = "input type:keyboard xkb_switch_layout next"; "${mod}+Alt+Q" = "exit"; |
