aboutsummaryrefslogtreecommitdiff
path: root/logout-manager-gtk.py
diff options
context:
space:
mode:
Diffstat (limited to 'logout-manager-gtk.py')
-rwxr-xr-xlogout-manager-gtk.py23
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
bgstack15