[modules/dunst] Fix toggling
At least Void Linux doesn't like kill -SIGUSR<N> Also, added some debugging to inspect state changes for modules/widgets. Also also, fix problem with min width, if no minwidth is set
This commit is contained in:
parent
da14ad3f36
commit
b66b13211e
3 changed files with 15 additions and 5 deletions
|
@ -18,8 +18,10 @@ class Config(util.store.Store):
|
|||
parser.add_argument('-t', '--theme', default='default', help=THEME_HELP)
|
||||
parser.add_argument('-i', '--iconset', default='auto',
|
||||
help='Specify the name of an iconset to use (overrides theme default)')
|
||||
parser.add_argument("-a", "--autohide", nargs="+", default=[],
|
||||
help="Specify a list of modules to hide when not in warning/error state")
|
||||
parser.add_argument('-a', '--autohide', nargs='+', default=[],
|
||||
help='Specify a list of modules to hide when not in warning/error state')
|
||||
parser.add_argument('--debug', action='store_true',
|
||||
help='Add debug fields to i3 output')
|
||||
self._args = parser.parse_args(args)
|
||||
|
||||
parameters = [ item for sub in self._args.parameters for item in sub ]
|
||||
|
@ -33,6 +35,9 @@ class Config(util.store.Store):
|
|||
def interval(self):
|
||||
return float(self.get('interval', 1))
|
||||
|
||||
def debug(self):
|
||||
return self._args.debug
|
||||
|
||||
def theme(self):
|
||||
return self._args.theme
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class i3(object):
|
|||
return '{}{}{}'.format(padding, full_text, padding)
|
||||
|
||||
def __decorate(self, module, widget, full_text):
|
||||
if full_text is None: return None
|
||||
return '{}{}{}'.format(
|
||||
self.__pad(module, widget, self._theme.prefix(widget)),
|
||||
full_text,
|
||||
|
@ -88,6 +89,10 @@ class i3(object):
|
|||
'background': self._theme.bg(widget),
|
||||
'min_width': self.__decorate(module, widget, widget.get('theme.minwidth')),
|
||||
})
|
||||
if (self._config.debug()):
|
||||
attr.update({
|
||||
'__state': ", ".join(module.state(widget))
|
||||
})
|
||||
return [attr]
|
||||
|
||||
def widgets(self, module):
|
||||
|
|
|
@ -13,7 +13,7 @@ class Module(core.module.Module):
|
|||
super().__init__(config, core.widget.Widget(''))
|
||||
self._paused = False
|
||||
# Make sure that dunst is currently not paused
|
||||
util.cli.execute('killall -SIGUSR2 dunst', ignore_errors=True)
|
||||
util.cli.execute('killall -s SIGUSR2 dunst', ignore_errors=True)
|
||||
core.input.register(self, button=core.input.LEFT_MOUSE,
|
||||
cmd=self.toggle_status
|
||||
)
|
||||
|
@ -23,9 +23,9 @@ class Module(core.module.Module):
|
|||
|
||||
try:
|
||||
if self._paused:
|
||||
util.cli.execute('killall -SIGUSR1 dunst')
|
||||
util.cli.execute('killall -s SIGUSR1 dunst')
|
||||
else:
|
||||
util.cli.execute('killall -SIGUSR2 dunst')
|
||||
util.cli.execute('killall -s SIGUSR2 dunst')
|
||||
except:
|
||||
self._paused = not self._paused # toggling failed
|
||||
|
||||
|
|
Loading…
Reference in a new issue