forked from external/yambar
config: add bar.trackpad-sensitivity
This is an integer that specifies the amount of scrolling that needs to be accumulated before a wheel-up/down event is emitted. A higher value means you need to drag your fingers a longer distance before the event is emitted. The default is 30.
This commit is contained in:
parent
4ce3fe2285
commit
0aef2f85ee
7 changed files with 20 additions and 1 deletions
|
@ -408,6 +408,7 @@ bar_new(const struct bar_config *config)
|
|||
priv->right_spacing = config->right_spacing;
|
||||
priv->left_margin = config->left_margin;
|
||||
priv->right_margin = config->right_margin;
|
||||
priv->trackpad_sensitivity = config->trackpad_sensitivity;
|
||||
priv->border.width = config->border.width;
|
||||
priv->border.color = config->border.color;
|
||||
priv->border.left_margin = config->border.left_margin;
|
||||
|
|
|
@ -25,6 +25,7 @@ struct bar_config {
|
|||
int height;
|
||||
int left_spacing, right_spacing;
|
||||
int left_margin, right_margin;
|
||||
int trackpad_sensitivity;
|
||||
|
||||
pixman_color_t background;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ struct private {
|
|||
int height;
|
||||
int left_spacing, right_spacing;
|
||||
int left_margin, right_margin;
|
||||
int trackpad_sensitivity;
|
||||
|
||||
pixman_color_t background;
|
||||
|
||||
|
|
|
@ -307,6 +307,8 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
|||
|
||||
struct seat *seat = data;
|
||||
struct wayland_backend *backend = seat->backend;
|
||||
struct private *bar = backend->bar->private;
|
||||
|
||||
backend->active_seat = seat;
|
||||
|
||||
if (backend->have_discrete)
|
||||
|
@ -325,7 +327,7 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
|||
? MOUSE_BTN_WHEEL_DOWN
|
||||
: MOUSE_BTN_WHEEL_UP;
|
||||
|
||||
const double step = 20.;
|
||||
const double step = bar->trackpad_sensitivity;
|
||||
const double adjust = backend->aggregated_scroll > 0 ? -step : step;
|
||||
|
||||
while (fabs(backend->aggregated_scroll) >= step) {
|
||||
|
|
|
@ -423,6 +423,8 @@ conf_verify_bar(const struct yml_node *bar)
|
|||
{"center", false, &verify_module_list},
|
||||
{"right", false, &verify_module_list},
|
||||
|
||||
{"trackpad-sensitivity", false, &conf_verify_int},
|
||||
|
||||
{NULL, false, NULL},
|
||||
};
|
||||
|
||||
|
|
6
config.c
6
config.c
|
@ -252,6 +252,12 @@ conf_to_bar(const struct yml_node *bar, enum bar_backend backend)
|
|||
if (right_margin != NULL)
|
||||
conf.right_margin = yml_value_as_int(right_margin);
|
||||
|
||||
const struct yml_node *trackpad_sensitivity =
|
||||
yml_get_value(bar, "trackpad-sensitivity");
|
||||
conf.trackpad_sensitivity = trackpad_sensitivity != NULL
|
||||
? yml_value_as_int(trackpad_sensitivity)
|
||||
: 30;
|
||||
|
||||
const struct yml_node *border = yml_get_value(bar, "border");
|
||||
if (border != NULL) {
|
||||
const struct yml_node *width = yml_get_value(border, "width");
|
||||
|
|
|
@ -109,6 +109,12 @@ types that are frequently used:
|
|||
: color
|
||||
: no
|
||||
: Default foreground (text) color to use
|
||||
| trackpad-sensitivity
|
||||
: int
|
||||
: no
|
||||
: How easy it is to trigger wheel-up and wheel-down on-click
|
||||
handlers. Higher values means you need to drag your finger a longer
|
||||
distance. The default is 30.
|
||||
| left
|
||||
: list
|
||||
: no
|
||||
|
|
Loading…
Add table
Reference in a new issue