aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-03-10 21:18:03 -0400
committerB Stack <bgstack15@gmail.com>2020-03-10 21:18:03 -0400
commitd118309b08c28c7ef7656828fe092d6c85a2e344 (patch)
tree37dd8d76da6d50fdbd5fa7fb2ab1d00738738bba
parentadd desktop file, some readme contents (diff)
downloadlogout-manager-d118309b08c28c7ef7656828fe092d6c85a2e344.tar.gz
logout-manager-d118309b08c28c7ef7656828fe092d6c85a2e344.tar.bz2
logout-manager-d118309b08c28c7ef7656828fe092d6c85a2e344.zip
WIP: add lm-helper
lm-helper has most functionality there. needs work on logout, and bash_completion function.
-rw-r--r--src/etc/logout-manager.conf10
-rwxr-xr-xsrc/usr/libexec/logout-manager/lm-helper37
-rw-r--r--src/usr/share/doc/logout-manager/README.md9
-rw-r--r--src/usr/share/doc/logout-manager/logout-manager.conf.example16
4 files changed, 67 insertions, 5 deletions
diff --git a/src/etc/logout-manager.conf b/src/etc/logout-manager.conf
index 1a14909..c37dfdf 100644
--- a/src/etc/logout-manager.conf
+++ b/src/etc/logout-manager.conf
@@ -1,9 +1,9 @@
[logout-manager]
-hibernate_command="printf 'disk' | sudo tee /sys/power/state"
-lock_command="xscreensaver --locknow"
-logout_command="logout from something"
-reboot_command="sudo shutdown -r now"
-shutdown_command="sudo shutdown -h now"
+hibernate_command="/usr/libexec/logout-manager/lm-helper hibernate"
+lock_command="/usr/libexec/logout-manager/lm-helper lock"
+logout_command="/usr/libexec/logout-manager/lm-helper logout"
+reboot_command="/usr/libexec/logout-manager/lm-helper reboot"
+shutdown_command="/usr/libexec/logout-manager/lm-helper shutdown"
[icons]
size = 24
diff --git a/src/usr/libexec/logout-manager/lm-helper b/src/usr/libexec/logout-manager/lm-helper
new file mode 100755
index 0000000..c5e37f1
--- /dev/null
+++ b/src/usr/libexec/logout-manager/lm-helper
@@ -0,0 +1,37 @@
+#!/bin/sh
+case "${1}" in
+ help) # show this help screen
+ {
+ echo "Usage: ${0}: [command]"
+ echo "used by logout-manager to perform actions like reboot, lock screen, etc."
+ echo ""
+ echo "Commands:"
+ grep -E '^\s{3}[A-Za-z]+\)' "${0}" | tr -dc '[A-Za-z\n ]' | sed -r -e 's/\s+/ /g;' | grep -v "HIDDEN\s*$" | while read a therest ; do echo " ${a}: ${therest}" ; done
+ }
+ ;;
+ options) # used by bash_completion function HIDDEN
+ grep -E '^\s{3}[A-Za-z]+\)' "${0}" | tr -dc '[A-Za-z\n]' | grep -vE 'options|help'
+ ;;
+ lock) # lock the current screen
+ xscreensaver --locknow
+ ;;
+ logout) # log out the current user of the graphical session
+ echo "Gotta say unh! Feature not yet implemented." 1>&2
+ exit 1
+ ;;
+ hibernate) # save system state to disk and power off
+ # linux only
+ printf 'disk' | tee /sys/power/state
+ ;;
+ shutdown) # power off
+ shutdown -h now
+ ;;
+ reboot) # restart the system
+ shutdown -r now
+ ;;
+ *) # HIDE
+ echo "invalid choice: ${1}" 1>&2
+ exit 1
+ ;;
+esac
+:
diff --git a/src/usr/share/doc/logout-manager/README.md b/src/usr/share/doc/logout-manager/README.md
index baa6aeb..7b8ed3d 100644
--- a/src/usr/share/doc/logout-manager/README.md
+++ b/src/usr/share/doc/logout-manager/README.md
@@ -7,6 +7,15 @@ Logout Manager is a python3 utility that provides a simple menu for logout-type
* Shutdown
* Reboot
+## Customization
+The `lm-helper` logout command needs to be customized for every desktop environment. Some may need extra configurationon the window manager/desktop environment side.
+### Fluxbox
+For Fluxbox, you need to set a value in ~/.fluxbox/init
+
+ session.screen0.allowRemoteActions: true
+
+Be aware that this is insecure. See man `fluxbox-remote(1)`.
+
## Alternatives
[oblogout](https://launchpad.net/oblogout) looks really old so I did not investigate personally, but it sounds like it does the same thing I am trying to do.
`apt-cache search logout` shows [lxsession-logout](http://manpages.ubuntu.com/manpages/precise/en/man1/lxsession-logout.1.html) which was compiled, as well as does not provide configurable options for changing executed commands or icons.
diff --git a/src/usr/share/doc/logout-manager/logout-manager.conf.example b/src/usr/share/doc/logout-manager/logout-manager.conf.example
new file mode 100644
index 0000000..1a14909
--- /dev/null
+++ b/src/usr/share/doc/logout-manager/logout-manager.conf.example
@@ -0,0 +1,16 @@
+[logout-manager]
+hibernate_command="printf 'disk' | sudo tee /sys/power/state"
+lock_command="xscreensaver --locknow"
+logout_command="logout from something"
+reboot_command="sudo shutdown -r now"
+shutdown_command="sudo shutdown -h now"
+
+[icons]
+size = 24
+#theme = default
+# use names as used by the icon theme, or give a full path here
+hibernate = system-hibernate
+lock = system-lock-screen
+logout = system-log-out
+reboot = system-reboot
+shutdown = system-shutdown
bgstack15