Context sensitive shortcuts
Hello,
is it possible to have context sensitive shortcuts. E. g. a shortcut should only be possible to trigger if application A is (not) running.
Best Regards
Hello,
is it possible to have context sensitive shortcuts. E. g. a shortcut should only be possible to trigger if application A is (not) running.
Best Regards
As @i3convert pointed out, this isn't possible directly. However, starting with 4.11 the focus
command returns success depending on whether a window was focused. This allows something like this:
[ "$(i3-msg '[class=\"firefox\"] focus')" = "[{\"success\":true\}]" ] || i3-msg exec firefox`
Also see https://github.com/i3/i3/issues/1809
I don't think i3 directly provides this functionality. However, you can write a script that checks whether a given application is running (maybe checking the output of ps -A
will be good enough in your case? read the man page for ps to fine-tune it), and triggers a given action only if it is (not) running. Then you bind the script to the shortcut you had in mind.
Asked: 2015-10-07 23:28:13 +0000
Seen: 30 times
Last updated: Oct 08