mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-12-22 01:43:10 -05:00
Add wrapper script for exiting session
This commit is contained in:
parent
4c50bd571b
commit
8bfa54e30d
2 changed files with 29 additions and 3 deletions
|
@ -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"
|
||||
}
|
||||
|
|
26
dot_local/bin/executable_river-exit
Normal file
26
dot_local/bin/executable_river-exit
Normal 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
|
Loading…
Reference in a new issue