aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-04-03 15:38:21 +0000
committerB Stack <bgstack15@gmail.com>2020-04-03 15:38:21 +0000
commit25a302edc305fe9bf5cd5561c91769c659ea815f (patch)
treeaf3658a050028eb914180c8ddd83a33b0ba5a611
parentMerge branch 'add-trayicon' into 'master' (diff)
parentMerge branch 'master' into 'dev' (diff)
downloadlogout-manager-master.tar.gz
logout-manager-master.tar.bz2
logout-manager-master.zip
Merge branch 'dev' into 'master'HEADmaster
minor refactor and add documentation Closes #1, #3, #2, #4, #5, and #6 See merge request bgstack15/logout-manager!3
-rw-r--r--.gitignore1
-rw-r--r--src/Makefile43
-rwxr-xr-xsrc/usr/bin/logout-manager-cli (renamed from src/usr/bin/logout-manager-cli.py)19
-rwxr-xr-xsrc/usr/bin/logout-manager-gtk (renamed from src/usr/bin/logout-manager-gtk.py)8
-rwxr-xr-xsrc/usr/bin/logout-manager-ncurses (renamed from src/usr/bin/logout-manager-ncurses.py)12
-rwxr-xr-xsrc/usr/bin/logout-manager-tcl (renamed from src/usr/bin/logout-manager-tcl.py)11
-rwxr-xr-xsrc/usr/bin/logout-manager-trayicon17
-rwxr-xr-xsrc/usr/libexec/logout-manager/lm-helper10
-rw-r--r--src/usr/share/doc/logout-manager/README.md11
-rw-r--r--src/usr/share/logout-manager/lmlib.py14
-rw-r--r--src/usr/share/man/man1/logout-manager-cli.1.md25
-rw-r--r--src/usr/share/man/man1/logout-manager-gtk.1.md16
-rw-r--r--src/usr/share/man/man1/logout-manager-ncurses.1.md16
-rw-r--r--src/usr/share/man/man1/logout-manager-tcl.1.md16
-rw-r--r--src/usr/share/man/man1/logout-manager-trayicon.1.md18
-rw-r--r--src/usr/share/man/man5/logout-manager.conf.5.md57
-rw-r--r--src/usr/share/man/man7/logout-manager.7.md45
17 files changed, 290 insertions, 49 deletions
diff --git a/.gitignore b/.gitignore
index 371e499..41f8b69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ debian/logout-manager/
debian/files
*.substvars
gitmessage
+/debian
diff --git a/src/Makefile b/src/Makefile
index 010b71e..6407823 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,9 +16,11 @@
# Document:
# Includes a nice way to dynamically generate dependencies as self-reported by all the files.
# Dependencies:
+# exclude-raw: go-md2man
+# exclude-devuan: go-md2man
APPNAME = logout-manager
-APPVERSION = 0.0.2
+APPVERSION = 0.0.4
SRCDIR = $(CURDIR)
prefix = /usr
SYSCONFDIR = $(DESTDIR)/etc
@@ -27,10 +29,11 @@ DEFAULTDIR = $(DESTDIR)/etc/sysconfig
BINDIR = $(DESTDIR)$(prefix)/bin
SHAREDIR = $(DESTDIR)$(prefix)/share
LIBEXECDIR = $(DESTDIR)$(prefix)/libexec
-DOCDIR = $(SHAREDIR)/doc/$(APPNAME)
APPDIR = $(SHAREDIR)/$(APPNAME)
APPSDIR = $(SHAREDIR)/applications
BASHCDIR = $(SHAREDIR)/bash-completion/completions
+DOCDIR = $(SHAREDIR)/doc/$(APPNAME)
+MANDIR = $(SHAREDIR)/man
SUDOERSDIR = $(SYSCONFDIR)/sudoers.d
XDGAUTODIR = $(SYSCONFDIR)/xdg/autostart
@@ -39,8 +42,10 @@ cpbin :=$(shell which cp)
echobin :=$(shell which echo)
findbin :=$(shell which find)
grepbin :=$(shell which grep)
+gzipbin :=$(shell which gzip)
installbin :=$(shell which install)
lnbin :=$(shell which ln)
+md2manbin :=$(shell which go-md2man)
rmbin :=$(shell which rm)
sedbin :=$(shell which sed)
sortbin :=$(shell which sort)
@@ -48,23 +53,28 @@ truebin :=$(shell which true)
uniqbin :=$(shell which uniq)
xargsbin :=$(shell which xargs)
+SEPARATOR ?=,
+
all:
- ${echobin} "No compilation in this package."
+ @${echobin} "No compilation in this package."
-.PHONY: clean install uninstall list deplist deplist_opts
+.PHONY: clean install uninstall list deplist deplist_opts install_files install_man
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | ${awkbin} -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | ${sortbin} | ${grepbin} -E -v -e '^[^[:alnum:]]' -e '^$@$$'
deplist:
@if test -z "$(DISTRO)" ; then ${echobin} "Please run \`make deplist\` with DISTRO= one of: `make deplist_opts 2>&1 1>/dev/null | ${xargsbin}`. Aborted." ; exit 1 ; fi
- @${grepbin} -h --exclude='Makefile' --exclude-dir='doc' -A5 -riIE dependencies $(SRCDIR) | ${awkbin} -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | ${awkbin} 'BEGIN{cmd="${xargsbin} -n1"} $$0 !~ /\(/{print $$0 | cmd ; close(cmd);} $$0 ~ /\(/{print;}' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/$$/$(SEPARATOR)/' | ${xargsbin}
+ @# deplist 2020-03-24 input must be comma separated
+ @${grepbin} -h --exclude-dir='doc' -riIE '\<dep-' ${SRCDIR} | ${awkbin} -v "domain=${DISTRO}" 'tolower($$2) ~ "dep-"domain {$$1="";$$2="";print}' | tr ',' '\n' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/^\s*//' -e "s/\s*\$$/${SEPARATOR}/" | ${xargsbin}
deplist_opts:
- @${echobin} "el7" 1>&2
- @${echobin} "devuan" 1>&2
+ @# deplist_opts 2020-03-24 find all available dependency domains
+ @${grepbin} -h -o -riIE '\<dep-[^\ :]+:' ${SRCDIR} | ${sedbin} -r -e 's/dep-//;' -e 's/:$$//;' | ${sortbin} | ${uniqbin} 1>&2
-install:
+install: install_files install_man
+
+install_files:
@${echobin} Installing files to ${DESTDIR}
${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} \
${APPSDIR} ${APPDIR} ${DOCDIR} ${BASHCDIR} ${SUDOERSDIR} \
@@ -80,17 +90,22 @@ install:
${installbin} -m 0755 -t ${LIBEXECDIR}/${APPNAME} ${SRCDIR}/usr/libexec/${APPNAME}/*
${installbin} -m 0644 -t ${XDGAUTODIR} ${SRCDIR}/etc/xdg/autostart/*
# symlink, when alternatives is not being used
- ${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager
+ ${lnbin} -s logout-manager-gtk ${BINDIR}/logout-manager || :
+
+install_man:
+ifeq ($(md2manbin),)
+ @${echobin} Cannot install man pages, because go-md2man is not found.
+ @false
+endif
+ ${installbin} -d ${MANDIR}/man1 ${MANDIR}/man5 ${MANDIR}/man7
+ for tm in $$( ${findbin} ${SRCDIR}/usr/share/man ! -type d -name '*[0-9].md' -printf '%P\n' ) ; do ${md2manbin} < ${SRCDIR}/usr/share/man/$${tm} | ${gzipbin} > ${MANDIR}/$${tm%%.md}.gz ; done
uninstall:
@${echobin} SRCDIR=${SRCDIR}
- ${rmbin} -f $$( ${findbin} ${SRCDIR} -mindepth 1 ! -type d -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" ) ${DEFAULTDIR}/${APPNAME} ${BINDIR}/logout-manager
-
- # absolute minimum directories to remove
- #${rmbin} -rf ${APPDIR} ${SYSCONFDIR}/${APPNAME} ${DOCDIR}
+ ${rmbin} -f $$( ${findbin} ${SRCDIR} -mindepth 1 ! -type d ! -name 'Makefile' -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" -e '/man[0-9]\/.*[0-9]\.md$$/{s:\.md$$:.gz:}' ) ${DEFAULTDIR}/${APPNAME} ${BINDIR}/logout-manager
# remove all installed directories that are now blank.
rmdir ${DEFAULTDIR} 2>/dev/null ; for word in $$( ${findbin} ${SRCDIR} -mindepth 1 -type d -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" | ${awkbin} '{ print length, $$0 }' | sort -rn | ${awkbin} '{print $$2}' ) ; do ${findbin} $${word} -mindepth 1 1>/dev/null 2>&1 | read 1>/dev/null 2>&1 || { rmdir "$${word}" 2>/dev/null || ${truebin} ; } ; done
clean:
- -${echobin} "target $@ not implemented yet! Gotta say unh."
+ -@${echobin} "target $@ not implemented yet! Gotta say unh."
diff --git a/src/usr/bin/logout-manager-cli.py b/src/usr/bin/logout-manager-cli
index 8fd78b4..974fd4b 100755
--- a/src/usr/bin/logout-manager-cli.py
+++ b/src/usr/bin/logout-manager-cli
@@ -1,28 +1,30 @@
#!/usr/bin/env python3
-# File: logout-manager-cli.py
+# File: logout-manager-cli
# License: CC-BY-SA 4.0
# Author: bgstack15
# Startdate: 2020-03-10 18:40
# Title: cli logout manager
# Purpose: Feature completeness in this package
# History:
+# 2020-04-03 fix #5 -n does nothing
# Usage:
-# logout-manager-cli.py
+# logout-manager-cli
# Reference:
# https://stackoverflow.com/questions/39092149/argparse-how-to-make-mutually-exclusive-arguments-optional/39092229#39092229
# https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string/12025554#12025554
# Improve:
# Dependencies:
-# Devuan: python3-dotenv python3
+# dep-devuan: python3-dotenv, python3
# Documentation:
-import os, platform, sys, argparse
+import os, sys, argparse
+from distro import linux_distribution
from dotenv import load_dotenv
# all this to load the libpath
try:
defaultdir="/etc/sysconfig"
- thisplatform = platform.platform().lower()
+ thisplatform = linux_distribution()[0].lower()
if 'debian' in thisplatform or 'devuan' in thisplatform:
defaultdir="/etc/default"
# load_dotenv keeps existing environment variables as higher precedent
@@ -32,12 +34,13 @@ except:
if 'LOGOUT_MANAGER_LIBPATH' in os.environ:
for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"):
sys.path.append(i)
+sys.path.append("/usr/share/logout-manager")
import lmlib
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
-logout_manager_cli_version="2020-03-10"
+logout_manager_cli_version="2020-04-03"
parser = argparse.ArgumentParser(description="run logout-manager commands using cli")
parser.add_argument('action', help='which action to take',nargs='?', choices=('lock','logout','hibernate','shutdown','reboot'))
@@ -47,6 +50,10 @@ parser.add_argument("-V","--version", action="version", version="%(prog)s " + lo
args = parser.parse_args()
+# handle -n
+if args.dryrun:
+ os.environ["DRYRUN"] = "from-parameters"
+
# load configs
# in cli, must happen after arparse to benefit from debug value
config = lmlib.Initialize_config(os.environ['LOGOUT_MANAGER_CONF'])
diff --git a/src/usr/bin/logout-manager-gtk.py b/src/usr/bin/logout-manager-gtk
index 553fc41..400594d 100755
--- a/src/usr/bin/logout-manager-gtk.py
+++ b/src/usr/bin/logout-manager-gtk
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# File: logout-manager-gtk.py
+# File: logout-manager-gtk
# License: CC-BY-SA 4.0
# Author: bgstack15
# Startdate: 2019-06-01
@@ -25,10 +25,11 @@
# support global conf file, and user conf file
# far future: provide graphical way to change commands run
# Dependencies:
-# Devuan: python3-dotenv
+# dep-devuan: python3-dotenv
# Documentation:
import gi, os, platform, sys
+from distro import linux_distribution
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from gi.repository import Gdk
@@ -39,7 +40,7 @@ from dotenv import load_dotenv
# all this to load the libpath
try:
defaultdir="/etc/sysconfig"
- thisplatform = platform.platform().lower()
+ thisplatform = linux_distribution()[0].lower()
if 'debian' in thisplatform or 'devuan' in thisplatform:
defaultdir="/etc/default"
# load_dotenv keeps existing environment variables as higher precedent
@@ -49,6 +50,7 @@ except:
if 'LOGOUT_MANAGER_LIBPATH' in os.environ:
for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"):
sys.path.append(i)
+sys.path.append("/usr/share/logout-manager")
import lmlib
# graphical classes and functions
diff --git a/src/usr/bin/logout-manager-ncurses.py b/src/usr/bin/logout-manager-ncurses
index 1500d85..67b18d7 100755
--- a/src/usr/bin/logout-manager-ncurses.py
+++ b/src/usr/bin/logout-manager-ncurses
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-# File: logout-manager-ncurses.py
+# File: logout-manager-ncurses
# License: MIT
# Author: adamlamers, bgstack15
# Startdate: 2020-03-09 17:06
# Title: ncurses based logout manager
# Usage:
-# logout-manager-ncurses.py
+# logout-manager-ncurses
# Reference:
# https://docs.python.org/3/howto/curses.html
# ripped straight from http://adamlamers.com/post/FTPD9KNRA8CT
@@ -13,20 +13,21 @@
# https://robinislam.me/blog/reading-environment-variables-in-python/
# Improve:
# Dependencies:
-# Devuan: python3-dotenv
+# dep-devuan: python3-dotenv
# Documentation:
# Improvements for CursesMenu class over origin:
# accepts number key inputs
# accepts enabled attribute
# add "zeroindex" bool
-import curses, os, platform, sys
+import curses, os, sys
+from distro import linux_distribution
from dotenv import load_dotenv
# all this to load the libpath
try:
defaultdir="/etc/sysconfig"
- thisplatform = platform.platform().lower()
+ thisplatform = linux_distribution()[0].lower()
if 'debian' in thisplatform or 'devuan' in thisplatform:
defaultdir="/etc/default"
# load_dotenv keeps existing environment variables as higher precedent
@@ -36,6 +37,7 @@ except:
if 'LOGOUT_MANAGER_LIBPATH' in os.environ:
for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"):
sys.path.append(i)
+sys.path.append("/usr/share/logout-manager")
import lmlib
class CursesMenu(object):
diff --git a/src/usr/bin/logout-manager-tcl.py b/src/usr/bin/logout-manager-tcl
index 127bd54..9cadc5c 100755
--- a/src/usr/bin/logout-manager-tcl.py
+++ b/src/usr/bin/logout-manager-tcl
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# File: logout-manager-tcl.py
+# File: logout-manager-tcl
# License: CC-BY-SA 4.0
# Author: bgstack15
# Startdate: 2019-06-12 20:05
@@ -7,7 +7,7 @@
# Purpose: A tcl/tk graphical program for selecting shutdown, logout, etc.
# History:
# Usage:
-# logout-manager-tcl.py
+# logout-manager-tcl
# References:
# http://effbot.org/tkinterbook/button.htm
# http://effbot.org/tkinterbook/tkinter-application-windows.htm
@@ -26,11 +26,11 @@
# Devuan: python3-tk python3-pil.imagetk python3-cairosvg
# el7: python36-tkinter python36-pillow-tk ( pip3 install cairosvg )
-import glob, os, platform, re, sys
+import glob, os, re, sys
import tkinter as tk
+from distro import linux_distribution
from functools import partial
from pathlib import Path
-from sys import path
from dotenv import load_dotenv
# loading PIL.ImageTk after tkinter makes ImageTk use the PIL version, which supports PNG. This is important on tcl < 8.6 (that is, el7)
from PIL import Image, ImageTk
@@ -46,7 +46,7 @@ except:
# all this to load the libpath
try:
defaultdir="/etc/sysconfig"
- thisplatform = platform.platform().lower()
+ thisplatform = linux_distribution()[0].lower()
if 'debian' in thisplatform or 'devuan' in thisplatform:
defaultdir="/etc/default"
# load_dotenv keeps existing environment variables as higher precedent
@@ -56,6 +56,7 @@ except:
if 'LOGOUT_MANAGER_LIBPATH' in os.environ:
for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"):
sys.path.append(i)
+sys.path.append("/usr/share/logout-manager")
import lmlib
# graphical classes and functions
diff --git a/src/usr/bin/logout-manager-trayicon b/src/usr/bin/logout-manager-trayicon
index b6471f9..9eaaa32 100755
--- a/src/usr/bin/logout-manager-trayicon
+++ b/src/usr/bin/logout-manager-trayicon
@@ -2,12 +2,17 @@
# File: logout-manager-trayicon
# License: CC-BY-SA 4.0
# Author: bgstack15
+# Startdate: 2020-03-20
+# Title: Logout Manager tray icon
+# Purpose: An easy menu from the system tray in a panel for a window manager or desktop environment
+# History:
+# 2020-04-01 update for python 3.8
# Reference:
# icon work https://stackoverflow.com/questions/45162862/how-do-i-set-an-icon-for-the-whole-application-using-pygobject
# button right click must be from "button-press-event" and import Gdk https://python-gtk-3-tutorial.readthedocs.io/en/latest/menus.html
# useful reference https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Button.html#Gtk.Button
# systray info https://github.com/PiSupply/PiJuice/blob/master/Software/Source/src/pijuice_tray.py
-# logout-manager-gtk.py
+# logout-manager-gtk
# how to determine double click https://stackoverflow.com/questions/60009648/is-there-a-better-way-to-handle-double-click-in-pygobject
# interactive python3 shell and help(Gdk.EventType)
# https://developer.gnome.org/gtk3/unstable/GtkWidget.html#GtkWidget-button-press-event
@@ -15,10 +20,11 @@
# send signals https://stackoverflow.com/questions/15080500/how-can-i-send-a-signal-from-a-python-program
# https://docs.python.org/3.8/library/signal.html#module-signal
# Dependencies:
-# dep-pip: psutil
-# dep-devuan: python3-psutil
+# dep-pip: psutil, distro
+# dep-devuan: python3-psutil, python3-distro
-import gi, os, platform, re, sys, psutil, signal
+import gi, os, re, sys, psutil, signal
+from distro import linux_distribution
gi.require_version("Gtk","3.0")
from gi.repository import Gtk
from gi.repository import Gdk
@@ -27,7 +33,7 @@ from dotenv import load_dotenv
# all this to load the libpath
try:
defaultdir="/etc/sysconfig"
- thisplatform = platform.platform().lower()
+ thisplatform = linux_distribution()[0].lower()
if 'debian' in thisplatform or 'devuan' in thisplatform:
defaultdir="/etc/default"
# load_dotenv keeps existing environment variables as higher precedent
@@ -37,6 +43,7 @@ except:
if 'LOGOUT_MANAGER_LIBPATH' in os.environ:
for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"):
sys.path.append(i)
+sys.path.append("/usr/share/logout-manager")
import lmlib
def is_dryrun():
diff --git a/src/usr/libexec/logout-manager/lm-helper b/src/usr/libexec/logout-manager/lm-helper
index 6372827..700e86f 100755
--- a/src/usr/libexec/logout-manager/lm-helper
+++ b/src/usr/libexec/logout-manager/lm-helper
@@ -1,7 +1,7 @@
#!/bin/sh
# Dependencies:
-# Devuan: wmctrl sudo
-# el7: wmctrl sudo
+# dep-devuan: wmctrl, sudo
+# dep-el7: wmctrl, sudo
case "${1}" in
help) # show this help screen
{
@@ -18,9 +18,9 @@ case "${1}" in
lock) # lock the current screen
if test -z "${DRYRUN}" ;
then
- xscreensaver --locknow
+ xscreensaver-command -lock
else
- echo "xscreensaver --locknow"
+ echo "xscreensaver-command -lock"
fi
;;
logout) # log out the current user of the graphical session
@@ -36,7 +36,7 @@ case "${1}" in
fi
;;
*)
- echo "Gotta say unh! Feature not yet implemented for \"${_wm}\"" 1>&2
+ echo "Gotta say unh! Feature not yet implemented for \"${_wm}\". Please report this to bgstack15@gmail.com" 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 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)
bgstack15