commit 50af9e24b300ecb39c0323386c004e88b5a11047
parent f012240737542210421a2fca164bf2c4d09d9c34
Author: Vincent Demeester <vincent@sbr.pm>
Date: Wed, 24 Aug 2022 15:55:59 +0200
users/vincent: fix some scripts for sway
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
5 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/nix/packages/my/scripts/bin/pbcopy b/nix/packages/my/scripts/bin/pbcopy
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
if [ ! $(uname -s) = "Darwin" ]; then
- if ! command -v wl-copy &> /dev/null; then
+ if command -v wl-copy &> /dev/null; then
wl-copy $@
else
xsel --clipboard --input $@
diff --git a/nix/packages/my/scripts/bin/pbpaste b/nix/packages/my/scripts/bin/pbpaste
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
if [ ! $(uname -s) = "Darwin" ]; then
- if ! command -v wl-paste &> /dev/null; then
+ if command -v wl-paste &> /dev/null; then
wl-paste $@
else
xsel --clipboard --output $@
diff --git a/nix/packages/my/scripts/bin/shot b/nix/packages/my/scripts/bin/shot
@@ -1,18 +1,19 @@
#!/usr/bin/env bash
-SCREENSHOT_BIN=main
-SLOP_BIN=slop
-if ! command -v grim &> /dev/null; then
- SCREENSHOT_BIN=grim
-fi
-if ! command -v slurp &> /dev/null; then
- SLOP_BIN=slurp
-fi
-$SCREENSHOT_BIN -g $($SLOP_BIN; sleep ${2:-0}) | {
+to=""
+if command -v grim &> /dev/null; then
case $1 in
- %c) to='clipboard'; xclip -selection clipboard -t image/png ;;
- %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; cat > "$to" ;;
- *) to=$1; cat > "$to" ;;
+ %c) to='clipboard'; grim -g "$(slurp)" - | wl-copy ;;
+ %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; grim -g "$(slurp)" "$to" ;;
+ *) to=$1; grim -g "$(slurp)" "$to" ;;
esac
- notify-send -i accessories-screenshot 'Screenshot Taken' "Saved to $to"
-}
+else
+ maim -g $(slop; sleep ${2:-0}) | {
+ case $1 in
+ %c) to='clipboard'; xclip -selection clipboard -t image/png ;;
+ %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; cat > "$to" ;;
+ *) to=$1; cat > "$to" ;;
+ esac
+ }
+fi
+notify-send -i accessories-screenshot 'Screenshot Taken' "Saved to $to"
diff --git a/nix/packages/my/scripts/bin/shotf b/nix/packages/my/scripts/bin/shotf
@@ -1,14 +1,19 @@
#!/usr/bin/env bash
SCREENSHOT_BIN="main -d"
-if ! command -v grim &> /dev/null; then
- SCREENSHOT_BIN=grim
-fi
-$SCREENSHOT_BIN | {
+if command -v grim &> /dev/null; then
+ case $1 in
+ %c) to='clipboard'; grim - | wl-copy ;;
+ %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; grim "$to" ;;
+ *) to=$1; grim "$to" ;;
+ esac
+else
+maim -d | {
case $1 in
%c) to='clipboard'; xclip -selection clipboard -t image/png ;;
%d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; cat > "$to" ;;
*) to=$1; cat > "$to" ;;
esac
- notify-send -i accessories-screenshot 'Screenshot Taken' "Saved to $to"
}
+fi
+notify-send -i accessories-screenshot 'Screenshot Taken' "Saved to $to"
diff --git a/users/vincent/desktop/sway.nix b/users/vincent/desktop/sway.nix
@@ -279,13 +279,14 @@ in
swaylock
swayidle
swaybg
+ wf-recorder
wl-clipboard
mako
wofi
waybar
slurp
grim
- zenity
+ gnome3.zenity
# terminals
# FIXME move this away, they work on both Xorg and Wayland/Sway
alacritty