diff --git a/scripts/session/session-logout.sh b/scripts/session/session-logout.sh index 1bef522..8084dba 100644 --- a/scripts/session/session-logout.sh +++ b/scripts/session/session-logout.sh @@ -13,7 +13,13 @@ is_gnome() { dbus-send --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Get string:org.gnome.Shell string:ShellVersion >/dev/null 2>&1 } -if is_gnome; then +is_cosmic() { + command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ] +} + +if is_cosmic; then + cosmic-osd log-out +elif is_gnome; then gnome-session-quit --logout elif command -v loginctl >/dev/null; then loginctl terminate-user "${USER}" diff --git a/scripts/session/session-reboot.sh b/scripts/session/session-reboot.sh index cde9012..6ab6772 100644 --- a/scripts/session/session-reboot.sh +++ b/scripts/session/session-reboot.sh @@ -13,7 +13,13 @@ is_gnome() { dbus-send --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Get string:org.gnome.Shell string:ShellVersion >/dev/null 2>&1 } -if is_gnome; then +is_cosmic() { + command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ] +} + +if is_cosmic; then + cosmic-osd restart +elif is_gnome; then gnome-session-quit --reboot elif command -v systemctl >/dev/null; then systemctl reboot diff --git a/scripts/session/session-shutdown.sh b/scripts/session/session-shutdown.sh index 0c31693..046c65b 100644 --- a/scripts/session/session-shutdown.sh +++ b/scripts/session/session-shutdown.sh @@ -13,7 +13,13 @@ is_gnome() { dbus-send --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Get string:org.gnome.Shell string:ShellVersion >/dev/null 2>&1 } -if is_gnome; then +is_cosmic() { + command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ] +} + +if is_cosmic; then + cosmic-osd shutdown +elif is_gnome; then gnome-session-quit --power-off elif command -v systemctl >/dev/null; then systemctl poweroff