diff options
author | B Stack <bgstack15@gmail.com> | 2020-04-03 15:38:21 +0000 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-04-03 15:38:21 +0000 |
commit | 25a302edc305fe9bf5cd5561c91769c659ea815f (patch) | |
tree | af3658a050028eb914180c8ddd83a33b0ba5a611 /src/usr/share | |
parent | Merge branch 'add-trayicon' into 'master' (diff) | |
parent | Merge branch 'master' into 'dev' (diff) | |
download | logout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.tar.gz logout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.tar.bz2 logout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.zip |
minor refactor and add documentation
Closes #1, #3, #2, #4, #5, and #6
See merge request bgstack15/logout-manager!3
Diffstat (limited to 'src/usr/share')
-rw-r--r-- | src/usr/share/doc/logout-manager/README.md | 11 | ||||
-rw-r--r-- | src/usr/share/logout-manager/lmlib.py | 14 | ||||
-rw-r--r-- | src/usr/share/man/man1/logout-manager-cli.1.md | 25 | ||||
-rw-r--r-- | src/usr/share/man/man1/logout-manager-gtk.1.md | 16 | ||||
-rw-r--r-- | src/usr/share/man/man1/logout-manager-ncurses.1.md | 16 | ||||
-rw-r--r-- | src/usr/share/man/man1/logout-manager-tcl.1.md | 16 | ||||
-rw-r--r-- | src/usr/share/man/man1/logout-manager-trayicon.1.md | 18 | ||||
-rw-r--r-- | src/usr/share/man/man5/logout-manager.conf.5.md | 57 | ||||
-rw-r--r-- | src/usr/share/man/man7/logout-manager.7.md | 45 |
9 files changed, 212 insertions, 6 deletions
diff --git a/src/usr/share/doc/logout-manager/README.md b/src/usr/share/doc/logout-manager/README.md index d34f02c..53c2713 100644 --- a/src/usr/share/doc/logout-manager/README.md +++ b/src/usr/share/doc/logout-manager/README.md @@ -22,7 +22,7 @@ Be aware that this is insecure. See man `fluxbox-remote(1)`. `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. ## License -[logout-manager-ncurses.py](src/usr/bin/logout-manager-ncurses.py) is licensed under the [MIT license](http://choosealicense.com/licenses/mit) and is derived almost entirely from [adamlamers](http://adamlamers.com/post/FTPD9KNRA8CT). +[logout-manager-ncurses](src/usr/bin/logout-manager-ncurses) is licensed under the [MIT license](http://choosealicense.com/licenses/mit) and is derived almost entirely from [adamlamers](http://adamlamers.com/post/FTPD9KNRA8CT). Everything else is licensed under [CC-BY-SA 4.0](https://choosealicense.com/licenses/cc-by-sa-4.0/). ## Description @@ -38,3 +38,12 @@ This project is partially a programming playground for the [original author](htt ## Downsides * This whole thing is more complex than just logging out of my user session, and selecting a logout-type action from the display manager. * Depends on sudo instead of using native tools. + +## Changelog +### 0.0.3 +* 2020-04-02 +* Add man pages +* drop .py endings +* Adapt to python 3.8 + * fix [#2](https://gitlab.com/bgstack15/logout-manager/-/issues/2) AttributeError: module 'platform' has no attribute 'dist' + * fix [#3](https://gitlab.com/bgstack15/logout-manager/-/issues/3) for Devuan Ceres 4: platform.platform() does not show "Devuan" diff --git a/src/usr/share/logout-manager/lmlib.py b/src/usr/share/logout-manager/lmlib.py index 40ee3a0..3bcbc32 100644 --- a/src/usr/share/logout-manager/lmlib.py +++ b/src/usr/share/logout-manager/lmlib.py @@ -7,15 +7,18 @@ # Purpose: Store the common elements for operating a logout-manager # History: # Usage: -# In a logout-manager-gtk.py program +# In a logout-manager-gtk program # Reference: # platform info https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python/10091465#10091465 # Improve: # Documentation: +# Dependencies: +# dep-devuan: python3-distro, python3:any -import configparser, platform, os, subprocess +import configparser, os, subprocess +from distro import linux_distribution -logout_manager_version="2020-03-10a" +logout_manager_version="2020-04-01a" class Actions: @@ -260,9 +263,10 @@ def Initialize_config(infile): # set icon category # written primarily for el7 which uses "app" for the system-reboot icons, etc. - a = platform.dist() + a, b, _ = linux_distribution() + a = a.lower() try: - if a[0] == "redhat" and int(a[1].split(".")[0]) <= 7: + if ("red hat" in a or "redhat" in a) and int(b.split(".")[0]) <= 7: config.set_icon_category("apps") except: pass diff --git a/src/usr/share/man/man1/logout-manager-cli.1.md b/src/usr/share/man/man1/logout-manager-cli.1.md new file mode 100644 index 0000000..d4cb02c --- /dev/null +++ b/src/usr/share/man/man1/logout-manager-cli.1.md @@ -0,0 +1,25 @@ +logout-manager-cli 1 "April 2020" logout-manager "General Commands Manual" +================================================== +# NAME +logout-manager-cli - command line interface for invoking logout options +# SYNOPSIS +logout-manager-cli [OPTIONS] [ACTION] +# DESCRIPTION +Use this interface to `logout-manager`(7) from the command line or in scripts. Parameters can be passed to determine the action to take. +# OPTIONS + +-h, --help show a help screen + +-d [0-10] set debug level + +-n Dryrun only! Do not take action. Useful with `hibernate` to determine if hibernate is allowed on this system. + +-V --version Display version and exit +# ACTIONS +One action may be specified on the command line. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7),`logout-manager.conf`(5) diff --git a/src/usr/share/man/man1/logout-manager-gtk.1.md b/src/usr/share/man/man1/logout-manager-gtk.1.md new file mode 100644 index 0000000..2130f6b --- /dev/null +++ b/src/usr/share/man/man1/logout-manager-gtk.1.md @@ -0,0 +1,16 @@ +logout-manager-gtk 1 "April 2020" logout-manager "General Commands Manual" +================================================== +# NAME +logout-manager-gtk - gtk3 interface for invoking logout options +# SYNOPSIS +logout-manager-gtk +# DESCRIPTION +Use this interface to `logout-manager`(7) in an X11 graphical environment. Using gtk3, this program displays buttons with text and icons to present a simple menu for invoking different logout-related commands. +# ACTIONS +When a button is selected, an action is invoked. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7),`logout-manager.conf`(5) diff --git a/src/usr/share/man/man1/logout-manager-ncurses.1.md b/src/usr/share/man/man1/logout-manager-ncurses.1.md new file mode 100644 index 0000000..4053ce3 --- /dev/null +++ b/src/usr/share/man/man1/logout-manager-ncurses.1.md @@ -0,0 +1,16 @@ +logout-manager-ncurses 1 "April 2020" logout-manager "General Commands Manual" +================================================== +# NAME +logout-manager-ncurses - ncurses interface for invoking logout options +# SYNOPSIS +logout-manager-ncurses +# DESCRIPTION +Use this interface to `logout-manager`(7) in a console or terminal window. It displays numerized options, which can also be navigated with arrow keys or vim-style [jk] keys. The presented menu shows a list of actions for invoking different logout-related commands. +# ACTIONS +When an entry is selected, an action is invoked. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7),`logout-manager.conf`(5) diff --git a/src/usr/share/man/man1/logout-manager-tcl.1.md b/src/usr/share/man/man1/logout-manager-tcl.1.md new file mode 100644 index 0000000..e6ec55f --- /dev/null +++ b/src/usr/share/man/man1/logout-manager-tcl.1.md @@ -0,0 +1,16 @@ +logout-manager-tcl 1 "April 2020" logout-manager "General Commands Manual" +================================================== +# NAME +logout-manager-tcl - Tcl/tk interface for invoking logout options +# SYNOPSIS +logout-manager-tcl +# DESCRIPTION +Use this interface to `logout-manager`(7) in an X11 graphical environment. Using the python3 tkinter library, this program displays buttons with text and icons to present a simple menu for invoking different logout-related commands. +# ACTIONS +When a button is selected, an action is invoked. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7),`logout-manager.conf`(5) diff --git a/src/usr/share/man/man1/logout-manager-trayicon.1.md b/src/usr/share/man/man1/logout-manager-trayicon.1.md new file mode 100644 index 0000000..1f33e73 --- /dev/null +++ b/src/usr/share/man/man1/logout-manager-trayicon.1.md @@ -0,0 +1,18 @@ +logout-manager-trayicon 1 "April 2020" logout-manager "General Commands Manual" +================================================== +# NAME +logout-manager-trayicon - system tray icon for invoking logout options +# SYNOPSIS +logout-manager-trayicon +# DESCRIPTION +This interface to `logout-manager`(7) displays a system tray (notification area) icon. `Right-clicking` the icon displays a popup menu with options for invoking different logout-related commands. +A disabled menu entry also shows the currently-logged in user, as well as a notification if `DRYRUN` is set. +`Double-clicking` the icon will invoke `logout-manager` which is usually aliases to one of the available interfaces for `logout-manager`(7) +# ACTIONS +When a button from the menu is selected, an action is invoked. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7),`logout-manager.conf`(5) diff --git a/src/usr/share/man/man5/logout-manager.conf.5.md b/src/usr/share/man/man5/logout-manager.conf.5.md new file mode 100644 index 0000000..6b5cce3 --- /dev/null +++ b/src/usr/share/man/man5/logout-manager.conf.5.md @@ -0,0 +1,57 @@ +logout-manager.conf 5 "April 2020" logout-manager "File Formats and Conventions" +================================================== +# NAME +logout-manager.conf - the configuration file for logout-manager +# FILE FORMAT +The file has an ini-style syntax and consists of sections and parameters. A section begins with the name of the section in square brackets and continues until the next section begins. An example: + + [section] + key = "value" + key2 = value2 + +Put a value in double quotes if you need the white space preserved. +logout-manager.conf must be a regular file, and readable by all users who are permitted to run logout-manager. This is usually the same users who are permitted to log in to a graphical session. +# SECTIONS AND EXAMPLES +### The [logout-manager] section +Define the command for a given action. + +`Section parameters` + +lock_command, logout_command, hibernate_command, shutdown_command, reboot_command + The value will be invoked upon selection of the named action. Place a command with its parameters in double quotes. + Defaults: + + lock_command="/usr/libexec/logout-manager/lm-helper lock" + logout_command="/usr/libexec/logout-manager/lm-helper logout" + hibernate_command="sudo /usr/libexec/logout-manager/lm-helper hibernate" + reboot_command="sudo /usr/libexec/logout-manager/lm-helper reboot" + shutdown_command="sudo /usr/libexec/logout-manager/lm-helper shutdown" +### The [icons] section +Configuration options for which icons to display, for the gtk3, tcl, and trayicon front-ends. + +`Section parameters` + +size (integer) + The height and width, in pixels, of the icons for the gtk3 and tcl frontends. + Default: 24 + +theme + The gtk3 icon theme. Options include your currently installed themes in `/usr/share/icons`, or the string *default* which loads the current gtk3 theme as defined in `${HOME}/.config/gtk-3.0/settings.ini`, value `gtk-icon-theme-name`. + Default: default + +lock, logout, hibernate, shutdown, reboot + Each of these entries can be given an icon name, e.g., "system-reboot", or a full path to a specific file. + Defaults: + + lock = system-lock-screen + logout = system-log-out + hibernate = system-hibernate + shutdown = system-shutdown + reboot = system-reboot +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager`(7) +Icon theme specification `http://www.freedesktop.org/wiki/Specifications/icon-theme-spec/` diff --git a/src/usr/share/man/man7/logout-manager.7.md b/src/usr/share/man/man7/logout-manager.7.md new file mode 100644 index 0000000..339d99b --- /dev/null +++ b/src/usr/share/man/man7/logout-manager.7.md @@ -0,0 +1,45 @@ +logout-manager 7 "April 2020" logout-manager "Common configuration options" +================================================== +# NAME +logout-manager - common configuration options +# SYNOPSIS +This program manages a list of options for common logout commands, and can be used by a number of front-ends, including: + +`logout-manager-cli`(1) +`logout-manager-gtk`(1) +`logout-manager-ncurses`(1) +`logout-manager-tcl`(1) +`logout-manager-trayicon`(1) + +Of the listed front-ends, the trayicon and cli are not recommended for aliasing to the short name `logout-manager`. + +The library for logout-manager uses a number of environment variables; see below. +# ENVIRONMENT VARIABLES +If the defaults file (nominally `/etc/sysconfig/logout-manager`) does not define the following variables, you can define them in your own situation. + +`LOGOUT_MANAGER_LIBPATH`=/usr/share/logout-manager + +`LOGOUT_MANAGER_CONF`=/etc/logout-manager.conf + +Additional environment variables are used. +`DRYRUN`=1 If DRYRUN is set to any non-null value, the actions will instead only display what would be executed and will not execute the commands. + +# ACTIONS +An action is one of the following. + +**lock** hide and password-protect current screen + +**logout** close this graphical session + +**hibernate** save session memory to disk and power off. Note that not all hardware supports this. + +**shutdown** power off + +**reboot** restarts the system + +# AUTHOR +bgstack15 `https://bgstack15.wordpress.com/` +# COPYRIGHT +CC-BY-SA 4.0 +# SEE ALSO +`logout-manager.conf`(5), `logout-manager-cli`(1), `logout-manager-gtk`(1), `logout-manager-ncurses`(1), `logout-manager-tcl`(1), `logout-manager-trayicon`(1) |