From e4b7b9c16c23eebb7963dfb29fe2439f9f09490d Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Sat, 26 Aug 2023 17:05:10 +0800 Subject: [PATCH] sway: improve command readability --- .config/sway/config | 6 +++--- .local/bin/screenshot | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100755 .local/bin/screenshot diff --git a/.config/sway/config b/.config/sway/config index b7f69e1..43d348e 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -41,7 +41,7 @@ floating_modifier $m bindsym { $m+Return exec footclient - $m+d exec j4-dmenu-desktop --dmenu='wmenu -i -n c0c0c0 -N 303030 -s ffffff -S 37474f' --no-generic --term=footclient --usage-log=$HOME/.cache/j4desktop + $m+d exec j4-dmenu-desktop --dmenu='wmenu -i -n c0c0c0 -N 303030 -s ffffff -S 37474f' --no-generic --term=footclient --usage-log=$XDG_CACHE_HOME/j4desktop $m+Shift+q kill @@ -107,8 +107,8 @@ bindsym { XF86MonBrightnessUp exec 'notify-send Brightness "Brightness set to $(blctl +5%)"' XF86MonBrightnessDown exec 'notify-send Brightness "Brightness set to $(blctl -5%)"' - Print exec 'STAMP=$(date +%Y%m%d-%H%M%S); grim ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved"' - $m+Print exec 'set -e; STAMP=$(date +%Y%m%d-%H%M%S);COR=$(slurp); grim -g "$COR" ~/Pictures/$STAMP.png; notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved, $COR"' + Print exec screenshot + $m+Print exec screenshot crop } bindgesture { diff --git a/.local/bin/screenshot b/.local/bin/screenshot new file mode 100755 index 0000000..eecf60c --- /dev/null +++ b/.local/bin/screenshot @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +STAMP=$(date +%Y%m%d-%H%M%S) + +[ "$1" = crop ] && COR=$(slurp) +grim ${COR:+"-g$COR"} ~/Pictures/$STAMP.png +notify-send -i ~/Pictures/$STAMP.png Screenshot "$STAMP.png saved${COR:+, $COR}" -- 2.45.2