Read 'bindsym' rather than the old 'wheel_up_cmd' and 'wheel_down_cmd' directives in i3bar and call the command if specified.

The old directives are still read for transitional support which can be removed in a future version.
This commit is contained in:
Ingo Bürk
2015-06-13 14:58:41 +02:00
parent 2b6f76852c
commit 715fbf2d80
3 changed files with 62 additions and 22 deletions

View File

@ -468,20 +468,23 @@ void handle_button(xcb_button_press_event_t *event) {
return;
}
/* If a custom command was specified for this mouse button, it overrides
* the default behavior. */
mouse_command_t *command;
TAILQ_FOREACH(command, &(config.mouse_commands), commands) {
if (command->button != event->detail)
continue;
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, command->command);
return;
}
switch (event->detail) {
case 4:
/* Mouse wheel up. We select the previous ws, if any.
* If there is no more workspace, dont even send the workspace
* command, otherwise (with workspace auto_back_and_forth) wed end
* up on the wrong workspace. */
/* If `wheel_up_cmd [COMMAND]` was specified, it should override
* the default behavior */
if (config.wheel_up_cmd) {
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, config.wheel_up_cmd);
return;
}
if (cur_ws == TAILQ_FIRST(walk->workspaces))
return;
@ -492,14 +495,6 @@ void handle_button(xcb_button_press_event_t *event) {
* If there is no more workspace, dont even send the workspace
* command, otherwise (with workspace auto_back_and_forth) wed end
* up on the wrong workspace. */
/* if `wheel_down_cmd [COMMAND]` was specified, it should override
* the default behavior */
if (config.wheel_down_cmd) {
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, config.wheel_down_cmd);
return;
}
if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head))
return;