fix: non-GNOME systemd fallbacks for session scripts (#147)
This commit is contained in:
parent
fb8d5f50eb
commit
8641dc5b3e
4 changed files with 45 additions and 7 deletions
|
|
@ -1,8 +1,20 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/sh
|
||||||
#
|
#
|
||||||
# name: Log Out
|
# name: Log Out
|
||||||
# icon: system-log-out
|
# icon: system-log-out
|
||||||
# description: Log out to the login screen
|
# description: Log out to the login screen
|
||||||
# keywords: log out logout
|
# keywords: log out logout
|
||||||
|
|
||||||
gnome-session-quit --logout
|
set -eu
|
||||||
|
|
||||||
|
is_gnome() {
|
||||||
|
command -v dbus-send >/dev/null && \
|
||||||
|
command -v gnome-session-quit >/dev/null && \
|
||||||
|
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
|
||||||
|
gnome-session-quit --logout
|
||||||
|
elif command -v loginctl >/dev/null; then
|
||||||
|
loginctl terminate-user "${USER}"
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,20 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/sh
|
||||||
#
|
#
|
||||||
# name: Restart
|
# name: Restart
|
||||||
# icon: system-restart
|
# icon: system-restart
|
||||||
# description: Reboot the system
|
# description: Reboot the system
|
||||||
# keywords: power reboot restart
|
# keywords: power reboot restart
|
||||||
|
|
||||||
gnome-session-quit --reboot
|
set -eu
|
||||||
|
|
||||||
|
is_gnome() {
|
||||||
|
command -v dbus-send >/dev/null && \
|
||||||
|
command -v gnome-session-quit >/dev/null && \
|
||||||
|
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
|
||||||
|
gnome-session-quit --reboot
|
||||||
|
elif command -v systemctl >/dev/null; then
|
||||||
|
systemctl reboot
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,20 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/sh
|
||||||
#
|
#
|
||||||
# name: Power off
|
# name: Power off
|
||||||
# icon: system-shutdown
|
# icon: system-shutdown
|
||||||
# description: Shut down the system
|
# description: Shut down the system
|
||||||
# keywords: power off shutdown poweroff
|
# keywords: power off shutdown poweroff
|
||||||
|
|
||||||
gnome-session-quit --power-off
|
set -eu
|
||||||
|
|
||||||
|
is_gnome() {
|
||||||
|
command -v dbus-send >/dev/null && \
|
||||||
|
command -v gnome-session-quit >/dev/null && \
|
||||||
|
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
|
||||||
|
gnome-session-quit --power-off
|
||||||
|
elif command -v systemctl >/dev/null; then
|
||||||
|
systemctl poweroff
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/sh
|
||||||
#
|
#
|
||||||
# name: Suspend
|
# name: Suspend
|
||||||
# icon: system-suspend
|
# icon: system-suspend
|
||||||
# description: Suspend the system
|
# description: Suspend the system
|
||||||
# keywords: suspend sleep
|
# keywords: suspend sleep
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue