💾 Archived View for gemini.lottalinuxlinks.com › posts › 2021-01-07-i3-launch-mode.gmi captured on 2021-12-17 at 13:26:06. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

░█░░░█▀█░▀█▀░▀█▀░█▀█░█░░░▀█▀░█▀█░█░█░█░█░█░░░▀█▀░█▀█░█░█░█▀▀
░█░░░█░█░░█░░░█░░█▀█░█░░░░█░░█░█░█░█░▄▀▄░█░░░░█░░█░█░█▀▄░▀▀█
░▀▀▀░▀▀▀░░▀░░░▀░░▀░▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀

An old linux user rambling on about linux, FOSS, and other geekery.

i3 launch mode

2021-01-07 | #FOSS #linux #i3

The i3 window manager is cool and awesome in lots of ways. It is fast and lightweight, its keyboard driven, its well documented, and via it's config file it is super easy to get it to do just about anything you need. Those are the things that come to mind first when I think of i3. In addition to that though, there are a couple of lesser known features that are worth mentioning, understanding, and using. One of these is the scratchpad, and I will post about that some time in the future. The other super cool feature is modes. i3 has modes like vim has modes. What is cool about i3's modes is that you can define the keybindings, and even create new modes.

Most of the time spent in i3 is in what is called the default mode, with both the default and any custom keybindings you have defined. There is a resize mode that is configured out of the box in the standard config. When you enter the resize mode (by pressing super+r, as I have it configured), you are working with a new set of keybindings (that oddly enough allow you to *resize* a window) until you exit that mode.

There are other modes too. The launch mode (that is what I am calling it, since I don't know if that is the official name or not) can be enabled by entering the appropriate code in the config file; the i3 config file is located in your ~/.config/i3 directory. The following code is from my i3 config file, but with my user name replaced with the word user:

#Launch mode, one app per key.
mode "launch" {
        bindsym m exec --no-startup-id /home/user/bin/mmusic ; mode "default"
        bindsym u exec --no-startup-id /home/user/bin/umusic ; mode "default"
        bindsym c exec --no-startup-id urxvt -e cmus ; mode "default"
        bindsym v exec --no-startup-id urxvt -e cava ; mode "default"
        bindsym Escape mode "default"
}
bindsym $mod+l mode "launch" 

What this does is allow you to enter launch mode my pressing $mod+l (super+lowercase L). Once you are in launch mode you have new keybindings, and the default, normal keybindings won't work until you exit launch mode and enter the default mode. When you are in launch mode (or any mode for that matter), i3 is even kind enough to notify you in your status bar.

In my case when I press $mod+l, I am in launch mode and the keybindings defined as m, u, c, and v are active. As soon as I press one of those keys I am returned to the default mode with the default keybindings. Also in my case, the m key will launch a script I wrote to mount my sshfs share where my music lives; the u key would launch another script to unmount the share; the c key would start my music player, cmus; and the v key would start the visualizer cava.

The way I have this mode configured is a little different than the default resize mode behavior. Once you've entered resize mode in the default config you have to hit return or escape to leave resize mode. In the launch mode as I have it configured, I am returned to the default mode as soon as I enter one of the defined launch mode keybindings, or the return key (which ever comes first).

What is really cool about this, is that the modes in i3 can allow you to use keybindings that may conflict or be easily confused with those in the default mode; speaking of which, you can even set up a passthrough mode to temporarily disable i3 keybindings so that you can play nethack without bumping into your i3 keybindings.

#Passthrough Mode
mode "pass-through" {
        bindsym $mod+Escape mode "default"
}
bindsym $mod+Escape mode "pass-through"

Pretty neat.

-dsyates

Tags

i3

linux

FOSS

The lottalinuxlinks.com linux user web blog

The MODcast

The lottalinuxlinks.com gopher hole

Fosstodon

Links to other cool gemini capsules

e: dsyates@lottalinuxlinks.com

m: @dsyates@fosstodon.org

x: dsyates@xmpp.jp

-dsyates

(o\_!_/o)