Author Topic: i3 documentation  (Read 8614 times)

0 Members and 1 Guest are viewing this topic.

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
i3 documentation
« on: 08. August 2015, 21:42:11 »
i3 needs a bit of learning at the beginning.
Here's where you will find all you answers: i3 User's Guide,
where you can ask your i3 questions and will find even more answers: i3 FAQ ;)
and if you need a bigger cheatsheet than the little conky:


Here's the html-version
This shows the default i3 key commands. They are practically the same in this edition except for รถ instead of ; (because I am on a German keyboard... Additionally you can use the arrow keys for directions and of course there are a lot more key commands that you will find in the help file or, even better directly in the ~/.i3/config
« Last Edit: 09. August 2015, 02:19:23 by oberon »
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #1 on: 09. August 2015, 16:31:53 »
Can we use this as a general tips and tricks threads? I start.

Marking/Focusing

It's possible to mark tiles in i3wm. When a tile is marked, you can jump to that tile from other workspaces, by entering the tile's mark.

The full potential of marking is not enabled in this edition by default. Here's how I did it. Put this into the main section in .i3/config
Code: [Select]
bindsym $mod+n mode "focused"

mode "focused" {
        # keybindings for marking and jumping to clients
        bindsym m exec i3-input -F 'mark %s' -P 'Mark: '
        bindsym a exec i3-input -F '[con_mark=%s] focus' -P 'Go to mark: ', mode "default"

        # Assign marks to keys 1-0
        bindsym Shift+1 mark mark1, mode "default"
        bindsym Shift+2 mark mark2, mode "default"
        bindsym Shift+3 mark mark3, mode "default"
        bindsym Shift+4 mark mark4, mode "default"
        bindsym Shift+5 mark mark5, mode "default"
        bindsym Shift+6 mark mark6, mode "default"
        bindsym Shift+7 mark mark7, mode "default"
        bindsym Shift+8 mark mark8, mode "default"
        bindsym Shift+9 mark mark9, mode "default"
        bindsym Shift+0 mark mark0, mode "default"

        # Exit to the default mode
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

        # Jump to clients marked 1-0
        bindsym Shift+F1 [con_mark="mark1"] focus
        bindsym Shift+F2 [con_mark="mark2"] focus
        bindsym Shift+F3 [con_mark="mark3"] focus
        bindsym Shift+F4 [con_mark="mark4"] focus
        bindsym Shift+F5 [con_mark="mark5"] focus
        bindsym Shift+F6 [con_mark="mark6"] focus
        bindsym Shift+F7 [con_mark="mark7"] focus
        bindsym Shift+F8 [con_mark="mark8"] focus
        bindsym Shift+F9 [con_mark="mark9"] focus
        bindsym Shift+F10 [con_mark="mark0"] focus
The lines that contain "Mark:" and "Go to mark:" make it possible to mark tiles with any arbitrary string. But I don't think this makes much sense, unless you have additional things installed that show you that (1) you have marked a tile and (2) what the arbitrary mark is.

In my view, it makes sense to mark tiles with numbers in succession. The config code that I presented makes it work like this:

Press mod+n to enter "focused" mode. In reality, it's "marking" mode, but the focused tile is the one that will get the mark.

To enter mark number 1, press Shift+1 as shown in the config. When this is done, the "focused" mode disappears. To enter mark number 2 for another tile, you have to enter the "focused" mode again by pressing mod+n.

When the necessary tiles are marked, you can jump to them from anywhere within the i3wm session by entering their mark. The way I have set the keybinds for this is that Shift+F1 goes to mark number 1, Shift+F2 goes to mark number 2, etc. In my config, jumping to existing marks does not require you to go into "focused" mode.
« Last Edit: 09. August 2015, 17:19:53 by mxx »

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Re: i3 documentation
« Reply #2 on: 09. August 2015, 16:40:15 »
Thank you mxx! That's a cool feature, very helpful! :)!
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #3 on: 09. August 2015, 20:05:28 »
Another tip. If you come from Openbox and you like to kill windows by right-click on the Tint2 toolbar (as I do), you can emulate the same in i3wm titlebar in tabbed mode.

In the main section of .i3/config, add
Code: [Select]
bindsym --release button3 kill

This will kill the tile whose titlebar is right-clicked. It works in tabbed and stacked mode, because that's when the titlebar is visible.

Alternatively, you may want to put the tile on float by right-clicking on the titlebar. For this, change the above line to
Code: [Select]
bindsym --release button3 floating enable


Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #4 on: 09. August 2015, 20:27:59 »
Tiling wm like i3 doesn't recognise the concept of minimizing. To minimise all windows in i3wm, you have to open up a new clean workspace. The you will see your wallpaper, conky, etc. (This is a great tip for noobs who think they are powerusers :D )

Next tip concerns minimizing a single window. To get a focused tile out of the way (a la minimize a single window in stacking window managers), the easy way is to use scratchpad in i3. I have this in the main section in my .i3/config
Code: [Select]
bindsym $mod+Shift+minus         move scratchpad
bindsym $mod+minus               scratchpad show; floating toggle

With this setting, mod+Shift+minus (or hyphen) will hide the focused tile out of the way.

mod+minus will bring the hidden tile back. Usually, the client that comes from scratchpad remains floating. This is why I have made the second line in the config to toggle floating, so that the client that comes from scratchpad gets immediately tiled too.

Then there are some clients that are really meant to float and should not be tiled. When you put such on scratchpad and then bring back, they also get tiled by my config. But no problem, hit mod+minus once more and the client floats again. (Not very orderly, but works for me, kinda.)

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Re: i3 documentation
« Reply #5 on: 10. August 2015, 01:02:42 »
Thanks a lot, mxx!
Maybe one little thing to add is that you can add more than just one window to the scratchpad. Then you can browse through them one by one and bring them back - no matter on which desktop you currently are.
They will open floating, yes, and when you 'toggle float' a container it will be excluded from the scratchpad again. Otherwise <$mod>+<-> will hide it and show the next scratchpad window...
« Last Edit: 10. August 2015, 02:06:43 by oberon »
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #6 on: 11. August 2015, 21:31:14 »
Thanks a lot, mxx!
Maybe one little thing to add is that you can add more than just one window to the scratchpad. Then you can browse through them one by one and bring them back
Can you tell how to browse through the windows in scratchpad and bring back just the one I want? The way I do it is with rofi, which displays a list of all windows, including those in scratchpad. Is there some other way?

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Re: i3 documentation
« Reply #7 on: 11. August 2015, 21:53:05 »
You just press $mod+minus several times... ;)
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #8 on: 11. August 2015, 22:39:16 »
You just press $mod+minus several times... ;)
That's crude, considering the way I would like it to behave. The way I want it to behave is this: I'd like the tile to be tiled immediately in the workspace when I bring it back from the scratchpad. When the scratchpad contains multiple windows, I want to be prompted for the window to be selected.



