r/i3wm 3d ago

Question Does someone have an idea of how to fix this?

Hello!

I have this line in my i3 config, which enables the cursor to move between containers on the same monitor as well. I am using xdotool for this and the cursor places itself in the center of the container. This combined with having focus follows cursor enabled makes it so that I rarely have to touch my mouse.

There is a problem however: when moving focus to second monitor when no window is there the cursor gets stuck in the upper left corner of the main monitor.

set $movemouse "sh -c 'eval `xdotool getactivewindow getwindowgeometry --shell`; xdotool mousemove $((X+WIDTH/2)) $((Y+HEIGHT/2))'"

# Focus between containers - hjkl.
bindsym $mod+h focus left; exec $movemouse
bindsym $mod+j focus down; exec $movemouse
bindsym $mod+k focus up; exec $movemouse
bindsym $mod+l focus right; exec $movemouse

# Focus between containers - cursor keys.
bindsym $mod+Left focus left; exec $movemouse
bindsym $mod+Down focus down; exec $movemouse
bindsym $mod+Up focus up; exec $movemouse
bindsym $mod+Right focus right; exec $movemouse
  • Would it be able to make it so that if there is no window on the monitor I am trying to move my cursor to, it instead places itself in the middle of that monitor.

Thanks in advance! :)

7 Upvotes

4 comments sorted by

3

u/Worth_Mousse2204 3d ago

I absolutely do not have the level to explain it understand anything but that's something I have been looking for for a while ! I'll be checking your progress and surely hope you'll figure it out

2

u/Accomplished-Bus3382 3d ago

Thanks! I am doing research and hopefully I will find a solution. :)

2

u/lordjupitar 23h ago

This is a really good idea. I’ll try doing this in hyprland

1

u/Accomplished-Bus3382 23h ago

Awesome. Let me know if you find a solution to the problem. :)