From 1f44933617f1b3bd5cf3d7cf1505dd25e72a6144 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sat, 9 Sep 2023 14:02:35 -0700 Subject: [PATCH] Fixed screenshot save location Screenshots should have been saved to a screenshots directory in my home directory instead of to a literal `~/screenshots` file. --- modules/desktop/sway/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/desktop/sway/default.nix b/modules/desktop/sway/default.nix index 7530b15..43ef06a 100644 --- a/modules/desktop/sway/default.nix +++ b/modules/desktop/sway/default.nix @@ -19,6 +19,8 @@ with lib; let # generic. menu = "rofi -show run"; terminal = "alacritty"; + + generate_grimshot_command = target: ''exec mkdir -p ~/screenshots && ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save ${target} ~/screenshots/"$(date -u --iso-8601=seconds)".png''; in { options.aa.desktop.sway = with types; { enable = mkEnableOption "sway"; @@ -279,16 +281,16 @@ in { # Screenshots ## Current window - "${modifier}+period" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save active ~/screenshots"; + "${modifier}+period" = generate_grimshot_command "active"; ## Area selection - "${modifier}+Shift+period" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save area ~/screenshots"; + "${modifier}+Shift+period" = generate_grimshot_command "area"; ## Current output - "${modifier}+Alt+period" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save output ~/screenshots"; + "${modifier}+Alt+period" = generate_grimshot_command "output"; ## Window selection - "${modifier}+Ctrl+period" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save window ~/screenshots"; + "${modifier}+Ctrl+period" = generate_grimshot_command "window"; # Scratchpad # Move the currently focused window to the scratchpad