regexghost-dotfiles

My dotfiles and scripts
git clone git@git.regexghost.com/regexghost-dotfiles.git
Log | Files | Refs | README

POWER MANAGEMENT_SUBSTITUTION_i3_.bashrc (1381B)


      1 ## Shutdown with confirmation
      2 shutdown () {
      3 	read -p "Shutdown? (y/N) " yesOrNoShutdown
      4 	if [[ "$yesOrNoShutdown" == "y" ]]; then
      5 		tmux send-keys -t buffer_tmux.0 C-s
      6 		tmux send-keys -t buffer_tmux.0 C-q
      7 		tmux kill-session -t buffer_tmux
      8 		/usr/bin/shutdown -h 0
      9 	fi
     10 }
     11 
     12 ## Reboot with confirmation
     13 reboot () {
     14 	read -p "Reboot? (y/N) " yesOrNoReboot
     15 	if [[ "$yesOrNoReboot" == "y" ]]; then
     16 		tmux send-keys -t buffer_tmux.0 C-s
     17 		tmux send-keys -t buffer_tmux.0 C-q
     18 		tmux kill-session -t buffer_tmux
     19 		/usr/bin/systemctl reboot
     20 	fi
     21 }
     22 
     23 ## Hibernate to disk with confirmation
     24 hibernate () {
     25 	read -p "Hibernate? (y/N) " yesOrNoHibernate
     26 	[[ "$yesOrNoHibernate" == "y" ]] && systemctl hibernate
     27 }
     28 
     29 ## Hybrid-Sleep with confirmation, i.e. sleep to RAM and disk in case battery dies
     30 hybrid-sleep () {
     31 	read -p "Hybrid-Sleep? (y/N) " yesOrNoHybridSleep
     32 	[[ "$yesOrNoHybridSleep" == "y" ]] && systemctl hybrid-sleep
     33 }
     34 
     35 ## Sleep with confirmation (i.e. RAM only)
     36 qsleep () {
     37 	read -p "Sleep? (y/N) " yesOrNoQSleep
     38 	[[ "$yesOrNoQSleep" == "y" ]] && systemctl suspend
     39 }
     40 
     41 ## Log Out with confirmation
     42 log-out () {
     43 	read -p "Log Out? (y/N) " yesOrNoLogOut
     44 	[[ "$yesOrNoLogOut" == "y" ]] && i3-msg exit
     45 }
     46 
     47 ## Lock screen with confirmation
     48 lock () {
     49 	read -p "Lock Screen? (y/N) " yesOrNoLock
     50 	[[ "$yesOrNoLock" == "y" ]] && i3lock -i "$HOME/.config/regexghost/lock_screen_background.png"
     51 }