Using dbus-send instead of systemctl for elogind compatibility

This commit is contained in:
lepz0r 2020-07-27 09:31:32 +07:00
parent 4ae073f2e5
commit 1f20c82204
4 changed files with 12 additions and 12 deletions

View File

@ -21,10 +21,10 @@ options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)" chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)"
case $chosen in case $chosen in
$shutdown) $shutdown)
systemctl poweroff dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true
;; ;;
$reboot) $reboot)
systemctl reboot dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true
;; ;;
$lock) $lock)
i3lock i3lock
@ -32,7 +32,7 @@ case $chosen in
$suspend) $suspend)
mpc -q pause mpc -q pause
amixer set Master mute amixer set Master mute
systemctl suspend dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true
;; ;;
$logout) $logout)
openbox --exit openbox --exit

View File

@ -34,7 +34,7 @@ case $chosen in
$shutdown) $shutdown)
ans=$($dir/confirm.sh) ans=$($dir/confirm.sh)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
systemctl poweroff dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit exit
else else
@ -44,7 +44,7 @@ case $chosen in
$reboot) $reboot)
ans=$($dir/confirm.sh) ans=$($dir/confirm.sh)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
systemctl reboot dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit exit
else else
@ -59,7 +59,7 @@ case $chosen in
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
mpc -q pause mpc -q pause
amixer set Master mute amixer set Master mute
systemctl suspend dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit exit
else else

View File

@ -24,10 +24,10 @@ options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
chosen="$(echo -e "$options" | $rofi_command -p "$uptime   $cpu   $memory " -dmenu -selected-row 2)" chosen="$(echo -e "$options" | $rofi_command -p "$uptime   $cpu   $memory " -dmenu -selected-row 2)"
case $chosen in case $chosen in
$shutdown) $shutdown)
systemctl poweroff dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true
;; ;;
$reboot) $reboot)
systemctl reboot dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true
;; ;;
$lock) $lock)
i3lock i3lock
@ -35,7 +35,7 @@ case $chosen in
$suspend) $suspend)
mpc -q pause mpc -q pause
amixer set Master mute amixer set Master mute
systemctl suspend dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true
;; ;;
$logout) $logout)
openbox --exit openbox --exit

View File

@ -21,10 +21,10 @@ options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)" chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)"
case $chosen in case $chosen in
$shutdown) $shutdown)
systemctl poweroff dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true
;; ;;
$reboot) $reboot)
systemctl reboot dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true
;; ;;
$lock) $lock)
i3lock i3lock
@ -32,7 +32,7 @@ case $chosen in
$suspend) $suspend)
mpc -q pause mpc -q pause
amixer set Master mute amixer set Master mute
systemctl suspend dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true
;; ;;
$logout) $logout)
openbox --exit openbox --exit