diff options
Diffstat (limited to 'src/usr/bin/logout-manager-trayicon')
-rwxr-xr-x | src/usr/bin/logout-manager-trayicon | 17 |
1 files changed, 12 insertions, 5 deletions
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(): |