diff --git a/common.py b/common.py index 18288dd..dcc8812 100755 --- a/common.py +++ b/common.py @@ -36,6 +36,8 @@ def __init__(self, icon=True, text=True): self.default_styles = self.get_style_context().list_classes() self.con = box('v') self.indicator = box('h', style='indicator') + self.indicator_styles = \ + self.indicator.get_style_context().list_classes() self.box = box('h', spacing=5) self.con.pack_start(self.box, 1, 1, 0) self.con.add(self.indicator) @@ -58,6 +60,12 @@ def reset_style(self): if style not in self.default_styles: self.get_style_context().remove_class(style) + indicator_styles = self.indicator.get_style_context().list_classes() + if self.indicator_styles != indicator_styles: + for style in indicator_styles: + if style not in self.indicator_styles: + self.indicator.get_style_context().remove_class(style) + def get_styles(self): """ Get styles """ return self.get_style_context().list_classes() diff --git a/module.py b/module.py index 8b40885..bd3214f 100755 --- a/module.py +++ b/module.py @@ -149,22 +149,19 @@ def get_output(): module.cache.widget = output['widget'] # Override class and set to gray if module is stale + module.reset_style() if 'interval' in module_config and 'timestamp' in output: if ( datetime.now() - datetime.fromtimestamp(output['timestamp']) ).seconds > module_config['interval'] * 2: c.add_style(module, 'gray') - else: - module.reset_style() # Set class if 'indicator' in config and config['indicator']: - module.indicator.reset_style() if 'class' in list(output): c.add_style(module.indicator, output['class']) else: - module.reset_style() if 'class' in list(output): c.add_style(module, output['class'])