From 02bbefda20b9a4f86e740d33bbaa21c661bb2fac Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Tue, 15 Jan 2019 21:25:28 -0500 Subject: bar_cmd_tray_bind: Use mouse button helpers This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like with sway bindings, the two commands are encapsulated in a single file to maximize shared code. This also modifies tray bindings to work off of events codes rather than x11 buttons, which allows for any mouse buttons to be used. For `get_bar_config`, `event_code` has been added to the `tray_bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`. --- sway/sway-bar.5.scd | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sway/sway-bar.5.scd') diff --git a/sway/sway-bar.5.scd b/sway/sway-bar.5.scd index 3f6b4298..9a6397e3 100644 --- a/sway/sway-bar.5.scd +++ b/sway/sway-bar.5.scd @@ -115,13 +115,19 @@ Sway allows configuring swaybar in the sway configuration file. Swaybar provides a system tray where third-party applications may place icons. The following commands configure the tray. -The _button_ argument in all cases is a platform-specific button code. On Linux -you can find a list of these at linux/input-event-codes.h. - -*tray\_bindsym* button ContextMenu|Activate|SecondaryActivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop - Binds mouse button _n_ (1 to 9) to the specified action. Use the command - _nop_ to disable the default action (Activate for button 1, ContextMenu for - button 2 and SecondaryActivate for button 3). +*tray\_bindcode* +ContextMenu|Activate|SecondaryActivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop + Executes the action when the mouse button has been pressed. The buttons can + be given as an event code, which can be obtained from `libinput debug-events`. + To disable the default behavior for a button, use the command _nop_. + +*tray\_bindsym* button[1-9]| +ContextMenu|Activate|SecondaryActivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop + Executes the action when the mouse button has been pressed. The buttons can + be given as a x11 button number or an event name, which can be obtained + from `libinput debug-events`. Use the command _nop_ to disable the default + action (Activate for button1, ContextMenu for button2 and SecondaryActivate + for button3). *tray\_padding* [px] Sets the pixel padding of the system tray. This padding will surround the -- cgit v1.2.3-70-g09d2