Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add click coordinates to script #3573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rossmeier
Copy link

The idea is to allow the current relative mouse position {x} and {y} within the widget in percent to be used as an argument to custom scripts

This is a change that I have been using for a while now and that I find really convenient for operating in tablet mode. This way, a script (like [1]) can be used to execute different actions depending on where exactly the mouse (or stylus in the tablet case) clicks. The script can divide the widget surface into a grid of subsurfaces, depending on the reasonable use-case (eg -/+ for brightness, -/mute/+ for volume).

The coordinates are converted to relative percentages within the widget as integers to ease processing by simple scripts that are not capable of complicated math operations. This should still give enough accuracy to accomplish any reasonable subdivision.

One alternative that has been considered considered, to implement the whole grid logic within waybar and allow it to be configured from the config file, as well as different actions for different parts of the grid. This does seem like major feature creep however, compared to the simple implementation that I chose.

If you would be interested in upstreaming this feature, I can add it to the documentation before merging!

[1]

#!/usr/bin/env bash
if [ $1 -gt 50 ]; then
	brightnessctl set 5%+
else
	brightnessctl set 5%-
fi

Allow the current relative mouse position {x} and {y} relative to the
widget in percent to be used as an argument to custom scripts
@Alexays Alexays force-pushed the master branch 2 times, most recently from d623a89 to a4d31ab Compare September 13, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant