Exec unfocuses current window [closed]

asked 2015-02-24 10:04:36 +0000

setzer22 gravatar image

I've set up a basic "vim" mode that allows me to use hjkl as arrow keys in any application (by using xdotool). This is my config so far:

mode "vim" {
    bindsym h exec --no-startup-id xdotool key --window $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') Left
    bindsym j exec --no-startup-id xdotool key --window $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') Down 
    bindsym k exec --no-startup-id xdotool key --window $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') Up 
    bindsym l exec --no-startup-id xdotool key --window $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') Right

    #back to normal: Enter or Escape or q or ^[
    bindsym Return mode "default"
    bindsym q mode "default"
    bindsym Escape mode "default"
    bindcode Control+34 mode "default"
    bindsym $mod+Shift+v mode "default"
}
bindsym $mod+Shift+v mode "vim"

Unfortunately, it seems that when using exec, i3 unfocuses (not quite, the window bar is still highlighted for example. But surely the window doesn't catch the key events) the current window for a moment, that's why I have to get the window ID, otherwise it's not seeing the command. I should say this works, but many windows like my terminal do some animation on this kind of "loose focus" and it gets weird looking at.

Is there a way I can tell i3 to keep the window focused and execute the command in the background?

edit retag flag offensive reopen merge delete

Closed for the following reason not a real question by Adaephon
close date 2015-02-25 10:46:09.545389

Comments

This has to do with the key bindings and is not specific to the `exec` command. In order to grab the binding *i3* takes the input focus. **If** that can be changed, it needs to be done in *i3's* code. [You may want to open a bug report / feature request for that](https://github.com/i3/i3/issues).

Adaephon gravatar imageAdaephon ( 2015-02-25 09:35:57 +0000 )edit

Thanks! I opened an issue just as you suggested. I think that's a feature worth having, as I also had encountered it in many of my hotkeys, like volume Up/Down, which is a lot less hacker-ish than that "vim-like" mode and also causes the unfocus animations to happen.

setzer22 gravatar imagesetzer22 ( 2015-02-25 22:09:20 +0000 )edit

It is [issue #1490 on i3's issue tracker on github](https://github.com/i3/i3/issues/1490).

Adaephon gravatar imageAdaephon ( 2015-03-04 11:16:21 +0000 )edit