diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-18 01:17:06 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-18 01:17:06 +0300 |
commit | a36aadab60c09bff3a055b0442971aa5e8a87a27 (patch) | |
tree | 0026c02065a0cf35478386312aeb5cb732192469 /dotfiles/.local/bin/screensht | |
parent | 484181c25cba61469254e24bff578cff5189c8a7 (diff) | |
download | swayrice-a36aadab60c09bff3a055b0442971aa5e8a87a27.tar.gz swayrice-a36aadab60c09bff3a055b0442971aa5e8a87a27.zip |
WIP: rofi
* Moved basically all menu scripts to use rofi
* Updated some custom desktop entries
* Updated list of packages. TODO: make a better installer script/package
list.
* Removed some old and extraneous scripts.
* Other minor changes to config.
Diffstat (limited to 'dotfiles/.local/bin/screensht')
-rwxr-xr-x | dotfiles/.local/bin/screensht | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/screensht b/dotfiles/.local/bin/screensht new file mode 100755 index 0000000..f170d38 --- /dev/null +++ b/dotfiles/.local/bin/screensht @@ -0,0 +1,51 @@ +#!/bin/sh + +notify_saved() { + notify-send -i "$1" "🖼 Screenshot" "Screenshot has been saved in $1" ; +} + +notify_copied() { + notify-send "🖼 Screenshot" "Screenshot has been copied to clipboard" ; +} + +if [ "$2" = "copy" ]; then + case "$1" in + "select area") + grim -g "$(slurp)" - | wl-copy + notify_copied + ;; + "current window") + grim -g "$(swaygetcurrentwindow)" - | wl-copy + notify_copied + ;; + "full screen") + grim - | wl-copy + notify_copied + ;; + *) exit 0;; + esac + exit 0 +else + if ! [ -d $SCROT_DIR ]; then + mkdir -p $SCROT_DIR + fi + case "$1" in + "select area") + scrpath="$SCROT_DIR/selected-$(date '+%y%m%d-%H%M-%S').png" + grim -g "$(slurp)" "$scrpath" + notify_saved "$scrpath" + ;; + "current window") + scrpath="$SCROT_DIR/window-$(date '+%y%m%d-%H%M-%S').png" + grim -g "$(swaygetcurrentwindow)" "$scrpath" + notify_saved "$scrpath" + ;; + "full screen") + scrpath="$SCROT_DIR/fullscreen-$(date '+%y%m%d-%H%M-%S').png" + grim "$scrpath" + notify_saved "$scrpath" + ;; + *) exit 0;; + esac + exit 0 +fi |