Implement modes. Modes allow you to use different keybindings and switch between them.
For example, you can create a mode which will let you resize windows with some easy to use keys. So, instead of binding a combination of your homerow and modifiers to resize, like this: bind Mod4+44 resize right +10 bind Mod4+45 resize right -10 ... You can instead define a new mode: mode "resize" { bind 44 resize right +10 bind 45 resize right -10 ... bind 36 mode default } bindsym Mod4+r mode resize So, if you press Mod4+r now, your keybindings will be set to the ones defined in your resize mode above. You can then use your homerow (without any other modifier) to resize the current column/row and press enter to go back to the default mode when you are done. Note that using this option requires you to enable the new lexer/parser by passing the -l flag to i3 when starting.
This commit is contained in:
@ -222,7 +222,7 @@ command:
|
||||
bindline:
|
||||
binding
|
||||
{
|
||||
TAILQ_INSERT_TAIL(&bindings, $<binding>1, bindings);
|
||||
TAILQ_INSERT_TAIL(bindings, $<binding>1, bindings);
|
||||
}
|
||||
;
|
||||
|
||||
@ -262,8 +262,23 @@ bindsym:
|
||||
mode:
|
||||
TOKMODE WHITESPACE QUOTEDSTRING WHITESPACE '{' modelines '}'
|
||||
{
|
||||
if (strcasecmp($<string>3, "default") == 0) {
|
||||
printf("You cannot use the name \"default\" for your mode\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("\t now in mode %s\n", $<string>3);
|
||||
printf("\t current bindings = %p\n", current_bindings);
|
||||
Binding *binding;
|
||||
TAILQ_FOREACH(binding, current_bindings, bindings) {
|
||||
printf("got binding on mods %d, keycode %d, symbol %s, command %s\n",
|
||||
binding->mods, binding->keycode, binding->symbol, binding->command);
|
||||
}
|
||||
|
||||
struct Mode *mode = scalloc(sizeof(struct Mode));
|
||||
mode->name = strdup($<string>3);
|
||||
mode->bindings = current_bindings;
|
||||
current_bindings = NULL;
|
||||
SLIST_INSERT_HEAD(&modes, mode, modes);
|
||||
}
|
||||
;
|
||||
|
||||
|
Reference in New Issue
Block a user