diff options
author | B Stack <bgstack15@gmail.com> | 2020-03-10 16:52:22 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-03-10 16:52:22 -0400 |
commit | 86d9bf400c78ad535adaf0da82a31a149d8795f7 (patch) | |
tree | 8c7352ad8b863b25b921fb72ff63cf6d6ab614be /logout-manager-gtk.py | |
parent | add zeroindex bool (diff) | |
download | logout-manager-86d9bf400c78ad535adaf0da82a31a149d8795f7.tar.gz logout-manager-86d9bf400c78ad535adaf0da82a31a149d8795f7.tar.bz2 logout-manager-86d9bf400c78ad535adaf0da82a31a149d8795f7.zip |
use /etc/default/logout-manager and conf files
Diffstat (limited to 'logout-manager-gtk.py')
-rwxr-xr-x | logout-manager-gtk.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/logout-manager-gtk.py b/logout-manager-gtk.py index c6f7a6b..553fc41 100755 --- a/logout-manager-gtk.py +++ b/logout-manager-gtk.py @@ -24,15 +24,31 @@ # only show debug info when DEBUG=1 or similar. # support global conf file, and user conf file # far future: provide graphical way to change commands run +# Dependencies: +# Devuan: python3-dotenv # Documentation: -import gi, sys +import gi, os, platform, sys gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository.GdkPixbuf import Pixbuf from pathlib import Path -sys.path.append("/home/bgirton/dev/logout-manager") +from dotenv import load_dotenv + +# all this to load the libpath +try: + defaultdir="/etc/sysconfig" + thisplatform = platform.platform().lower() + if 'debian' in thisplatform or 'devuan' in thisplatform: + defaultdir="/etc/default" + # load_dotenv keeps existing environment variables as higher precedent + load_dotenv(os.path.join(defaultdir,"logout-manager")) +except: + pass +if 'LOGOUT_MANAGER_LIBPATH' in os.environ: + for i in os.environ['LOGOUT_MANAGER_LIBPATH'].split(":"): + sys.path.append(i) import lmlib # graphical classes and functions @@ -225,7 +241,8 @@ class MainWindow(Gtk.Window): print("Cancel any logout action.") Gtk.main_quit() -config = lmlib.Initialize_config() +# load configs +config = lmlib.Initialize_config(os.environ['LOGOUT_MANAGER_CONF']) actions = lmlib.Actions # MAIN LOOP |