Examples ====== Sxmo ---- Sxmo use Bonsai to emulate its hardward key bindings. Pressing the hardware buttons multiple time in a row would trigger different actions. Also, holding a button would cause the same action than pressing 3 time in a row. Sxmo binds the pressed and release events from the hardware button to Bonsai events using the client: .. code-block:: bindsym --locked --no-repeat XF86PowerOff exec bonsaictl -e power_pressed bindsym --locked --release XF86PowerOff exec bonsaictl -e power_released bindsym --locked --no-repeat XF86AudioRaiseVolume exec bonsaictl -e volup_pressed bindsym --locked --release XF86AudioRaiseVolume exec bonsaictl -e volup_released bindsym --locked --no-repeat XF86AudioLowerVolume exec bonsaictl -e voldown_pressed bindsym --locked --release XF86AudioLowerVolume exec bonsaictl -e voldown_released The expected outcomes are represented with the following graph. The same sub-tree is used for the power, volume up, and volume down buttons. Events that does not match any available transition to the current state are just swallowed: .. image:: sxmo.svg .. code-block:: json [ { "type": "event", "event_name": "power_pressed", "transitions": [ { "type": "delay", "delay_duration": 400000000, "transitions": [ { "type": "exec", "command": [ "setsid", "-f", "sxmo_hook_inputhandler.sh", "powerbutton_three" ] } ] }, { "type": "event", "event_name": "power_released", "transitions": [ { "type": "delay", "delay_duration": 400000000, "transitions": [ { "type": "exec", "command": [ "setsid", "-f", "sxmo_hook_inputhandler.sh", "powerbutton_one" ] } ] }, { "type": "event", "event_name": "power_released", "transitions": [ { "type": "delay", "delay_duration": 400000000, "transitions": [ { "type": "exec", "command": [ "setsid", "-f", "sxmo_hook_inputhandler.sh", "powerbutton_two" ] } ] }, { "type": "event", "event_name": "power_released", "transitions": [ { "type": "exec", "command": [ "setsid", "-f", "sxmo_hook_inputhandler.sh", "powerbutton_three" ] } ] } ] } ] } ] }, ... ]