4

I'm using i3 as my WM with a Dual-Head setup. I have already mapped some keys to switch between workspaces on one of the monitors (Mod+Keypad 1..8) and I would like to use the same keybindings on both monitors (each one has 8 workspaces).

Considering i3 cannot bind keys twice, I would instead use a script that detects the monitor, and sends the correct message through i3-msg. However, I need to know which monitor is focused to do this.

So, is there a way to get the name of the focused monitor in this scenario?

1 Answer 1

2

You could use xdotool to get current cursor location:

$ xdotool getmouselocation --shell
X=463
Y=227
SCREEN=0
WINDOW=29360134

In ideal case your monitors will have different screen numbers but if they all are listed under SCREEN=0 you still could use X location to detect current monitor (e.g from 0 to 1919 will be first screen and from 1920 - second screen).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .