mirror of
https://github.com/adi1090x/rofi.git
synced 2024-11-23 06:38:21 -05:00
51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
## Author : Aditya Shakya
|
||
|
## Mail : adi1090x@gmail.com
|
||
|
## Github : @adi1090x
|
||
|
## Twitter : @adi1090x
|
||
|
|
||
|
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||
|
|
||
|
dir="$HOME/.config/rofi/applets/applets/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 '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
|
||
|
|