Files
dotfiles/.scripts/session.sh
Sravan Balaji 1ddbd596b6 Git Editor, Dunst Appearance, Game Scripts, Session Control No Password, Startup Application Fixes
- Change dunst x-spacing to 0 in Xresources so notifications line up
  with edge of screen
- Change git editor to emacs in gitconfig and environment variable
- Remove git difftool from gitconfig
- Add game launch script to turn off compositor and toggle dnd for notifications
- Add game exit script to toggle dnd for notifications
- Remove pkexec from session.sh since password is not necessary
- Separate apps & system processes in startup.sh
- Start system processes in xinitrc
- Start tray apps after delay in xinitrc to fix issues w/ missing
  icons and scrolling / OSD not working
- Replace some polybar modules with tray applications
2021-05-23 16:02:40 -04:00

71 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
help_menu() {
echo "Script to interact with desktop session. Use only one argument at a time."
# echo " - Play / Pause: playerctl.sh --play-pause"
# echo " - Next: playerctl.sh --next"
# echo " - Previous: playerctl.sh --prev"
# echo " - Change Player: playerctl.sh --change"
# echo " - Rofi Menu: playerctl.sh --rofi"
# echo " - Help: playerctl.sh --help OR playerctl.sh -h"
}
rofi_menu() {
declare -a options=(
" Recompile & Restart Xmonad - restart"
" Logout - logout"
" Lock - lock"
"⏾ Sleep - sleep"
" Reboot - reboot"
" Shutdown - shutdown"
"鈴 Hibernate - hibernate"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
main "--$option" && main "--rofi"
fi
}
main() {
if [ $# -eq 0 ]; then
# No arguments
help_menu
else
case $1 in
--help | -h)
help_menu
;;
--logout)
notify-send -t 0 "Session Control" "Press M-S-q to exit xmonad"
;;
--lock)
light-locker-command --lock
;;
--sleep)
systemctl suspend
;;
--reboot)
reboot
;;
--shutdown)
shutdown now
;;
--hibernate)
systemctl hibernate
;;
--restart)
xmonad --recompile
xmonad --restart
;;
--rofi)
rofi_menu
;;
esac
fi
}
main $@