From d857f7ab9f39e990bb2e468aac6a414f0c942a2a Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:05:10 +0000 Subject: [PATCH] Screenshots (#100) --- home-manager/linux.nix | 2 +- home-manager/sway.conf | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/home-manager/linux.nix b/home-manager/linux.nix index 5a313d5..c86503f 100644 --- a/home-manager/linux.nix +++ b/home-manager/linux.nix @@ -13,7 +13,7 @@ {command = "${nixpkgs.waybar}/bin/waybar";} ]; }; - extraConfig = builtins.readFile ./sway.conf; + extraConfig = builtins.replaceStrings ["@@WL-COPY@@" "@@GRIM@@" "@@SLURP@@"] ["${nixpkgs.wl-clipboard}/bin/wl-copy" "${nixpkgs.grim}/bin/grim" "${nixpkgs.slurp}/bin/slurp"] (builtins.readFile ./sway.conf); }; programs.waybar = { diff --git a/home-manager/sway.conf b/home-manager/sway.conf index bfba836..d11e9ac 100644 --- a/home-manager/sway.conf +++ b/home-manager/sway.conf @@ -2,3 +2,12 @@ output Unknown-1 scale 2 input * { xkb_layout "gb" } + +# capture all screens to clipboard +bindsym Shift+Print exec @@GRIM@@ - | @@WL-COPY@@ + +# capture the specified screen area to clipboard +bindsym Shift+Alt+Print exec @@GRIM@@ -g "$(@@SLURP@@)" - | @@WL-COPY@@ + +# capture the focused monitor to clipboard +bindsym Shift+Control+Print exec @@GRIM@@ -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | @@WL-COPY@@