cmd_bindswitch: add option to execute on reload

This adds a --reload flag to cmd_bindswitch that allows for the binding
to be executed on reload. One possible use case for this is to  allow
users to disable outputs when the lid closes and enable them when the
lid opens without having to open and re-close the lid after a reload.
This commit is contained in:
Brian Ashworth 2019-07-09 02:57:59 -04:00 committed by Simon Ser
parent 538b36c0e2
commit 152e30c374
6 changed files with 63 additions and 26 deletions

View file

@ -378,7 +378,7 @@ runtime.
*bindcode* [--whole-window] [--border] [--exclude-titlebar] [--release] [--locked] [--input-device=<device>] [--no-warn] <code> <command>
is also available for binding with key/button codes instead of key/button names.
*bindswitch* [--locked] [--no-warn] <switch>:<state> <command>
*bindswitch* [--locked] [--no-warn] [--reload] <switch>:<state> <command>
Binds <switch> to execute the sway command _command_ on state changes.
Supported switches are _lid_ (laptop lid) and _tablet_ (tablet mode)
switches. Valid values for _state_ are _on_, _off_ and _toggle_. These
@ -391,6 +391,11 @@ runtime.
and without _--locked_, the one with will be preferred when locked and the
one without will be preferred when unlocked.
If the _--reload_ flag is given, the binding will also be executed when
the config is reloaded. _toggle_ bindings will not be executed on reload.
The _--locked_ flag will operate as normal so if the config is reloaded
while locked and _--locked_ is not given, the binding will not be executed.
By default, if you overwrite a binding, swaynag will give you a warning. To
silence this, use the _--no-warn_ flag.