The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Bind alt+tab to workspace next

asked 2015-07-26 19:10:44 +0000

serge poele gravatar image

updated 2015-07-26 19:11:30 +0000

Hi community,

I have two small very related questions. A small legend (from xmodmap) for them:

keycode 23 = Left Tab
keycode 50 = Left Alt

1) Can I bind just alt+tab (without $mod) to workspace next? I currently have bindcode $mod+23 workspace next, which is fine, but I felt alt+tab is more natural. Can I do this without $mod? I tried bindcode 23+50 workspace next, but alt by itself switches workspaces if I do that.

2) The following bind does not work, I am not sure why: bindcode $mod+50+23 workspace prev. Well, it works: it binds $mod + shift, but not $mod +shift+tab.

Thank you!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2015-07-26 20:40:19 +0000

analogbyte gravatar image

updated 2015-07-26 20:41:28 +0000

You should avoid using bindcode when you can I guess, bindsym does most of the work for you. You should use these bindings for what you want:

bindsym Mod1+Tab workspace next
bindsym Mod1+Shift+Tab workspace prev

Edit: Oh, and $mod is only set to Mod4 somewhere in your config. You could also change the $mod to Mod1 there, affecting all bindings.

edit flag offensive delete link more

Comments

1

Thank you @analogbyte. This works well. I like using codes because when I change the layout to another language, I can't run some bindings. However, these are not affected during layout change, so you are right, this is better. Thank you! NOTE: I can't upvote the answer, but I would :).

serge poele gravatar imageserge poele ( 2015-07-26 21:18:43 +0000 )edit
2

answered 2015-07-27 07:48:04 +0000

Adaephon gravatar image

You can get the expected behaviour with bindcode:

bindcode Mod1+23 workspace next
bindcode Mod1+Shift+23 workspace prev

bindcode expects a key code only for the last key, not the modifiers. As you noticed i3 stops parsing the keychain for bindcode when encountering the first key code. As per the User's Guide the syntax for the bindcode setting is

bindcode [--release] [Modifiers+]keycode command

Where [Modifiers+] is a optional (+-separated) list of any of these: Mod1, Mod2, Mod3, Mod4, Mod5, Shift, Control and Mode_switch. Not all of which may be defined for your keyboard layout (check with xmodmap -pm). Mod1 commonly maps to Alt an Mod4 to Super (aka Win-Key).

$mod is just a variable (probably set to Mod4 in your case) which i3 just replaces when parsing the configuration. It is not an integral part of all possible key bindings. In i3 you can bind any key (even modifiers themselves) without any modifiers or with any combination of modifiers.


Similarly bindsym expects the same list of modifiers and not the key symbols of the modifiers.

edit flag offensive delete link more

Comments

@Adaephon. Thank you! This is very helpful although I am a little surprised with the behavior (that i3 only expects key code for the last key). However, I trust there is a reason for that. Can I ask this? What is [--release] in `bindcode` ? I understand the rest of it, but not that. Thank you.

serge poele gravatar imageserge poele ( 2015-07-27 12:07:53 +0000 )edit

Ah, I can upvote stuff now. :) Excellent.

serge poele gravatar imageserge poele ( 2015-07-27 12:08:28 +0000 )edit
1

If you use that flag the action is executed on key up and not on key down.

Airblader gravatar imageAirblader ( 2015-07-27 14:53:22 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-07-26 19:10:44 +0000

Seen: 313 times

Last updated: Jul 27