aboutsummaryrefslogtreecommitdiff
path: root/lmlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'lmlib.py')
-rw-r--r--lmlib.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/lmlib.py b/lmlib.py
index a5206e5..67b207f 100644
--- a/lmlib.py
+++ b/lmlib.py
@@ -9,12 +9,14 @@
# Usage:
# In a logout-manager-gtk.py program
# Reference:
+# platform info https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python/10091465#10091465
# Improve:
+# detect if el7, use icon_category = "apps". This should be an internal variable (not listed in .conf)
# Documentation:
-import configparser
+import configparser, platform
-logout_manager_version="2019-06-12b"
+logout_manager_version="2019-06-14a"
class Actions:
@@ -63,6 +65,7 @@ class Config:
self.shutdown_fallback_icon = "system-shutdown"
self.icon_size = 24
self.icon_theme = "default"
+ self.icon_category = "actions"
self.can_hibernate = False
self.application_icon=("system-log-out")
@@ -102,6 +105,9 @@ class Config:
def set_icon_theme(self,icon_theme):
self.icon_theme = icon_theme
+ def set_icon_category(self,icon_category):
+ self.icon_category = icon_category
+
def set_can_hibernate(self,can_hibernate):
print("Setting can_hibernate:",can_hibernate)
self.can_hibernate = bool(can_hibernate)
@@ -157,6 +163,9 @@ class Config:
def get_icon_theme(self):
return self.icon_theme
+ def get_icon_category(self):
+ return self.icon_category
+
def get_can_hibernate(self):
return self.can_hibernate
@@ -212,6 +221,15 @@ def Initialize_config():
pass
config.set_can_hibernate(can_hibernate)
+ # set icon category
+ # written primarily for el7 which uses "app" for the system-reboot icons, etc.
+ a = platform.dist()
+ try:
+ if a[0] == "redhat" and int(a[1].split(".")[0]) <= 7:
+ config.set_icon_category("apps")
+ except:
+ pass
+
# DEBUG, raw from conf file and system status
print("Raw values:")
for item in config_in.sections():
@@ -234,6 +252,7 @@ def Initialize_config():
print(config.get_shutdown_icon())
print(config.get_icon_size())
print(config.get_icon_theme())
+ print(config.get_icon_category())
print("Can hibernate:",config.get_can_hibernate())
return config
bgstack15