restart-de.sh 954 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. # Script to restart the current Desktop Environment without rebooting the system.
  3. # Thanks to this script you would not need to remember commands for each DE.
  4. xprop_session=$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') | grep _NET_WM_NAME | awk '{print $3}' | tr -d '"')
  5. if [[ "$DESKTOP_SESSION" =~ "lxqt" ]]; then
  6. killall lxqt-panel && lxqt-panel &
  7. elif [[ "$DESKTOP_SESSION" =~ "openbox" ]]; then
  8. openbox --restart &
  9. elif [[ "$DESKTOP_SESSION" =~ "plasma" ]]; then
  10. kquitapp5 plasmashell && kstart5 plasmashell &
  11. elif [[ "$DESKTOP_SESSION" =~ "gnome" ]]; then
  12. killall -3 gnome-shell && gnome-shell --replace &
  13. elif [[ "$DESKTOP_SESSION" =~ "mate" ]]; then
  14. mate-panel --replace &
  15. elif [[ "$xprop_session" =~ "JWM" ]]; then
  16. jwm -restart &
  17. elif [[ "$xprop_session" =~ "Mutter(Budgie)" ]]; then
  18. budgie-panel --replace &
  19. else
  20. echo "Error: The DE currently running is not yet supported"
  21. fi