i3blocks icon indicating copy to clipboard operation
i3blocks copied to clipboard

Can a script behind a block retrieve the dimensions of a blocklet?

Open ghistes opened this issue 4 years ago • 1 comments

Hi,

I would like to take advantage of the mouse-clicks that are available now and would like to make a clickable block that behaves differently if clicked on the right side, the middle or the left side.

When reading the mouse-event you can get both the absolute coordinates as well as the relative coordinates of the click but in order to determine which part of a block has been clicked I would also need the dimensions of the block.

Is there any way to get these?

Many thanks!

ghistes avatar Dec 11 '20 22:12 ghistes

According to i3blocks#click and i3bar-protocol you can get all the needed values. On the bottom of the i3wm site you can see some variables that i3blocks passes as environment variables for scripts. For example echo w=$width x=$relative_x.

zsugabubus avatar Dec 11 '20 23:12 zsugabubus