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:
committed by
Michael Stapelberg
parent
0514be8d4b
commit
8e23dc881b
@ -112,6 +112,20 @@ static int config_string_cb(void *params_, const unsigned char *val, size_t _len
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(cur_key, "wheel_up_cmd")) {
|
||||
DLOG("wheel_up_cmd = %.*s\n", len, val);
|
||||
FREE(config.wheel_up_cmd);
|
||||
sasprintf(&config.wheel_up_cmd, "%.*s", len, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(cur_key, "wheel_down_cmd")) {
|
||||
DLOG("wheel_down_cmd = %.*s\n", len, val);
|
||||
FREE(config.wheel_down_cmd);
|
||||
sasprintf(&config.wheel_down_cmd, "%.*s", len, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(cur_key, "position")) {
|
||||
DLOG("position = %.*s\n", len, val);
|
||||
config.position = (len == 3 && !strncmp((const char *)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
|
||||
|
Reference in New Issue
Block a user