From 85e0d714c2bded63ab82881e6f072dc26304b56e Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Thu, 22 Aug 2024 19:54:20 +0300 Subject: [PATCH] Sway : Save screenshots to dir. --- home/config/sway/module/Screenshot.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/home/config/sway/module/Screenshot.nix b/home/config/sway/module/Screenshot.nix index ac42947a..ad428d48 100644 --- a/home/config/sway/module/Screenshot.nix +++ b/home/config/sway/module/Screenshot.nix @@ -1,5 +1,9 @@ { config, ... }: let + codec = "libsvtav1"; color = config.style.color; + container = "mkv"; + format = "%Y-%m-%d_%H-%M-%S"; + framerate = 10; opacity = "26"; selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000"; in { @@ -8,9 +12,9 @@ in { # bindsym --to-code $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png # Select screenshot. - bindsym --to-code $mod+v exec grim -g "$(${selection})" - | wl-copy + bindsym --to-code $mod+v exec grim -g "$(${selection})" - | tee "''${XDG_PICTURES_DIR[0]}/$(date +${format}).png" | wl-copy # Select recording. - bindsym --to-code $mod+shift+v exec 'pkill -SIGINT wf-recorder || wf-recorder --geometry "$(${selection})" --codec libsvtav1 --file $HOME/media/video/"$(date +%Y-%m-%d_%H-%M-%S)".mkv --framerate 10' + bindsym --to-code $mod+shift+v exec 'pkill -SIGINT wf-recorder || wf-recorder --geometry "$(${selection})" --codec ${codec} --file "''${XDG_VIDEOS_DIR[0]}/$(date +${format}).${container}" --framerate ${toString framerate}' ''; }