refactor: invoke cosmic-osd in session scripts when available
This commit is contained in:
parent
c37c2a3c6a
commit
cd39e58040
3 changed files with 21 additions and 3 deletions
|
|
@ -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
|
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
|
gnome-session-quit --logout
|
||||||
elif command -v loginctl >/dev/null; then
|
elif command -v loginctl >/dev/null; then
|
||||||
loginctl terminate-user "${USER}"
|
loginctl terminate-user "${USER}"
|
||||||
|
|
|
||||||
|
|
@ -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
|
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
|
gnome-session-quit --reboot
|
||||||
elif command -v systemctl >/dev/null; then
|
elif command -v systemctl >/dev/null; then
|
||||||
systemctl reboot
|
systemctl reboot
|
||||||
|
|
|
||||||
|
|
@ -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
|
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
|
gnome-session-quit --power-off
|
||||||
elif command -v systemctl >/dev/null; then
|
elif command -v systemctl >/dev/null; then
|
||||||
systemctl poweroff
|
systemctl poweroff
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue