From ffea6275fcb08b36c3d7f5182785cbd329f15e40 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 10 Mar 2020 20:40:39 -0400 Subject: add desktop file, some readme contents --- src/Makefile | 85 +++++++++++++++++++++++ src/etc/default/logout-manager | 2 - src/etc/sysconfig/logout-manager | 2 + src/usr/share/applications/logout-manager.desktop | 12 ++++ src/usr/share/doc/logout-manager/README.md | 38 ++++++++++ 5 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 src/Makefile delete mode 100644 src/etc/default/logout-manager create mode 100644 src/etc/sysconfig/logout-manager create mode 100644 src/usr/share/applications/logout-manager.desktop create mode 100644 src/usr/share/doc/logout-manager/README.md (limited to 'src') diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..6af4efb --- /dev/null +++ b/src/Makefile @@ -0,0 +1,85 @@ +# File: Makefile for logout-manager +# Location: logout-manager source package +# Author: bgstack15 +# Startdate: 2020-03-10 +# Title: Makefile for logout-manager source package +# Purpose: To use traditional Unix make utility +# History: +# Usage: +# Reference: +# https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile/26339924#26339924 +# https://stackoverflow.com/questions/19105241/how-do-you-conditionally-call-a-target-based-on-a-target-variable-makefile/19107231#19107231 +# https://stackoverflow.com/questions/5917576/sort-a-text-file-by-line-length-including-spaces +# https://superuser.com/questions/352289/bash-scripting-test-for-empty-directory/667100#667100 +# bgscripts Makefile +# Improve: +# Document: +# Dependencies: + +APPNAME = logout-manager +APPVERSION = 0.0.1 +SRCDIR = $(CURDIR) +prefix = /usr +SYSCONFDIR = $(DESTDIR)/etc +DEFAULTDIR = $(DESTDIR)/etc/sysconfig +# for debian use '$(DESTDIR)/etc/default' +BINDIR = $(DESTDIR)$(prefix)/bin +SHAREDIR = $(DESTDIR)$(prefix)/share +LIBEXECDIR = $(DESTDIR)$(prefix)/libexec +DOCDIR = $(SHAREDIR)/doc/$(APPNAME) +APPDIR = $(SHAREDIR)/$(APPNAME) +APPSDIR = $(SHAREDIR)/applications + +awkbin :=$(shell which awk) +cpbin :=$(shell which cp) +echobin :=$(shell which echo) +findbin :=$(shell which find) +grepbin :=$(shell which grep) +installbin :=$(shell which install) +rmbin :=$(shell which rm) +sedbin :=$(shell which sed) +sortbin :=$(shell which sort) +truebin :=$(shell which true) +xargsbin :=$(shell which xargs) +lnbin :=$(shell which ln) + +all: + ${echobin} "No compilation in this package." + +.PHONY: clean install uninstall list deplist deplist_opts + +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' -A5 -riIE dependencies $(SRCDIR) | awk -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | sort | uniq | xargs + +deplist_opts: + @${echobin} "el7" 1>&2 + @${echobin} "devuan" 1>&2 + +install: + @${echobin} Installing files to ${DESTDIR} + ${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} ${APPSDIR} ${APPDIR} ${DOCDIR} + ${cpbin} -pr ${SRCDIR}/etc/*.* ${SYSCONFDIR} + ${cpbin} -pr ${SRCDIR}/etc/sysconfig/* ${DEFAULTDIR} + ${cpbin} -pr ${SRCDIR}/usr/bin/* ${BINDIR} + ${cpbin} -pr ${SRCDIR}/usr/share/applications/* ${APPSDIR} + ${cpbin} -pr ${SRCDIR}/usr/share/${APPNAME}/*.* ${APPDIR} + ${cpbin} -pr ${SRCDIR}/usr/share/doc/${APPNAME}/* ${DOCDIR} + # symlink, when alternatives is not being used + ${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager + +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} + + # 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." diff --git a/src/etc/default/logout-manager b/src/etc/default/logout-manager deleted file mode 100644 index 1f4ecf6..0000000 --- a/src/etc/default/logout-manager +++ /dev/null @@ -1,2 +0,0 @@ -LOGOUT_MANAGER_LIBPATH=/usr/share/logout-manager -LOGOUT_MANAGER_CONF=/etc/logout-manager.conf diff --git a/src/etc/sysconfig/logout-manager b/src/etc/sysconfig/logout-manager new file mode 100644 index 0000000..1f4ecf6 --- /dev/null +++ b/src/etc/sysconfig/logout-manager @@ -0,0 +1,2 @@ +LOGOUT_MANAGER_LIBPATH=/usr/share/logout-manager +LOGOUT_MANAGER_CONF=/etc/logout-manager.conf diff --git a/src/usr/share/applications/logout-manager.desktop b/src/usr/share/applications/logout-manager.desktop new file mode 100644 index 0000000..4522a66 --- /dev/null +++ b/src/usr/share/applications/logout-manager.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Categories=Settings;HardwareSettings; +Comment=Prompt for common actions including lock screen, logout, etc. +Exec=/usr/bin/logout-manager +GenericName=Logout menu +Icon=system-log-out +Keywords=shutdown;hibernate;lockscreen;logout;reboot; +Name=Logout... +StartupNotify=true +Terminal=false +Type=Application +Version=1.0 diff --git a/src/usr/share/doc/logout-manager/README.md b/src/usr/share/doc/logout-manager/README.md new file mode 100644 index 0000000..baa6aeb --- /dev/null +++ b/src/usr/share/doc/logout-manager/README.md @@ -0,0 +1,38 @@ +# README for logout-manager +## Introduction +Logout Manager is a python3 utility that provides a simple menu for logout-type actions. The supported actions are presented: + * Lock + * Logout + * Hibernate (if supported by hardware) + * Shutdown + * Reboot + +## 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. + +## 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). +Everything else is licensed under [CC-BY-SA 4.0](https://choosealicense.com/licenses/cc-by-sa-4.0/). + +## Description +This project is partially a programming playground for the [original author](https://bgstack15.wordpress.com) and partially a useful project for his migration to [Fluxbox](http://fluxbox.org/) on the desktop. + +## Upsides +* This project is the first to [demonstrate SVG images in tkinter in python3](https://bgstack15.wordpress.com/2019/07/13/display-svg-in-tkinter-python3/) that I could find on the Internet. +* I have learned how to work with ncurses, gtk, and tcl in python3. +* This will make Fluxbox systems easier to use for general users. + +## 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. + +## Improve +* add makefile + * add the standard 'list' option + * add a `list_dependencies` option or similar, which does the grep command + + grep -h -A5 -riIE dependencies * | awk 'tolower($0) ~ /devuan/ {$1="";$2="";print}' | sort | uniq | xargs + +* add libexec/ helper scripts for actually running commands +* add debian/ dir + * and dsc file -- cgit