forked from external/yambar
particle/on-click: support next/previous buttons
This commit is contained in:
parent
8d5deda4e4
commit
6ed576c719
7 changed files with 22 additions and 0 deletions
|
@ -27,11 +27,13 @@
|
|||
* new module: disk-io.
|
||||
* alsa: `dB` tag ([#202][202])
|
||||
* mpd: `file` tag ([#219][219]).
|
||||
* on-click: support `next`/`previous` mouse buttons ([#228][228]).
|
||||
|
||||
[153]: https://codeberg.org/dnkl/yambar/issues/153
|
||||
[159]: https://codeberg.org/dnkl/yambar/issues/159
|
||||
[202]: https://codeberg.org/dnkl/yambar/issues/202
|
||||
[219]: https://codeberg.org/dnkl/yambar/pulls/219
|
||||
[228]: https://codeberg.org/dnkl/yambar/pulls/228
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -292,6 +292,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
|||
case BTN_LEFT: btn = MOUSE_BTN_LEFT; break;
|
||||
case BTN_MIDDLE: btn = MOUSE_BTN_MIDDLE; break;
|
||||
case BTN_RIGHT: btn = MOUSE_BTN_RIGHT; break;
|
||||
case BTN_SIDE: btn = MOUSE_BTN_PREVIOUS; break;
|
||||
case BTN_EXTRA: btn = MOUSE_BTN_NEXT; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -188,6 +188,8 @@ conf_verify_on_click(keychain_t *chain, const struct yml_node *node)
|
|||
{"right", false, &conf_verify_string},
|
||||
{"wheel-up", false, &conf_verify_string},
|
||||
{"wheel-down", false, &conf_verify_string},
|
||||
{"previous", false, &conf_verify_string},
|
||||
{"next", false, &conf_verify_string},
|
||||
{NULL, false, NULL},
|
||||
};
|
||||
|
||||
|
|
4
config.c
4
config.c
|
@ -236,6 +236,10 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
|
|||
on_click_templates[MOUSE_BTN_WHEEL_UP] = template;
|
||||
else if (strcmp(key, "wheel-down") == 0)
|
||||
on_click_templates[MOUSE_BTN_WHEEL_DOWN] = template;
|
||||
else if (strcmp(key, "previous") == 0)
|
||||
on_click_templates[MOUSE_BTN_PREVIOUS] = template;
|
||||
else if (strcmp(key, "next") == 0)
|
||||
on_click_templates[MOUSE_BTN_NEXT] = template;
|
||||
else
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,14 @@ following attributes are supported by all particles:
|
|||
: string
|
||||
: no
|
||||
: Command to execute every time a 'wheel-down' event is triggered.
|
||||
| on-click.previous
|
||||
: string
|
||||
: no
|
||||
: Command to execute when the particle is clicked with the 'previous' button.
|
||||
| on-click.next
|
||||
: string
|
||||
: no
|
||||
: Command to execute when the particle is clicked with the 'next' button.
|
||||
| deco
|
||||
: decoration
|
||||
: no
|
||||
|
|
|
@ -165,6 +165,8 @@ exposable_default_on_mouse(struct exposable *exposable, struct bar *bar,
|
|||
[MOUSE_BTN_COUNT] = "count",
|
||||
[MOUSE_BTN_WHEEL_UP] = "wheel-up",
|
||||
[MOUSE_BTN_WHEEL_DOWN] = "wheel-down",
|
||||
[MOUSE_BTN_PREVIOUS] = "previous",
|
||||
[MOUSE_BTN_NEXT] = "next",
|
||||
};
|
||||
LOG_DBG("on_mouse: exposable=%p, event=%s, btn=%s, x=%d, y=%d (on-click=%s)",
|
||||
exposable, event == ON_MOUSE_MOTION ? "motion" : "click",
|
||||
|
|
|
@ -20,6 +20,8 @@ enum mouse_button {
|
|||
MOUSE_BTN_RIGHT,
|
||||
MOUSE_BTN_WHEEL_UP,
|
||||
MOUSE_BTN_WHEEL_DOWN,
|
||||
MOUSE_BTN_PREVIOUS,
|
||||
MOUSE_BTN_NEXT,
|
||||
|
||||
MOUSE_BTN_COUNT,
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue