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

Exit mode on any other key

asked 2014-02-03 11:55:13 +0000

SUK gravatar image

updated 2014-02-03 12:07:59 +0000

Hi,

I wanted to make some "go to App" mode, like Win+G O -> Focus Opera. So I made this config:

mode "gotoapp" {
        bindsym o [class="opera"] focus
        bindsym p [class="psi"] focus
        bindsym t [class="roxterm" title="suk@pc"] focus
        bindsym Escape mode "default"
        bindsym Return mode "default"
}
bindsym $mod+g mode "gotoapp"

Is there a chance to make somethink like switch/case/default to return to default mode? Thank you! And, of course - how to run on one keystroke two commands (focus and return to default mode)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-02-03 12:43:11 +0000

Adaephon gravatar image

There is no way to catch "any key". i3 only cares about key(-combinations) that have explicitly been bound with bindsym or bindkey.

So, although you can emulate switch/case with mode, you cannot have a "default" case.


It is possible to chain multiple commands by using either ; or , (see Section 6 of the User's Guide for the difference).

So, in order to leave the mode after focusing, you can just do this:

mode "gotoapp" {
    bindsym o [class="opera"] focus; mode "default"
    bindsym p [class="psi"] focus; mode "default"
    bindsym t [class="roxterm" title="suk@pc"] focus; mode "default"
    bindsym Escape mode "default"
    bindsym Return mode "default"
}
bindsym $mod+g mode "gotoapp"
edit flag offensive delete link more

Comments

Thank for your (not so optimistic for me :) ) answer.

SUK gravatar imageSUK ( 2014-02-03 12:56:45 +0000 )edit

Question Tools

Stats

Asked: 2014-02-03 11:55:13 +0000

Seen: 323 times

Last updated: Feb 03 '14