Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch binding mode automatically upon changing focus #3733

Closed
xdavidliu opened this issue Jul 11, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@xdavidliu
Copy link

commented Jul 11, 2019

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

There is no obvious way to have different windows automatically use different keybindings when focused on them. For example, the closest thing would be something like for_window [class="Google-chrome"] mode "my-chrome-binding-mode". However, this only activates my-chrome-binding-mode when the chrome window is started, not when you refocus on it.

The motivation is that I want to alter the shortcut keys in chrome itself. For example, in Chrome, Ctrl+w closes a tab. The following makes it so I don't have to hold Ctrl, just pressing w will do it:

mode "my-chrome-binding-mode" {
    bindsym --release w exec --no-startup-id xdotool keydown ctrl key w keyup ctrl
}

The mode itself and the bindsym command work fine, but I have to manually press a key to enter my-chrome-binding-mode. I also tried

bindsym --release w [class="Google-chrome"] exec ...

but that is equivalent to not having the class criteria at all.

Desired Behavior

Have some kind of syntax like

mode [class="Google-chrome"] "my-chrome-binding-mode" {
    ....
}

Such that every time a window with that criteria is refocused, the mode is automatically activated. This will allow different window classes to have separate keybindings automatically, without having to manually press a button to toggle between them.

Environment

Output of i3 --moreversion 2>&-:

i3 version: 4.16.1
- Linux Distribution & Version: 5.2.0-arch2-1-ARCH
- Are you using a compositor (e.g., xcompmgr or compton): no

@i3bot i3bot added the enhancement label Jul 11, 2019

@Airblader

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

Hi,

thanks for raising this feature request! I can see the benefit for your usecase, but it seems that this could comfortably and without downsides be implemented as an external tool that just watches the focus and activates the proper mode (for example using the IPC). Given that I would recommend you choose this approach, you can always look to /r/i3wm if you need some help with writing such a script.

Within i3 this feels a bit like a workaround to reduce effort on implementing a feature we would probably implement differently, but dont actually intend on supporting anyway. Therefore I'll close this issue. Thanks for understanding!

@Airblader Airblader closed this Jul 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.