aboutsummaryrefslogtreecommitdiff
path: root/.config/rofi/applets/menu/screenshot.sh
diff options
context:
space:
mode:
authorAlec Goncharow <algo@cloudflare.com>2022-02-20 11:50:35 -0500
committerAlec Goncharow <algo@cloudflare.com>2022-02-20 11:50:35 -0500
commitf5abca7278f3ac0c7358e6f30db8a15da45a1e3b (patch)
tree96889e1a2cc2367b8461414ae7c94d9050b84890 /.config/rofi/applets/menu/screenshot.sh
parent3e0c8208ccbead65cd434fe730223a7ab854c377 (diff)
parent72cf398a6292fa56d57e82caa4d21570e5573294 (diff)
Merge branch 'desktop' of github.com:AlecGoncharow/dotfiles into desktop
Diffstat (limited to '.config/rofi/applets/menu/screenshot.sh')
-rwxr-xr-x.config/rofi/applets/menu/screenshot.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/.config/rofi/applets/menu/screenshot.sh b/.config/rofi/applets/menu/screenshot.sh
new file mode 100755
index 0000000..24c5e1b
--- /dev/null
+++ b/.config/rofi/applets/menu/screenshot.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+
+## Author : Aditya Shakya
+## Mail : adi1090x@gmail.com
+## Github : @adi1090x
+## Twitter : @adi1090x
+
+style="$($HOME/.config/rofi/applets/menu/style.sh)"
+
+dir="$HOME/.config/rofi/applets/menu/configs/$style"
+rofi_command="rofi -theme $dir/screenshot.rasi"
+
+# Error msg
+msg() {
+ rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "Please install 'scrot' first."
+}
+
+# Options
+screen=""
+area=""
+window=""
+
+# Variable passed to rofi
+options="$screen\n$area\n$window"
+
+chosen="$(echo -e "$options" | $rofi_command -p 'App : scrot' -dmenu -selected-row 1)"
+case $chosen in
+ $screen)
+ if [[ -f /usr/bin/scrot ]]; then
+ sleep 1; scrot 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
+ else
+ msg
+ fi
+ ;;
+ $area)
+ if [[ -f /usr/bin/scrot ]]; then
+ scrot -s 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
+ else
+ msg
+ fi
+ ;;
+ $window)
+ if [[ -f /usr/bin/scrot ]]; then
+ sleep 1; scrot -u 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
+ else
+ msg
+ fi
+ ;;
+esac
+