You are not logged in.
I switched from subtle to i3.
I'm missing the feature that the mouse is always in the focused window.
And when I switch the workspace or window, the mouse jumps in the middle of the window
Is this behaviour possible in i3?
Offline
The userguide does not mention this, so I assume there is no simple way (i.e. config option). The following snippet (a two-line "mouse follows focus daemon"
) uses xdotool to always move the mouse when a window is focused:
MOVEMOUSE='eval `xdotool getactivewindow getwindowgeometry --shell`; xdotool mousemove $((X+WIDTH/2)) $((Y+HEIGHT/2))'
xdotool search . behave %@ focus exec sh -c "$MOVEMOUSE"However, it is rather useless as it does this also when focus is moved due to moving the mouse (if you have focus follows mouse on, like I do
). Therefore, currently probably the best option is to have this hard-coded in the config, as in
set $movemouse "sh -c 'eval `xdotool getactivewindow getwindowgeometry --shell`; xdotool mousemove $((X+WIDTH/2)) $((Y+HEIGHT/2))'"
bindsym $m+h focus left; exec $movemouse
bindsym $m+j focus down; exec $movemouse
bindsym $m+k focus up; exec $movemouse
bindsym $m+l focus right; exec $movemouseinstead of just focus left/right/down/up.
Hope this helps!
Offline
Just a side note: I have tried to fix the "mouse follows focus daemon" to work properly, and this is the result:
movemouse() {
#echo "called"
eval `xdotool getmouselocation --shell`; UNDERMOUSE=$WINDOW
eval `xdotool getactivewindow getwindowgeometry --shell`
FOCUSED=$WINDOW
if [[ $FOCUSED != $UNDERMOUSE ]]; then
xdotool mousemove $((X+WIDTH/2)) $((Y+HEIGHT/2))
fi
}
export -f movemouse
xdotool search . behave %@ focus exec sh -c movemouse # do this whenever focus changesThis works, but it is rather slow and I don't like it - every focus change results in like 10 calls to the function. I assume it is because of the fact that when the mouse moves, focus is re-evaluated, which causes the script to be called again etc. This might be fixable, but seeing this I really think hard-coding into the config to move the mouse with focus changing commands is better.
Offline