Skip to content

Commit cd39e58

Browse files
wash2mmstick
authored andcommitted
refactor: invoke cosmic-osd in session scripts when available
1 parent c37c2a3 commit cd39e58

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

scripts/session/session-logout.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ is_gnome() {
1313
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
1414
}
1515

16-
if is_gnome; then
16+
is_cosmic() {
17+
command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ]
18+
}
19+
20+
if is_cosmic; then
21+
cosmic-osd log-out
22+
elif is_gnome; then
1723
gnome-session-quit --logout
1824
elif command -v loginctl >/dev/null; then
1925
loginctl terminate-user "${USER}"

scripts/session/session-reboot.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ is_gnome() {
1313
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
1414
}
1515

16-
if is_gnome; then
16+
is_cosmic() {
17+
command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ]
18+
}
19+
20+
if is_cosmic; then
21+
cosmic-osd restart
22+
elif is_gnome; then
1723
gnome-session-quit --reboot
1824
elif command -v systemctl >/dev/null; then
1925
systemctl reboot

scripts/session/session-shutdown.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ is_gnome() {
1313
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
1414
}
1515

16-
if is_gnome; then
16+
is_cosmic() {
17+
command -v cosmic-osd >/dev/null && [ "$XDG_SESSION_DESKTOP" = "COSMIC" ]
18+
}
19+
20+
if is_cosmic; then
21+
cosmic-osd shutdown
22+
elif is_gnome; then
1723
gnome-session-quit --power-off
1824
elif command -v systemctl >/dev/null; then
1925
systemctl poweroff

0 commit comments

Comments
 (0)