Open teto opened 8 years ago
When executing commands as callbacks it could remember the PIDs and check / use an alternate formatter while any of these PIDs are active.
Here is one usecase with 2 callbacks: 1/ right click: run offlineimap to check if new mail => background task => Want "In progress" formatter 2/ left click: launch "mutt" or "thunderbird". I want the formatter to remain as is. If acting on PID, you have no way to distinguish between the 2 (i.e., changing formatter or not) ?
I see. We could add a helper function that does the formatter switch until a PID dies. That way a callback could be formulated like this:
@get_module
def callback(self):
pid = run_command()
self.busy_on_pid(pid)
This could be shipped as a function to use as callback, used like this then
status.register(...
on_leftclick=busy_execute("command")
)
(Better names are in order)
Hi, I am very happy with how https://github.com/enkore/i3pystatus/issues/311 works and I consider extending this to all modules, ie, display an "in progress" message upon background tasks:
In order for the module to know to display this "In progress" message whiule waiting for the job to finish, you need to give the module a hint. It could be via checking the callback against a specifc type ? on_leftclick=BackgroundCallback () or on_leftclick=["background_command", ]
What do you think ?