diff options
Diffstat (limited to 'lmlib.py')
-rw-r--r-- | lmlib.py | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -13,9 +13,9 @@ # Improve: # Documentation: -import configparser, platform +import configparser, platform, os -logout_manager_version="2019-06-14b" +logout_manager_version="2019-06-17a" class Actions: @@ -64,6 +64,7 @@ class Config: self.shutdown_fallback_icon = "system-shutdown" self.icon_size = 24 self.icon_theme = "default" + self.gtk3_default_icon_theme = "hicolor" self.icon_category = "actions" self.can_hibernate = False self.application_icon=("system-log-out") @@ -104,6 +105,9 @@ class Config: def set_icon_theme(self,icon_theme): self.icon_theme = icon_theme + def set_gtk3_default_icon_theme(self,icon_theme): + self.gtk3_default_icon_theme= icon_theme + def set_icon_category(self,icon_category): self.icon_category = icon_category @@ -162,12 +166,32 @@ class Config: def get_icon_theme(self): return self.icon_theme + def get_gtk3_default_icon_theme(self): + return self.gtk3_default_icon_theme + def get_icon_category(self): return self.icon_category def get_can_hibernate(self): return self.can_hibernate +def get_gtk3_default_icon_theme(): + # abstracted so it does not clutter get_scaled_icon + name = "hicolor" + gtk3_config_path = os.path.join(os.path.expanduser("~"),".config","gtk-3.0","settings.ini") + gtk3_config = configparser.ConfigParser() + gtk3_config.read(gtk3_config_path) + try: + if 'Settings' in gtk3_config: + name = gtk3_config['Settings']['gtk-icon-theme-name'] + elif 'settings' in gtk3_config: + name = gtk3_config['settings']['gtk-icon-theme-name'] + except: + # supposed failsafe: keep name = hicolor + pass + print("Found gtk3 default theme:",name) + return name + def Initialize_config(): # Read config config_in = configparser.ConfigParser() @@ -220,6 +244,11 @@ def Initialize_config(): pass config.set_can_hibernate(can_hibernate) + # read gtk3_default_icon_theme + config.set_gtk3_default_icon_theme(get_gtk3_default_icon_theme()) + if config.get_icon_theme() == "default": + config.set_icon_theme(config.get_gtk3_default_icon_theme()) + # set icon category # written primarily for el7 which uses "app" for the system-reboot icons, etc. a = platform.dist() |