mirror of
https://github.com/adi1090x/rofi.git
synced 2025-12-10 12:22:49 +01:00
Using dbus-send instead of systemctl for elogind compatibility
This commit is contained in:
parent
4ae073f2e5
commit
1f20c82204
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user