i3bar: implement custom mouse wheel commands

Users can specify a command to run when a button was pressed on i3bar to
override the default behavior. Currently only the mouse wheel buttons
are supported. This is useful for disabling the scroll wheel action or
running scripts that implement custom behavior for these buttons.

Example:

bar {
    wheel_up_cmd nop
    wheel_down_cmd exec ~/.i3/scripts/custom_wheel_down
}

fixes #1104
This commit is contained in:
Tony Crisci
2014-07-04 05:53:22 -04:00
committed by Michael Stapelberg
parent 0514be8d4b
commit 8e23dc881b
10 changed files with 94 additions and 1 deletions

View File

@ -261,6 +261,14 @@ struct Barconfig {
M_MOD5 = 7
} modifier;
/** Command that should be run when mouse wheel up button is pressed over
* i3bar to override the default behavior. */
char *wheel_up_cmd;
/** Command that should be run when mouse wheel down button is pressed over
* i3bar to override the default behavior. */
char *wheel_down_cmd;
/** Bar position (bottom by default). */
enum { P_BOTTOM = 0,
P_TOP = 1 } position;