dm-system-exit.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env bash
  2. # with openrc use loginctl
  3. [ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl
  4. # declare options=("lock
  5. options=("lock
  6. switch_user
  7. logout
  8. suspend
  9. hibernate
  10. reboot
  11. shutdown")
  12. # Colors:
  13. # # Materia Manjaro
  14. # nf='#09dbc9'
  15. # nb='#222b2e'
  16. # sf='#dbdcd5'
  17. # sb='#009185'
  18. # Everforest
  19. nf='#d3c6aa'
  20. nb='#2d353b'
  21. sf='#a7c080'
  22. sb='#6C7477'
  23. fn='Iosevka-18:normal'
  24. # fn='Ubuntu-16:normal'
  25. # Gruvbox
  26. # nf='#fea63c'
  27. # nb='#282828'
  28. # # sf='#dbdcd5'
  29. # sb='#d79921'
  30. # fn='Sarasa Mono SC Nerd-17:normal'
  31. DMENU="dmenu -i -l 10 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p"
  32. choice=$(${DMENU} 'System:' <<< "$options")
  33. # choice=$(dmenu -i -l 10 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p 'System:' <<< "$options")
  34. case $choice in
  35. lock)
  36. # blurlock
  37. # dm-tool lock
  38. $HOME/.myScripts/system_exit/lock.sh
  39. ;;
  40. logout)
  41. # i3-msg exit
  42. # $HOME/.myScripts/system_exit/exit_qtile.py
  43. id=$(pgrep qtile)
  44. kill -15 $id
  45. ;;
  46. switch_user)
  47. dm-tool switch-to-greeter
  48. ;;
  49. suspend)
  50. $HOME/.myScripts/system_exit/lock.sh && $logind suspend
  51. # blurlock && $logind suspend
  52. ;;
  53. hibernate)
  54. $HOME/.myScripts/system_exit/lock.sh && $logind hibernate
  55. # blurlock && $logind hibernate
  56. ;;
  57. reboot)
  58. $logind reboot
  59. ;;
  60. shutdown)
  61. $logind poweroff
  62. ;;
  63. *)
  64. exit 1;;
  65. esac
  66. exit 0