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

i3bar feature request: x/y co-ordinates relative to module output #2767

Closed
soumya92 opened this Issue May 10, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@soumya92

soumya92 commented May 10, 2017

Currently i3bar's click events provide x and y relative to the root window (https://i3wm.org/docs/i3bar-protocol.html#_click_events), which is useful if you need to open an absolutely-positioned menu/applet.

It would be useful to have x_frac, y_frac (for the lack of a better name) that are relative to the module's output, such that a click on the top-left is {"x_frac": 0, "y_frac": 0}, and a click on the bottom right of the output is {"x_frac": 1, "y_frac": 1}.

This would allow a new level of interactivity, e.g., a volume module setting the volume to (1 - y_frac) * 100, a media player seeking to x_frac * length, or a 5-day weather forecast opening directly to day int(x_frac * 5)

@i3bot i3bot added the enhancement label May 10, 2017

@Airblader Airblader added the 4.13 label May 12, 2017

@Airblader

This comment has been minimized.

Show comment
Hide comment
@Airblader

Airblader May 12, 2017

Member

The idea is OK to me, but I would prefer if we instead exposed pixel values relative to the block (relative_x, relative_y) and width and height of the block (width, height).

Member

Airblader commented May 12, 2017

The idea is OK to me, but I would prefer if we instead exposed pixel values relative to the block (relative_x, relative_y) and width and height of the block (width, height).

@Airblader Airblader added the accepted label May 12, 2017

@soumya92

This comment has been minimized.

Show comment
Hide comment
@soumya92

soumya92 May 12, 2017

That was my initial thought too, but I assumed that adding two keys would be preferable to adding four. I'm all in favour of providing more information in the click event 😃

soumya92 commented May 12, 2017

That was my initial thought too, but I assumed that adding two keys would be preferable to adding four. I'm all in favour of providing more information in the click event 😃

@soumya92 soumya92 changed the title from i3bar feature request: fractional x/y co-ordinates relative to module output to i3bar feature request: x/y co-ordinates relative to module output May 13, 2017

@PMunch

This comment has been minimized.

Show comment
Hide comment
@PMunch

PMunch Aug 16, 2017

Maybe even better would be the x, y of the current implementation, the x, y of the block (in reference to root), and the width and height. That way you can easily calculate relative_x (block_x-click_x) and relative_y, fractions, and you could even start applications that are aligned with the block. So if I clicked eg. a date/time block I could create a calendar window aligned with the block. To keep it aligned however the user would obviously need to set a monospace font lest the bar would change below the window.

PMunch commented Aug 16, 2017

Maybe even better would be the x, y of the current implementation, the x, y of the block (in reference to root), and the width and height. That way you can easily calculate relative_x (block_x-click_x) and relative_y, fractions, and you could even start applications that are aligned with the block. So if I clicked eg. a date/time block I could create a calendar window aligned with the block. To keep it aligned however the user would obviously need to set a monospace font lest the bar would change below the window.

@Airblader Airblader closed this in 161db6f Dec 20, 2017

burik666 added a commit to burik666/yagostatus that referenced this issue Feb 14, 2018

soumya92 added a commit to soumya92/barista that referenced this issue Apr 15, 2018

Update events to include relative_x/y and width/height.
This was recently added to i3: i3/i3#2767. Also renames X,Y to be relative to the segment, so that X,Y,Width,Height make sense, and provides the previous X,Y as ScreenX,ScreenY to make it more obvious that they are relative to the root window.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment