dotfiles/.scripts/picom.sh
Sravan Balaji 9017a65bcf Submodule Updates & Picom Config Changes
- Update doom-emacs submodule
- Update dracula theme submodules
- Update doom-emacs-config submodule with file extension mode
  association and frame opacity
- Update dwm-flexipatch submodule with deck layout
- Update picom config to vsync at 144Hz instead of auto-detecting
  refresh rate
- Add matlab-schemes submodule for MATLAB editor themeing
- Remove automatically turning picom back on in game_exit.sh because
  it causing visual glitches. Manually turning it back on seems
  to work fine.
- Fix rofi menu icons for picom script
- Use picom "-b" flag instead of running it in background manually
  with "&"
2021-09-26 18:17:57 -04:00

77 lines
1.6 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
kilall 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 $@