Add wrapper script for exiting session

This commit is contained in:
Andrew Scott 2024-01-13 01:14:19 -05:00
parent 4c50bd571b
commit 8bfa54e30d
Signed by: a
GPG key ID: 7CD5A5977E4931C1
2 changed files with 29 additions and 3 deletions

View file

@ -12,13 +12,13 @@
}
{
"label" : "logout",
"action" : "${HOME}/.local/bin/river-logout",
"action" : "${HOME}/.local/bin/river-exit logout",
"text" : "Logout",
"keybind" : "e"
}
{
"label" : "shutdown",
"action" : "loginctl poweroff",
"action" : "${HOME}/.local/bin/river-exit poweroff",
"text" : "Shutdown",
"keybind" : "s"
}
@ -30,7 +30,7 @@
}
{
"label" : "reboot",
"action" : "loginctl reboot",
"action" : "${HOME}/.local/bin/river-exit reboot",
"text" : "Reboot",
"keybind" : "r"
}

View file

@ -0,0 +1,26 @@
#!/bin/sh
river=$(ps -C river | awk '/river/')
if [ -z "$river" ]; then
echo "error: $0: River is not running"
exit 1
elif [ $# -ne 1 ]; then
echo "Usage: river-exit [command]"
echo "Commands: logout, poweroff, or reboot"
exit 1
fi
if [ "$1" = "logout" ]; then
riverctl spawn 'reset'
riverctl exit
elif [ "$1" = "poweroff" ]; then
riverctl spawn 'reset'
loginctl poweroff
elif [ "$1" = "reboot" ]; then
riverctl spawn 'reset'
loginctl reboot
else
echo "error: $0: unexpected argument"
exit 1
fi