Right now I thought of another feature. In Tmux it's possible to "join" clients to the current workspace. In Tmux it works like this:

- Look up the list of clients to take note which one you want to join (clients are automatically numbered in Tmux)
- Press the keybind to join and enter the client number.

In i3wm, it's possible to achieve similar behaviour with marking. Marking is described in a previous post in this thread. Have one more line in the  mode "focused" { section in .i3/config
Code: [Select]
bindsym f exec i3-input -F '[con_mark=%s] move container to workspace current' -P 'Fetch mark: ', mode "default"
The way to use it a la Tmux, when you want to invite a marked tile from another workspace onto your current workspace

- Enter the "focused" mode in your current workspace
- Press "f" for "fetch"
- Type the name of the mark and press Enter
- Voila

It would probably work smoother if all windows would somehow sanely be auto-marked (as they are in Tmux). This is a matter of optional advanced configuration.

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 documentation
« Reply #9 on: 14. August 2015, 12:56:29 »
That's crude, considering the way I would like it to behave. The way I want it to behave is this: I'd like the tile to be tiled immediately in the workspace when I bring it back from the scratchpad. When the scratchpad contains multiple windows, I want to be prompted for the window to be selected.

Automatically tiling it can be achieved by binding "scratchpad show, floating disable" to the shortcut to bring up a window from scratchpad. In order to be prompted for which window you want to get from the scratchpad, you'd have to write a script that parses the output of "i3-msg -t get_tree" by listing all containers in the scratchpad workspace and then use command criteria for the scratchpad-show command.

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #10 on: 14. August 2015, 20:48:10 »
Automatically tiling it can be achieved by binding "scratchpad show, floating disable" to the shortcut to bring up a window from scratchpad.
Actually, simpler is "scratchpad show, floating toggle" and when you see you did not want this particular window tiled, you hit the keybind once more and the tile is floating again. No scripts needed.

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 documentation
« Reply #11 on: 14. August 2015, 21:49:52 »
Actually, simpler is "scratchpad show, floating toggle" and when you see you did not want this particular window tiled, you hit the keybind once more and the tile is floating again. No scripts needed.

That wasn't what I said you'll need a script for at all. And to float it again you can use the default floating shortcut. Of course you can do what you suggested, too, though. I don't think it's much of a difference.

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #12 on: 15. August 2015, 06:28:09 »
Grouping seems to be missing in i3. I tried to

- mark several tiles with the same mark
- move and fetch the entire group by virtue of the mark

but in reality, as soon as you mark a tile with the same mark as a previous tile, the previous tile loses the mark.

There's no multiple selection either. As close as it gets is selecting containers with multiple clients within a single workspace and moving the container to another workspace.

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 documentation
« Reply #13 on: 15. August 2015, 16:28:36 »
Yes, marks have to be unique. Otherwise things like focusing by mark or moving containers to a mark would expose really odd behavior. Since command criteria are regular expressions, you can mark your containers with group1_1, group1_2 and so on and then use con_mark="group1" to select all of them at once.

Quote
There's no multiple selection either.

As mentioned above, command criteria generally select all matching windows. If you want to select multiple containers with entirely different properties, you can always just execute the same command multiple times. So there isn't really any need for or-ing criteria.
« Last Edit: 15. August 2015, 16:31:04 by Airblader »

Offline mxx

  • Sr. Mitglied
  • ****
  • Posts: 420
  • Branch: stable
  • Desktop: Openbox/i3wm
  • Kernel: linux4
  • Skill: Intermediate
Re: i3 documentation
« Reply #14 on: 15. August 2015, 16:38:49 »
Yes, marks have to be unique. Otherwise things like focusing by mark or moving containers to a mark would expose really odd behavior. Since command criteria are regular expressions, you can mark your containers with group1_1, group1_2 and so on and then use con_mark="group1" to select all of them at once.
Hey, this is awesome!

I just set a mark to a bunch of windows (as per my config quoted above), then opened a new workspace and fetched (again, as per my config quoted above, concerning fetching) "mark". Voila! That's grouping :)