exit_menu.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. CHOICE=$(dmenu -i -b << EOF
  3. Lock
  4. Sleep
  5. Hibernate
  6. Exit
  7. Shutdown
  8. Reboot
  9. EOF
  10. )
  11. case $CHOICE in
  12. "Lock")
  13. ~/.scripts/lock.sh; xset dpms force standby
  14. ;;
  15. "Sleep")
  16. ~/.scripts/lock.sh && dbus-send \
  17. --system \
  18. --print-reply \
  19. --dest=org.freedesktop.login1 \
  20. /org/freedesktop/login1 \
  21. org.freedesktop.login1.Manager.Suspend \
  22. boolean:false
  23. ;;
  24. "Hibernate")
  25. ~/.scripts/lock.sh && dbus-send \
  26. --system \
  27. --print-reply \
  28. --dest=org.freedesktop.login1 \
  29. /org/freedesktop/login1 \
  30. org.freedesktop.login1.Manager.Hibernate \
  31. boolean:false
  32. ;;
  33. "Exit")
  34. pkill Xorg
  35. ;;
  36. "Shutdown")
  37. dbus-send \
  38. --system \
  39. --print-reply \
  40. --dest=org.freedesktop.login1 \
  41. /org/freedesktop/login1 \
  42. org.freedesktop.login1.Manager.PowerOff \
  43. boolean:false
  44. ;;
  45. "Reboot")
  46. dbus-send \
  47. --system \
  48. --print-reply \
  49. --dest=org.freedesktop.login1 \
  50. /org/freedesktop/login1 \
  51. org.freedesktop.login1.Manager.Reboot \
  52. boolean:false
  53. ;;
  54. *)
  55. ;;
  56. esac