From a30b43ca25b58f8b02274f2c9f532bf23ad6f7c0 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Sat, 9 Aug 2025 16:55:07 +0200 Subject: [PATCH] Added screenshot script for SwayWM --- sway/.config/sway/config | 2 +- sway/.config/sway/scripts/screenshot.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 sway/.config/sway/scripts/screenshot.sh diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 270b874..e3cfa85 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -297,7 +297,7 @@ bindsym $mod+r mode "resize" # Brightness lower with custom value('-' sign needed) bindsym XF86MonBrightnessDown exec swayosd-client --brightness -5 # Special key to take a screenshot with grim - bindsym Print exec grim ~/Pictures/Screenshots/$(date "+%Y-%m-%d"T"%H:%M:%S").png + bindsym Print exec ./scripts/screenshot.sh # Lock the screen bindsym $mod+Alt+l exec $lockman # Kill focused window diff --git a/sway/.config/sway/scripts/screenshot.sh b/sway/.config/sway/scripts/screenshot.sh new file mode 100755 index 0000000..15a4a7e --- /dev/null +++ b/sway/.config/sway/scripts/screenshot.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +file="$HOME/Pictures/Screenshots/$(date +%Y-%m-%dT%H:%M:%S).png" +thumb="/tmp/screenshot-thumb.png" +grim "$file" \ + && wl-copy < "$file" \ + && magick "$file" -resize 640x480 "$thumb" \ + && fyi -i "$thumb" "📸 Catch screenshot"