dotfiles/.scripts/picom.sh
Sravan Balaji d3a3c62650 Rsync Scripts
- Fix "kilall" to "killall" in scripts
- Add rsync scripts to synchronize from laptop to cloud/external hdd/phone
- Add rsync rofi menu scrip
- Add rsync rofi menu to control center
- Fix spacing issue with gamemode.ini content in README.org
2022-05-18 17:40:34 -04:00

77 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
help_menu() {
echo "Script to interact with picom. Use only one argument at a time."
echo " - Toggle On/Off: picom.sh OR picom.sh --toggle OR picom.sh -t"
echo " - Turn On: picom.sh --on"
echo " - Turn Off: picom.sh --off"
echo " - Help: picom.sh --help OR picom.sh -h"
}
is_running() {
if pgrep -x picom >/dev/null; then
echo 1
else
echo 0
fi
}
rofi_menu() {
declare -a options=(
"⏼ Toggle - toggle"
" Turn On - on"
" Turn Off - off"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
main() {
if [ $# -eq 0 ]; then
# No arguments
help_menu
else
case $1 in
--help | -h)
help_menu
;;
--toggle)
if [ $(is_running) -eq '1' ]; then
main --off
else
main --on
fi
;;
--on)
if [ $(is_running) -eq '1' ]; then
killall picom
fi
picom --config /home/sravan/.config/picom/picom.conf -b
notify-send "Turning Picom ON"
;;
--off)
if [ $(is_running) -eq '1' ]; then
killall picom
fi
notify-send "Turning Picom OFF"
;;
--rofi)
rofi_menu
;;
esac
fi
}
main $@