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

enhancement: Allow multiple keys as Metake #3017

Closed
earizon opened this Issue Oct 10, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@earizon

earizon commented Oct 10, 2017

Version: 4.12

Allow two keys (a combination of "two-of-three" -Windows, Alt, space-) to be used as $mod key. This automatically fixes keyboard shortcut collisions with many programs (most notably Windows accessing remote i3 desktops through VNC).

@earizon

This comment has been minimized.

Show comment
Hide comment
@earizon

earizon Nov 15, 2017

The tmux (https://github.com/tmux/tmux/wiki) approach also offers a simple solution to keyboard shortcuts collisions:
In tmux two shortcuts in order are needed:

  • First press "Ctrl+b" to indicate a new command.
  • Press the command key ('space' to toggle layout, 's' to show a list of sessions, ...)
    It's slightly slower than a current i3 shortcuts but still very fast in practice.
    (Also, I guess many tmux users will be the firsts to adopt i3 and vice-versa!)

earizon commented Nov 15, 2017

The tmux (https://github.com/tmux/tmux/wiki) approach also offers a simple solution to keyboard shortcuts collisions:
In tmux two shortcuts in order are needed:

  • First press "Ctrl+b" to indicate a new command.
  • Press the command key ('space' to toggle layout, 's' to show a list of sessions, ...)
    It's slightly slower than a current i3 shortcuts but still very fast in practice.
    (Also, I guess many tmux users will be the firsts to adopt i3 and vice-versa!)
@stapelberg

This comment has been minimized.

Show comment
Hide comment
@stapelberg

stapelberg Nov 20, 2017

Member

Thanks for filing the request.

You can already change $mod to evaluate to e.g. Mod4+Mod1 (Windows+Alt).
Regarding the tmux suggestion, you can already define keyboard modes to achieve this effect.

Does that answer your question, or did I miss anything which would need to change on the i3 end?

Member

stapelberg commented Nov 20, 2017

Thanks for filing the request.

You can already change $mod to evaluate to e.g. Mod4+Mod1 (Windows+Alt).
Regarding the tmux suggestion, you can already define keyboard modes to achieve this effect.

Does that answer your question, or did I miss anything which would need to change on the i3 end?

@dragon788

This comment has been minimized.

Show comment
Hide comment
@dragon788

dragon788 Nov 20, 2017

@stapelberg does evaluating both requiring pressing both as the prefix, or it will use one or the other?

@earizon My concern with mapping multiple keys to the global $mod and all shortcuts (built-in or otherwise) is that i3 appears to exclusively (correctly) capture the mappings if they are defined in it's config, ie if I map Ctrl, in i3, I can't use that in Chrome to switch between conversations in Hangouts.

What I ended up doing is using Win aka Super for $mod, and any shortcuts I also want available with Alt I define $Mmod as the keycode for Alt and then simply duplicate the few shortcuts I need both options for with $mod and another line with $Mmod.

# i3 config file (v4)
set $mod Mod4
set $Mmod Mod1
set $Cmod Control

bindsym $mod+Shift+grave floating toggle

bindsym $Mmod+grave workspace back_and_forth
bindsym $Cmod+grave workspace back_and_forth

bindsym $mod+comma workspace prev
bindsym $mod+period workspace next
bindsym $Mmod+comma workspace prev
bindsym $Mmod+period workspace next
# Can't do this, it conflicts with Hangouts "prev/next" conversation
#bindsym $Cmod+comma workspace prev
#bindsym $Cmod+period workspace next

dragon788 commented Nov 20, 2017

@stapelberg does evaluating both requiring pressing both as the prefix, or it will use one or the other?

@earizon My concern with mapping multiple keys to the global $mod and all shortcuts (built-in or otherwise) is that i3 appears to exclusively (correctly) capture the mappings if they are defined in it's config, ie if I map Ctrl, in i3, I can't use that in Chrome to switch between conversations in Hangouts.

What I ended up doing is using Win aka Super for $mod, and any shortcuts I also want available with Alt I define $Mmod as the keycode for Alt and then simply duplicate the few shortcuts I need both options for with $mod and another line with $Mmod.

# i3 config file (v4)
set $mod Mod4
set $Mmod Mod1
set $Cmod Control

bindsym $mod+Shift+grave floating toggle

bindsym $Mmod+grave workspace back_and_forth
bindsym $Cmod+grave workspace back_and_forth

bindsym $mod+comma workspace prev
bindsym $mod+period workspace next
bindsym $Mmod+comma workspace prev
bindsym $Mmod+period workspace next
# Can't do this, it conflicts with Hangouts "prev/next" conversation
#bindsym $Cmod+comma workspace prev
#bindsym $Cmod+period workspace next
@dragon788

This comment has been minimized.

Show comment
Hide comment
@dragon788

dragon788 Nov 20, 2017

I like the idea of being able to chord (which appears to be the original request) though I do also like being able to define the direct actions not requiring a prefix (all of which i3 and tmux do quite well). I'll have to test using multiple keys as the $mod, that sounds really useful in some cases (nested i3 in VMs but still being able to manipulate things on the host).

dragon788 commented Nov 20, 2017

I like the idea of being able to chord (which appears to be the original request) though I do also like being able to define the direct actions not requiring a prefix (all of which i3 and tmux do quite well). I'll have to test using multiple keys as the $mod, that sounds really useful in some cases (nested i3 in VMs but still being able to manipulate things on the host).

@stapelberg

This comment has been minimized.

Show comment
Hide comment
@stapelberg

stapelberg Nov 20, 2017

Member

@stapelberg does evaluating both requiring pressing both as the prefix, or it will use one or the other?

Both.

If you want either, duplicate your key bindings.

i3 appears to exclusively (correctly) capture the mappings if they are defined in it's config

Yes, X11 provides no other way (that I’m aware of) to do this.

Member

stapelberg commented Nov 20, 2017

@stapelberg does evaluating both requiring pressing both as the prefix, or it will use one or the other?

Both.

If you want either, duplicate your key bindings.

i3 appears to exclusively (correctly) capture the mappings if they are defined in it's config

Yes, X11 provides no other way (that I’m aware of) to do this.

@Airblader

This comment has been minimized.

Show comment
Hide comment
@Airblader

Airblader Dec 25, 2017

Member

It sounds like we can close this one. It has become stale and there was no clear result on whether or what to implement.

Member

Airblader commented Dec 25, 2017

It sounds like we can close this one. It has become stale and there was no clear result on whether or what to implement.

@Airblader Airblader closed this Dec 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment