mako
mako copied to clipboard
Get current configuration via IPC
Not sure this is a good idea, but posting it as a separate issue:
Getting the status would also be very useful to create a statusbar block representing whether notifications are invisible or not. And probably useful for other config options too.
Originally posted by @RX14 in https://github.com/emersion/mako/issues/157#issuecomment-497885595
I can't help but feel that actually parsing the config to figure out what happens to any given notification would be a massive pain.
Perhaps instead we could provide an endpoint like makoctl test
which takes some notification fields like app-name
, etc and returns a json representation of the computed style for that fake notification? Then the calling script wouldn't have to do logic to figure out how the criteria stack.
This seems a little too complicated to me. I'd say for this use-case we should leave it to the script changing the notification option. Something like this would do:
makoctl set invisible $value
echo $value >$XDG_RUNTIME_DIR/mako-invisible
And then read this file from the statusbar.
This only has to apply to global configuration options, or even just to invisible
. Which I would think would be fairly simple to implement.
Just wanted to say that I could really use this feature for my waybar setup. Thank you for creating and maintaining mako! It's just what I needed.
Can you explain why you need this for your waybar setup?
Now that we have modes, maybe adding a way to query the current mode would be useful. Might want to be careful about the possible future extension of allowing multiple modes to be active at the same time.
maybe adding a way to query the current mode would be useful
Yup, that's it. I want to make a custom waybar module[1] that toggles the mako do-not-disturb mode, but to do that I need the current mode.
[1] https://github.com/Alexays/Waybar/wiki/Module:-Custom
maybe adding a way to query the current mode would be useful
Yup, that's it. I want to make a custom waybar module[1] that toggles the mako do-not-disturb mode, but to do that I need the current mode.
[1] https://github.com/Alexays/Waybar/wiki/Module:-Custom
+1 for a way to query the current mode. I just set up a DND toggle for Waybar, but it sets the mode to default
every time waybar starts up, which is a workaround way of knowing makos current state. Script is below if helpful @ian-s-mcb
#!/usr/bin/env python3
import signal
import time
import subprocess
subprocess.run(["makoctl", "set-mode", "default"])
status = "on"
def toggle(signum, stack):
global status
if status == "on":
subprocess.run(["makoctl", "set-mode", "dnd"])
subprocess.run(["echo", "{\"text\":\"Off\",\"class\":\"off\",\"percentage\":0}"])
status = "off"
else:
subprocess.run(["makoctl", "set-mode", "default"])
subprocess.run(["echo", "{\"text\":\"On\",\"class\":\"on\",\"percentage\":100}"])
status = "on"
signal.signal(signal.SIGUSR1, toggle)
while True:
if status == "on":
subprocess.run(["echo", "{\"text\":\"On\",\"class\":\"on\",\"percentage\":100}"])
else:
subprocess.run(["echo", "{\"text\":\"Off\",\"class\":\"off\",\"percentage\":0}"])
time.sleep(5)
Thanks for the script, @stvsu. I prefer to wait for an integrated solution.
Let's track the issue about querying the current mode in https://github.com/emersion/mako/issues/367, and keep this issue for querying the current config file options (still not sure the latter is a good idea).