]> git.sur5r.net Git - i3/i3/blob - docs/userguide
Merge branch 'master' into next
[i3/i3] / docs / userguide
1 i3 User’s Guide
2 ===============
3 Michael Stapelberg <michael+i3@stapelberg.de>
4 August 2011
5
6 This document contains all the information you need to configure and use the i3
7 window manager. If it does not, please contact us on IRC (preferred) or post your
8 question(s) on the mailing list.
9
10 == Default keybindings
11
12 For the "too long; didn’t read" people, here is an overview of the default
13 keybindings (click to see the full size image):
14
15 *Keys to use with mod (alt):*
16
17 image:keyboard-layer1.png["Keys to use with mod (alt)",width=600,link="keyboard-layer1.png"]
18
19 *Keys to use with Shift+mod:*
20
21 image:keyboard-layer2.png["Keys to use with Shift+mod",width=600,link="keyboard-layer2.png"]
22
23 The red keys are the modifiers you need to press (by default), the blue keys
24 are your homerow.
25
26 == Using i3
27
28 Throughout this guide, the keyword +mod+ will be used to refer to the
29 configured modifier. This is the alt key (Mod1) by default, with windows (Mod4)
30 being a popular alternative.
31
32 === Opening terminals and moving around
33
34 One very basic operation is opening a new terminal. By default, the keybinding
35 for this is mod+Enter, that is Alt+Enter in the default configuration. By
36 pressing mod+Enter, a new terminal will be opened.  It will fill the whole
37 space available on your screen.
38
39 image:single_terminal.png[Single terminal]
40
41 If you now open another terminal, i3 will place it next to the current one,
42 splitting the screen size in half. Depending on your monitor, i3 will put the
43 created window beside the existing window (on wide displays) or below the
44 existing window (rotated displays).
45
46 image:two_terminals.png[Two terminals]
47
48 To move the focus between the two terminals, you can use the direction keys
49 which you may know from the editor +vi+. However, in i3, your homerow is used
50 for these keys (in +vi+, the keys are shifted to the left by one for
51 compatibility with most keyboard layouts). Therefore, +mod+J+ is left, +mod+K+
52 is down, +mod+L+ is up and `mod+;` is right. So, to switch between the
53 terminals, use +mod+K+ or +mod+L+. Of course, you can also use the arrow keys.
54
55 At the moment, your workspace is split (it contains two terminals) in a
56 specific direction (horizontal by default). Every window can be split
57 horizontally or vertically again, just like the workspace. The terminology is
58 "window" for a container that actually contains an X11 window (like a terminal
59 or browser) and "split container" for containers that consist of one or more
60 windows.
61
62 TODO: picture of the tree
63
64 To split a window vertically, press +mod+v+. To split it horizontally, press
65 +mod+h+.
66
67 === Changing the container layout
68
69 A split container can have one of the following layouts:
70
71 default::
72 Windows are sized so that every window gets an equal amount of space in the
73 container.
74 stacking::
75 Only the focused window in the container is displayed. You get a list of
76 windows at the top of the container.
77 tabbed::
78 The same principle as +stacking+, but the list of windows at the top is only
79 a single line which is vertically split.
80
81 To switch modes, press +mod+e+ for default, +mod+s+ for stacking and
82 +mod+w+ for tabbed.
83
84 image:modes.png[Container modes]
85
86 === Toggling fullscreen mode for a window
87
88 To display a window in fullscreen mode or to go out of fullscreen mode again,
89 press +mod+f+.
90
91 There is also a global fullscreen mode in i3 in which the client will span all
92 available outputs.
93
94 === Opening other applications
95
96 Aside from opening applications from a terminal, you can also use the handy
97 +dmenu+ which is opened by pressing +mod+d+ by default. Just type the name
98 (or a part of it) of the application which you want to open. The corresponding
99 application has to be in your +$PATH+ for this to work.
100
101 Additionally, if you have applications you open very frequently, you can
102 create a keybinding for starting the application directly. See the section
103 <<configuring>> for details.
104
105 === Closing windows
106
107 If an application does not provide a mechanism for closing (most applications
108 provide a menu, the escape key or a shortcut like +Control+W+ to close), you
109 can press +mod+Shift+q+ to kill a window. For applications which support
110 the WM_DELETE protocol, this will correctly close the application (saving
111 any modifications or doing other cleanup). If the application doesn’t support
112 the WM_DELETE protocol your X server will kill the window and the behaviour
113 depends on the application.
114
115 === Using workspaces
116
117 Workspaces are an easy way to group a set of windows. By default, you are on
118 the first workspace, as the bar on the bottom left indicates. To switch to
119 another workspace, press +mod+num+ where +num+ is the number of the workspace
120 you want to use. If the workspace does not exist yet, it will be created.
121
122 A common paradigm is to put the web browser on one workspace, communication
123 applications (+mutt+, +irssi+, ...) on another one, and the ones with which you
124 work, on the third one. Of course, there is no need to follow this approach.
125
126 If you have multiple screens, a workspace will be created on each screen at
127 startup. If you open a new workspace, it will be bound to the screen you
128 created it on.  When you switch to a workspace on another screen, i3 will set
129 focus to that screen.
130
131 === Moving windows to workspaces
132
133 To move a window to another workspace, simply press +mod+Shift+num+ where
134 +num+ is (like when switching workspaces) the number of the target workspace.
135 Similarly to switching workspaces, the target workspace will be created if
136 it does not yet exist.
137
138 === Resizing
139
140 The easiest way to resize a container is by using the mouse: Grab the border
141 and move it to the wanted size.
142
143 See <<resizingconfig>> for how to configure i3 to be able to resize
144 columns/rows with your keyboard.
145
146 === Restarting i3 inplace
147
148 To restart i3 inplace (and thus get into a clean state if there is a bug, or
149 to upgrade to a newer version of i3) you can use +mod+Shift+r+.
150
151 === Exiting i3
152
153 To cleanly exit i3 without killing your X server, you can use +mod+Shift+e+.
154
155 === Floating
156
157 Floating mode is the opposite of tiling mode. The position and size of a window
158 are not managed by i3, but by you. Using this mode violates the tiling
159 paradigm but can be useful for some corner cases like "Save as" dialog
160 windows, or toolbar windows (GIMP or similar). Those windows usually set the
161 appropriate hint and are opened in floating mode by default.
162
163 You can toggle floating mode for a window by pressing +mod+Shift+Space+. By
164 dragging the window’s titlebar with your mouse you can move the window
165 around. By grabbing the borders and moving them you can resize the window. You
166 can also do that by using the <<floating_modifier>>.
167
168 For resizing floating windows with your keyboard, see <<resizingconfig>>.
169
170 Floating windows are always on top of tiling windows.
171
172 == Tree
173
174 i3 stores all information about the X11 outputs, workspaces and layout of the
175 windows on them in a tree. The root node is the X11 root window, followed by
176 the X11 outputs, then dock areas and a content container, then workspaces and
177 finally the windows themselve. In previous versions of i3 we had multiple lists
178 (of outputs, workspaces) and a table for each workspace. That approach turned
179 out to be complicated to use (snapping), understand and implement.
180
181 === The tree consists of Containers
182
183 The building blocks of our tree are so called +Containers+. A +Container+ can
184 host a window (meaning an X11 window, one that you can actually see and use,
185 like a browser). Alternatively, it could contain one or more +Containers+. A
186 simple example is the workspace: When you start i3 with a single monitor, a
187 single workspace and you open two terminal windows, you will end up with a tree
188 like this:
189
190 image::tree-layout2.png["layout2",float="right"]
191 image::tree-shot4.png["shot4",title="Two terminals on standard workspace"]
192
193 === Orientation and Split Containers
194
195 [[OrientationSplit]]
196
197 It is only natural to use so-called +Split Containers+ in order to build a
198 layout when using a tree as data structure. In i3, every +Container+ has an
199 orientation (horizontal, vertical or unspecified). So, in our example with the
200 workspace, the default orientation of the workspace +Container+ is horizontal
201 (most monitors are widescreen nowadays). If you change the orientation to
202 vertical (+mod+v+ in the default config) and *then* open two terminals, i3 will
203 configure your windows like this:
204
205 image::tree-shot2.png["shot2",title="Vertical Workspace Orientation"]
206
207 An interesting new feature of the tree branch is the ability to split anything:
208 Let’s assume you have two terminals on a workspace (with horizontal
209 orientation), focus is on the right terminal. Now you want to open another
210 terminal window below the current one. If you would just open a new terminal
211 window, it would show up to the right due to the horizontal workspace
212 orientation. Instead, press +mod+v+ to create a +Vertical Split Container+ (to
213 open a +Horizontal Split Container+, use +mod+h+). Now you can open a new
214 terminal and it will open below the current one:
215
216 image::tree-layout1.png["Layout",float="right"]
217 image::tree-shot1.png["shot",title="Vertical Split Container"]
218
219 unfloat::[]
220
221 You probably guessed it already: There is no limit on how deep your hierarchy
222 of splits can be.
223
224 === Focus parent
225
226 Let’s stay with our example from above. We have a terminal on the left and two
227 vertically split terminals on the right, focus is on the bottom right one. When
228 you open a new terminal, it will open below the current one.
229
230 So, how can you open a new terminal window to the *right* of the current one?
231 The solution is to use +focus parent+, which will focus the +Parent Container+ of
232 the current +Container+. In this case, you would focus the +Vertical Split
233 Container+ which is *inside* the horizontally oriented workspace. Thus, now new
234 windows will be opened to the right of the +Vertical Split Container+:
235
236 image::tree-shot3.png["shot3",title="Focus parent, then open new terminal"]
237
238 [[configuring]]
239 == Configuring i3
240
241 This is where the real fun begins ;-). Most things are very dependant on your
242 ideal working environment so we can’t make reasonable defaults for them.
243
244 While not using a programming language for the configuration, i3 stays
245 quite flexible in regards to the things you usually want your window manager
246 to do.
247
248 For example, you can configure bindings to jump to specific windows,
249 you can set specific applications to start on specific workspaces, you can
250 automatically start applications, you can change the colors of i3, and you
251 can bind your keys to do useful things.
252
253 To change the configuration of i3, copy +/etc/i3/config+ to +\~/.i3/config+
254 (or +~/.config/i3/config+ if you like the XDG directory scheme) and edit it
255 with a text editor.
256
257 On first start (and on all following starts, unless you have a configuration
258 file), i3 will offer you to create a configuration file. You can tell the
259 wizard to use either Alt (Mod1) or Windows (Mod4) as modifier in the config
260 file. Also, the created config file will use the key symbols of your current
261 keyboard layout. To start the wizard, use the command +i3-config-wizard+.
262 Please note that you must not have +~/.i3/config+, otherwise the wizard will
263 exit.
264
265 === Comments
266
267 It is possible and recommended to use comments in your configuration file to
268 properly document your setup for later reference. Comments are started with
269 a # and can only be used at the beginning of a line:
270
271 *Examples*:
272 -------------------
273 # This is a comment
274 -------------------
275
276 === Fonts
277
278 i3 uses X core fonts (not Xft) for rendering window titles. You can use
279 +xfontsel(1)+ to generate such a font description. To see special characters
280 (Unicode), you need to use a font which supports the ISO-10646 encoding.
281
282 If i3 cannot open the configured font, it will output an error in the logfile
283 and fall back to a working font.
284
285 *Syntax*:
286 ------------------------------
287 font <X core font description>
288 ------------------------------
289
290 *Examples*:
291 --------------------------------------------------------------
292 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
293 --------------------------------------------------------------
294
295 [[keybindings]]
296
297 === Keyboard bindings
298
299 A keyboard binding makes i3 execute a command (see below) upon pressing a
300 specific key. i3 allows you to bind either on keycodes or on keysyms (you can
301 also mix your bindings, though i3 will not protect you from overlapping ones).
302
303 * A keysym (key symbol) is a description for a specific symbol, like "a"
304   or "b", but also more strange ones like "underscore" instead of "_". These
305   are the ones you use in Xmodmap to remap your keys. To get the current
306   mapping of your keys, use +xmodmap -pke+.
307
308 * Keycodes do not need to have a symbol assigned (handy for custom vendor
309   hotkeys on some notebooks) and they will not change their meaning as you
310   switch to a different keyboard layout (when using +xmodmap+).
311
312 My recommendation is: If you often switch keyboard layouts but you want to keep
313 your bindings in the same physical location on the keyboard, use keycodes.
314 If you don’t switch layouts, and want a clean and simple config file, use
315 keysyms.
316
317 *Syntax*:
318 ----------------------------------
319 bindsym [Modifiers+]keysym command
320 bindcode [Modifiers+]keycode command
321 ----------------------------------
322
323 *Examples*:
324 --------------------------------
325 # Fullscreen
326 bindsym mod+f f
327
328 # Restart
329 bindsym mod+Shift+r restart
330
331 # Notebook-specific hotkeys
332 bindcode 214 exec /home/michael/toggle_beamer.sh
333 --------------------------------
334
335 Available Modifiers:
336
337 Mod1-Mod5, Shift, Control::
338 Standard modifiers, see +xmodmap(1)+
339
340 Mode_switch::
341 Unlike other window managers, i3 can use Mode_switch as a modifier. This allows
342 you to remap capslock (for example) to Mode_switch and use it for both: typing
343 umlauts or special characters 'and' having some comfortably reachable key
344 bindings. For example, when typing, capslock+1 or capslock+2 for switching
345 workspaces is totally convenient. Try it :-).
346
347 [[floating_modifier]]
348
349 === The floating modifier
350
351 To move floating windows with your mouse, you can either grab their titlebar
352 or configure the so called floating modifier which you can then press and
353 click anywhere in the window itself to move it. The most common setup is to
354 use the same key you use for managing windows (Mod1 for example). Then
355 you can press Mod1, click into a window using your left mouse button, and drag
356 it to the position you want.
357
358 When holding the floating modifier, you can resize a floating window by
359 pressing the right mouse button on it and moving around while holding it. If
360 you hold the shift button as well, the resize will be proportional.
361
362 *Syntax*:
363 --------------------------------
364 floating_modifier <Modifiers>
365 --------------------------------
366
367 *Example*:
368 --------------------------------
369 floating_modifier Mod1
370 --------------------------------
371
372 === Orientation for new workspaces
373
374 New workspaces get a reasonable default orientation: Wide-screen monitors
375 (anything wider than high) get horizontal orientation, rotated monitors
376 (anything higher than wide) get vertical orientation.
377
378 With the +default_orientation+ configuration directive, you can override that
379 behaviour.
380
381 *Syntax*:
382 ----------------------------------------------
383 default_orientation <horizontal|vertical|auto>
384 ----------------------------------------------
385
386 *Example*:
387 ----------------------------
388 default_orientation vertical
389 ----------------------------
390
391 === Layout mode for new containers
392
393 This option determines in which mode new containers on workspace level will
394 start.
395 ///////////////////////////////
396 See also <<stack-limit>>.
397 //////////////////////////////
398
399 *Syntax*:
400 ---------------------------------------------
401 workspace_layout <default|stacking|tabbed>
402 ---------------------------------------------
403 /////////////////////////////////////////////
404 new_container stack-limit <cols|rows> <value>
405 /////////////////////////////////////////////
406
407 *Example*:
408 ---------------------
409 workspace_layout tabbed
410 ---------------------
411
412 === Border style for new windows
413
414 This option determines which border style new windows will have.
415
416 *Syntax*:
417 ---------------------------------------------
418 new_window <normal|1pixel|none>
419 ---------------------------------------------
420
421 *Example*:
422 ---------------------
423 new_window 1pixel
424 ---------------------
425
426 === Arbitrary commands for specific windows (for_window)
427
428 With the +for_window+ command, you can let i3 execute any command when it
429 encounters a specific window. This can be used to set windows to floating or to
430 change their border style, for example.
431
432 *Syntax*:
433 -----------------------------
434 for_window <criteria> command
435 -----------------------------
436
437 *Examples*:
438 ------------------------------------------------
439 # enable floating mode for all XTerm windows
440 for_window [class="XTerm"] floating enable
441
442 # Make all urxvts use a 1-pixel border:
443 for_window [class="urxvt"] border 1pixel
444
445 # A less useful, but rather funny example:
446 # makes the window floating as soon as I change
447 # directory to ~/work
448 for_window [title="x200: ~/work"] floating enable
449 ------------------------------------------------
450
451 The valid criteria are the same as those for commands, see <<command_criteria>>.
452
453 === Variables
454
455 As you learned in the section about keyboard bindings, you will have
456 to configure lots of bindings containing modifier keys. If you want to save
457 yourself some typing and be able to change the modifier you use later,
458 variables can be handy.
459
460 *Syntax*:
461 --------------
462 set $name value
463 --------------
464
465 *Example*:
466 ------------------------
467 set $m Mod1
468 bindsym $m+Shift+r restart
469 ------------------------
470
471 Variables are directly replaced in the file when parsing. There is no fancy
472 handling and there are absolutely no plans to change this. If you need a more
473 dynamic configuration you should create a little script which generates a
474 configuration file and run it before starting i3 (for example in your
475 +~/.xsession+ file).
476
477 === Automatically putting clients on specific workspaces
478
479 [[assign_workspace]]
480
481 To automatically make a specific window show up on a specific workspace, you
482 can use an *assignment*. You can match windows by using any criteria,
483 see <<command_criteria>>. It is recommended that you match on window classes
484 (and instances, when appropriate) instead of window titles whenever possible
485 because some applications first create their window, and then worry about
486 setting the correct title. Firefox with Vimperator comes to mind. The window
487 starts up being named Firefox, and only when Vimperator is loaded does the
488 title change. As i3 will get the title as soon as the application maps the
489 window (mapping means actually displaying it on the screen), you’d need to have
490 to match on 'Firefox' in this case.
491
492 *Syntax*:
493 ------------------------------------------------------------
494 assign <criteria> [→] workspace
495 ------------------------------------------------------------
496
497 *Examples*:
498 ----------------------
499 # Assign URxvt terminals to workspace 2
500 assign [class="URxvt"] 2
501
502 # Same thing, but more precise (exact match instead of substring)
503 assign [class="^URxvt$"] 2
504
505 # Same thing, but with a beautiful arrow :)
506 assign [class="^URxvt$"] → 2
507
508 # Assignment to a named workspace
509 assign [class="^URxvt$"] → work
510
511 # Start urxvt -name irssi
512 assign [class="^URxvt$" instance="^irssi$"] → 3
513 ----------------------
514
515 Note that the arrow is not required, it just looks good :-). If you decide to
516 use it, it has to be a UTF-8 encoded arrow, not `->` or something like that.
517
518 To get the class and instance, you can use +xprop+. After clicking on the
519 window, you will see the following output:
520
521 *xwininfo*:
522 -----------------------------------
523 WM_CLASS(STRING) = "irssi", "URxvt"
524 -----------------------------------
525
526 The first part of the WM_CLASS is the instance ("irssi" in this example), the
527 second part is the class ("URxvt" in this example).
528
529 Should you have any problems with assignments, make sure to check the i3
530 logfile first (see http://i3wm.org/docs/debugging.html). It includes more
531 details about the matching process and the window’s actual class, instance and
532 title when starting up.
533
534 === Automatically starting applications on i3 startup
535
536 By using the +exec+ keyword outside a keybinding, you can configure
537 which commands will be performed by i3 on initial startup. +exec+
538 commands will not run when restarting i3, if you need a command to run
539 also when restarting i3 you should use the +exec_always+
540 keyword. These commands will be run in order.
541
542 *Syntax*:
543 -------------------
544 exec command
545 exec_always command
546 -------------------
547
548 *Examples*:
549 --------------------------------
550 exec i3status | i3bar -d
551 exec_always ~/my_script.sh
552 --------------------------------
553
554 [[workspace_screen]]
555
556 === Automatically putting workspaces on specific screens
557
558 If you assign clients to workspaces, it might be handy to put the
559 workspaces on specific screens. Also, the assignment of workspaces to screens
560 will determine which workspace i3 uses for a new screen when adding screens
561 or when starting (e.g., by default it will use 1 for the first screen, 2 for
562 the second screen and so on).
563
564 *Syntax*:
565 ----------------------------------
566 workspace <number> output <output>
567 ----------------------------------
568
569 The 'output' is the name of the RandR output you attach your screen to. On a
570 laptop, you might have VGA1 and LVDS1 as output names. You can see the
571 available outputs by running +xrandr --current+.
572
573 *Examples*:
574 ---------------------------
575 workspace 1 output LVDS1
576 workspace 5 output VGA1
577 ---------------------------
578
579 === Changing colors
580
581 You can change all colors which i3 uses to draw the window decorations.
582
583 *Syntax*:
584 --------------------------------------------
585 colorclass border background text
586 --------------------------------------------
587
588 Where colorclass can be one of:
589
590 client.focused::
591         A client which currently has the focus.
592 client.focused_inactive::
593         A client which is the focused one of its container, but it does not have
594         the focus at the moment.
595 client.unfocused::
596         A client which is not the focused one of its container.
597 client.urgent::
598         A client which has its urgency hint activated.
599
600 You can also specify the color to be used to paint the background of the client
601 windows. This color will be used to paint the window on top of which the client
602 will be rendered.
603
604 *Syntax*:
605 -----------------------
606 client.background color
607 -----------------------
608
609 Only clients that do not cover the whole area of this window expose the color
610 used to paint it. If you use a color other than black for your terminals, you
611 most likely want to set the client background color to the same color as your
612 terminal program's background color to avoid black gaps between the rendered
613 area of the termianal and the i3 border.
614
615 Colors are in HTML hex format (#rrggbb), see the following example:
616
617 *Examples (default colors)*:
618 -----------------------------------------------
619 # class                 border  backgr. text
620 client.focused          #4c7899 #285577 #ffffff
621 client.focused_inactive #333333 #5f676a #ffffff
622 client.unfocused        #333333 #222222 #888888
623 client.urgent           #2f343a #900000 #ffffff
624 -----------------------------------------------
625
626 Note that for the window decorations, the color around the child window is the
627 background color, and the border color is only the two thin lines at the top of
628 the window.
629
630 === Interprocess communication
631
632 i3 uses unix sockets to provide an IPC interface. This allows third-party
633 programs to get information from i3, such as the current workspaces
634 (to display a workspace bar), and to control i3.
635
636 The IPC socket is enabled by default and will be created in
637 +/tmp/i3-%u/ipc-socket.%p+ where +%u+ is your UNIX username and +%p+ is the PID
638 of i3.
639
640 You can override the default path through the environment-variable +I3SOCK+ or
641 by specifying the +ipc-socket+ directive. This is discouraged, though, since i3
642 does the right thing by default.
643
644 *Examples*:
645 ----------------------------
646 ipc-socket /tmp/i3-ipc.sock
647 ----------------------------
648
649 You can then use the +i3-msg+ application to perform any command listed in
650 the next section.
651
652 === Focus follows mouse
653
654 If you have a setup where your mouse usually is in your way (like a touchpad
655 on your laptop which you do not want to disable completely), you might want
656 to disable 'focus follows mouse' and control focus only by using your keyboard.
657 The mouse will still be useful inside the currently active window (for example
658 to click on links in your browser window).
659
660 *Syntax*:
661 ----------------------------
662 focus_follows_mouse <yes|no>
663 ----------------------------
664
665 *Example*:
666 ----------------------
667 focus_follows_mouse no
668 ----------------------
669
670 === Popups during fullscreen mode
671
672 When you are in fullscreen mode, some applications still open popup windows
673 (take Xpdf for example). This is because these applications may not be aware
674 that they are in fullscreen mode (they do not check the corresponding hint).
675 There are two things which are possible to do in this situation:
676
677 1. Just ignore the popup (don’t map it). This won’t interrupt you while you are
678    in fullscreen. However, some apps might react badly to this (deadlock until
679    you go out of fullscreen).
680 2. Leave fullscreen mode. This is the default.
681
682 *Syntax*:
683 -------------------------------------------------
684 popup_during_fullscreen <ignore|leave_fullscreen>
685 -------------------------------------------------
686
687 *Example*:
688 ------------------------------
689 popup_during_fullscreen ignore
690 ------------------------------
691
692 === Focus wrapping
693
694 When being in a tabbed or stacked container, the first container will be
695 focused when you use +focus down+ on the last container -- the focus wraps. If
696 however there is another stacked/tabbed container in that direction, focus will
697 be set on that container. This is the default behaviour so you can navigate to
698 all your windows without having to use +focus parent+.
699
700 If you want the focus to *always* wrap and you are aware of using +focus
701 parent+ to switch to different containers, you can use the
702 +force_focus_wrapping+ configuration directive. After enabling it, the focus
703 will always wrap.
704
705 *Syntax*:
706 -----------------------------
707 force_focus_wrapping <yes|no>
708 -----------------------------
709
710 *Example*:
711 ------------------------
712 force_focus_wrapping yes
713 ------------------------
714
715 == List of commands
716
717 Commands are what you bind to specific keypresses. You can also issue commands
718 at runtime without pressing a key by using the IPC interface. An easy way to
719 do this is to use the +i3-msg+ utility:
720
721 *Example*:
722 --------------------------
723 # execute this on your shell to make the current container borderless
724 i3-msg border none
725 --------------------------
726
727 Commands can be chained by using +;+ (a semicolon). So, to move a window to a
728 specific workspace and immediately switch to that workspace, you can configure
729 the following keybinding:
730
731 *Example*:
732 -------------------------------------------
733 bindsym mod+x move workspace 3; workspace 3
734 -------------------------------------------
735
736 [[command_criteria]]
737
738 Furthermore, you can change the scope of a command, that is, which containers
739 should be affected by that command, by using various criteria. These are
740 prefixed in square brackets to every command. If you want to kill all windows
741 which have the class Firefox, use:
742
743 *Example*:
744 ------------------------------------
745 bindsym mod+x [class="Firefox"] kill
746
747 # same thing, but case-insensitive
748 bindsym mod+x [class="(?i)firefox"] kill
749 ------------------------------------
750
751 The criteria which are currently implemented are:
752
753 class::
754         Compares the window class (the second part of WM_CLASS)
755 instance::
756         Compares the window instance (the first part of WM_CLASS)
757 id::
758         Compares the X11 window ID, which you can get via +xwininfo+ for example.
759 title::
760         Compares the X11 window title (_NET_WM_NAME or WM_NAME as fallback).
761 mark::
762         Compares the mark set for this container, see <<vim_like_marks>>.
763 con_id::
764         Compares the i3-internal container ID, which you can get via the IPC
765         interface. Handy for scripting.
766
767 The criteria +class+, +instance+, +title+ and +mark+ are actually regular
768 expressions (PCRE). See +pcresyntax(3)+ or +perldoc perlre+ for information on
769 how to use them.
770
771 === Splitting containers
772
773 The split command makes the current window a split container. Split containers
774 can contain multiple windows. Every split container has an orientation, it is
775 either split horizontally (a new window gets placed to the right of the current
776 one) or vertically (a new window gets placed below the current one).
777
778 If you apply this command to a split container with the same orientation,
779 nothing will happen. If you use a different orientation, the split container’s
780 orientation will be changed (if it does not have more than one window).
781
782 *Syntax*:
783 ---------------------------
784 split <vertical|horizontal>
785 ---------------------------
786
787 *Example*:
788 ------------------------------
789 bindsym mod+v split vertical
790 bindsym mod+h split horizontal
791 ------------------------------
792
793 === Manipulating layout
794
795 Use +layout default+, +layout stacking+ or +layout tabbed+ to change the
796 current container layout to default, stacking or tabbed layout, respectively.
797
798 To make the current window (!) fullscreen, use +fullscreen+, to make
799 it floating (or tiling again) use +floating enable+ respectively +floating disable+
800 (or +floating toggle+):
801
802 *Examples*:
803 --------------
804 bindsym mod+s layout stacking
805 bindsym mod+l layout default
806 bindsym mod+w layout tabbed
807
808 # Toggle fullscreen
809 bindsym mod+f fullscreen
810
811 # Toggle floating/tiling
812 bindsym mod+t floating toggle
813 --------------
814
815 === Focusing/Moving containers
816
817 To change the focus, use the focus command: +focus left+, +focus right+, +focus down+ and +focus up+.
818
819 There are a few special parameters you can use for the focus command:
820
821 parent::
822         Sets focus to the +Parent Container+ of the current +Container+.
823 child::
824         The opposite of +focus parent+, sets the focus to the last focused
825         child container.
826 floating::
827         Sets focus to the last focused floating container.
828 tiling::
829         Sets focus to the last focused tiling container.
830 mode_toggle::
831         Toggles between floating/tiling containers.
832
833 For moving, use +move left+, +move right+, +move down+ and +move up+.
834
835 *Examples*:
836 ----------------------
837 # Focus clients on the left, bottom, top, right:
838 bindsym mod+j focus left
839 bindsym mod+k focus down
840 bindsym mod+l focus up
841 bindsym mod+semicolon focus right
842
843 # Focus parent container
844 bindsym mod+u focus parent
845
846 # Focus last floating/tiling container
847 bindsym mod+g focus mode_toggle
848
849 # Move client to the left, bottom, top, right:
850 bindsym mod+j move left
851 bindsym mod+k move down
852 bindsym mod+l move up
853 bindsym mod+semicolon move right
854 ----------------------
855
856 === Changing (named) workspaces/moving to workspaces
857
858 To change to a specific workspace, use the +workspace+ command, followed by the
859 number or name of the workspace. To move containers to specific workspaces, use
860 +move workspace+.
861
862 You can also switch to the next and previous workspace with the commands
863 +workspace next+ and +workspace prev+, which is handy, for example, if you have
864 workspace 1, 3, 4 and 9 and you want to cycle through them with a single key
865 combination.
866
867 To move a container to another xrandr output such as +LVDS1+ or +VGA1+, you can
868 use the +move output+ command followed by the name of the target output. You
869 may also use +left+, +right+, +up+, +down+ instead of the xrandr output name to
870 move to the the next output in the specified direction.
871
872 *Examples*:
873 -------------------------
874 bindsym mod+1 workspace 1
875 bindsym mod+2 workspace 2
876 ...
877
878 bindsym mod+Shift+1 move workspace 1
879 bindsym mod+Shift+2 move workspace 2
880 ...
881 -------------------------
882
883 ==== Named workspaces
884
885 Workspaces are identified by their name. So, instead of using numbers in the
886 workspace command, you can use an arbitrary name:
887
888 *Example*:
889 -------------------------
890 bindsym mod+1 workspace mail
891 ...
892 -------------------------
893
894 If you want the workspace to have a number *and* a name, just prefix the
895 number, like this:
896
897 *Example*:
898 -------------------------
899 bindsym mod+1 workspace 1: mail
900 bindsym mod+2 workspace 2: www
901 ...
902 -------------------------
903
904 Note that the workspace will really be named "1: mail". i3 treats workspace
905 names beginning with a number in a slightly special way. Normally, named
906 workspaces are ordered the way they appeared. When they start with a number, i3
907 will order them numerically.
908
909 [[resizingconfig]]
910
911 === Resizing containers/windows
912
913 If you want to resize containers/windows using your keyboard, you can use the
914 +resize+ command:
915
916 *Syntax*:
917 ---------------------------------------------------------
918 resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt]
919 ---------------------------------------------------------
920
921 Direction can be one of +up+, +down+, +left+ or +right+. The optional pixel
922 argument specifies by how many pixels a *floating container* should be grown or
923 shrinked (the default is 10 pixels). The ppt argument means percentage points
924 and specifies by how many percentage points a *tiling container* should be
925 grown or shrinked (the default is 10 percentage points).
926
927 I recommend using the resize command inside a so called +mode+:
928
929 .Example: Configuration file, defining a mode for resizing
930 ----------------------------------------------------------------------
931 mode "resize" {
932         # These bindings trigger as soon as you enter the resize mode
933
934         # They resize the border in the direction you pressed, e.g.
935         # when pressing left, the window is resized so that it has
936         # more space on its left
937
938         bindsym j resize shrink left
939         bindsym Shift+j resize grow left
940
941         bindsym k resize grow down
942         bindsym Shift+k resize shrink down
943
944         bindsym l resize shrink up
945         bindsym Shift+l resize grow up
946
947         bindsym semicolon resize grow right
948         bindsym Shift+semicolon resize shrink right
949
950         # back to normal: Enter or Escape
951         bindsym Return mode "default"
952         bindsym Escape mode "default"
953 }
954
955 # Enter resize mode
956 bindsym mod+r mode "resize"
957 ----------------------------------------------------------------------
958
959 === Jumping to specific windows
960
961 Often when in a multi-monitor environment, you want to quickly jump to a
962 specific window. For example, while working on workspace 3 you may want to
963 jump to your mail client to email your boss that you’ve achieved some
964 important goal. Instead of figuring out how to navigate to your mailclient,
965 it would be more convenient to have a shortcut. You can use the +focus+ command
966 with criteria for that.
967
968 *Syntax*:
969 ----------------------------------------------------
970 [class="class"] focus
971 [title="title"] focus
972 ----------------------------------------------------
973
974 *Examples*:
975 ------------------------------------------------
976 # Get me to the next open VIM instance
977 bindsym mod+a [class="urxvt" title="VIM"] focus
978 ------------------------------------------------
979
980 === VIM-like marks (mark/goto)
981
982 [[vim_like_marks]]
983
984 This feature is like the jump feature: It allows you to directly jump to a
985 specific window (this means switching to the appropriate workspace and setting
986 focus to the windows). However, you can directly mark a specific window with
987 an arbitrary label and use it afterwards.  You do not need to ensure that your
988 windows have unique classes or titles, and you do not need to change your
989 configuration file.
990
991 As the command needs to include the label with which you want to mark the
992 window, you cannot simply bind it to a key.  +i3-input+ is a tool created
993 for this purpose: It lets you input a command and sends the command to i3. It
994 can also prefix this command and display a custom prompt for the input dialog.
995
996 *Syntax*:
997 ------------------------------
998 mark identifier
999 [con_mark="identifier"] focus
1000 ------------------------------
1001
1002 *Example (in a terminal)*:
1003 ------------------------------
1004 $ i3-msg mark irssi
1005 $ i3-msg '[con_mark="irssi"] focus'
1006 ------------------------------
1007
1008 ///////////////////////////////////////////////////////////////////
1009 TODO: make i3-input replace %s
1010 *Examples*:
1011 ---------------------------------------
1012 # Read 1 character and mark the current window with this character
1013 bindsym mod+m exec i3-input -p 'mark ' -l 1 -P 'Mark: '
1014
1015 # Read 1 character and go to the window with the character
1016 bindsym mod+g exec i3-input -p 'goto ' -l 1 -P 'Goto: '
1017 ---------------------------------------
1018
1019 Alternatively, if you do not want to mess with +i3-input+, you could create
1020 seperate bindings for a specific set of labels and then only use those labels.
1021 ///////////////////////////////////////////////////////////////////
1022
1023 === Changing border style
1024
1025 To change the border of the current client, you can use +border normal+ to use the normal
1026 border (including window title), +border 1pixel+ to use a 1-pixel border (no window title)
1027 and +border none+ to make the client borderless.
1028
1029 There is also +border toggle+ which will toggle the different border styles.
1030
1031 *Examples*:
1032 ----------------------------
1033 bindsym mod+t border normal
1034 bindsym mod+y border 1pixel
1035 bindsym mod+u border none
1036 ----------------------------
1037
1038 [[stack-limit]]
1039
1040 ///////////////////////////////////////////////////////////////////////////////
1041 TODO: not yet implemented
1042 === Changing the stack-limit of a container
1043
1044 If you have a single container with a lot of windows inside it (say, more than
1045 10), the default layout of a stacking container can get a little unhandy.
1046 Depending on your screen’s size, you might end up with only half of the title
1047 lines being actually used, wasting a lot of screen space.
1048
1049 Using the +stack-limit+ command, you can limit the number of rows or columns
1050 in a stacking container. i3 will create columns or rows (depending on what
1051 you limited) automatically as needed.
1052
1053 *Syntax*:
1054 --------------------------------
1055 stack-limit <cols|rows> <value>
1056 --------------------------------
1057
1058 *Examples*:
1059 -------------------
1060 # I always want to have two window titles in one line
1061 stack-limit cols 2
1062
1063 # Not more than 5 rows in this stacking container
1064 stack-limit rows 5
1065 -------------------
1066
1067 image:stacklimit.png[Container limited to two columns]
1068 ///////////////////////////////////////////////////////////////////////////////
1069
1070 === Reloading/Restarting/Exiting
1071
1072 You can make i3 reload its configuration file with +reload+. You can also
1073 restart i3 inplace with the +restart+ command to get it out of some weird state
1074 (if that should ever happen) or to perform an upgrade without having to restart
1075 your X session. To exit i3 properly, you can use the +exit+ command,
1076 however you don’t need to (simply killing your X session is fine as well).
1077
1078 *Examples*:
1079 ----------------------------
1080 bindsym mod+Shift+r restart
1081 bindsym mod+Shift+w reload
1082 bindsym mod+Shift+e exit
1083 ----------------------------
1084
1085 [[multi_monitor]]
1086
1087 == Multiple monitors
1088
1089 As you can see in the goal list on the website, i3 was specifically developed
1090 with support for multiple monitors in mind. This section will explain how to
1091 handle multiple monitors.
1092
1093 When you have only one monitor, things are simple. You usually start with
1094 workspace 1 on your monitor and open new ones as you need them.
1095
1096 When you have more than one monitor, each monitor will get an initial
1097 workspace.  The first monitor gets 1, the second gets 2 and a possible third
1098 would get 3. When you switch to a workspace on a different monitor, i3 will
1099 switch to that monitor and then switch to the workspace. This way, you don’t
1100 need shortcuts to switch to a specific monitor, and you don’t need to remember
1101 where you put which workspace. New workspaces will be opened on the currently
1102 active monitor.  It is not possible to have a monitor without a workspace.
1103
1104 The idea of making workspaces global is based on the observation that most
1105 users have a very limited set of workspaces on their additional monitors.
1106 They are often used for a specific task (browser, shell) or for monitoring
1107 several things (mail, IRC, syslog, …). Thus, using one workspace on one monitor
1108 and "the rest" on the other monitors often makes sense. However, as you can
1109 create an unlimited number of workspaces in i3 and tie them to specific
1110 screens, you can have the "traditional" approach of having X workspaces per
1111 screen by changing your configuration (using modes, for example).
1112
1113 === Configuring your monitors
1114
1115 To help you get going if you have never used multiple monitors before, here is
1116 a short overview of the xrandr options which will probably be of interest to
1117 you. It is always useful to get an overview of the current screen configuration.
1118 Just run "xrandr" and you will get an output like the following:
1119 -------------------------------------------------------------------------------
1120 $ xrandr
1121 Screen 0: minimum 320 x 200, current 1280 x 800, maximum 8192 x 8192
1122 VGA1 disconnected (normal left inverted right x axis y axis)
1123 LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm
1124    1280x800       60.0*+   50.0
1125    1024x768       85.0     75.0     70.1     60.0
1126    832x624        74.6
1127    800x600        85.1     72.2     75.0     60.3     56.2
1128    640x480        85.0     72.8     75.0     59.9
1129    720x400        85.0
1130    640x400        85.1
1131    640x350        85.1
1132 --------------------------------------------------------------------------------------
1133
1134 Several things are important here: You can see that +LVDS1+ is connected (of
1135 course, it is the internal flat panel) but +VGA1+ is not. If you have a monitor
1136 connected to one of the ports but xrandr still says "disconnected", you should
1137 check your cable, monitor or graphics driver.
1138
1139 The maximum resolution you can see at the end of the first line is the maximum
1140 combined resolution of your monitors. By default, it is usually too low and has
1141 to be increased by editing +/etc/X11/xorg.conf+.
1142
1143 So, say you connected VGA1 and want to use it as an additional screen:
1144 -------------------------------------------
1145 xrandr --output VGA1 --auto --left-of LVDS1
1146 -------------------------------------------
1147 This command makes xrandr try to find the native resolution of the device
1148 connected to +VGA1+ and configures it to the left of your internal flat panel.
1149 When running "xrandr" again, the output looks like this:
1150 -------------------------------------------------------------------------------
1151 $ xrandr
1152 Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 8192 x 8192
1153 VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
1154    1280x1024      60.0*+   75.0
1155    1280x960       60.0
1156    1152x864       75.0
1157    1024x768       75.1     70.1     60.0
1158    832x624        74.6
1159    800x600        72.2     75.0     60.3     56.2
1160    640x480        72.8     75.0     66.7     60.0
1161    720x400        70.1
1162 LVDS1 connected 1280x800+1280+0 (normal left inverted right x axis y axis) 261mm x 163mm
1163    1280x800       60.0*+   50.0
1164    1024x768       85.0     75.0     70.1     60.0
1165    832x624        74.6
1166    800x600        85.1     72.2     75.0     60.3     56.2
1167    640x480        85.0     72.8     75.0     59.9
1168    720x400        85.0
1169    640x400        85.1
1170    640x350        85.1
1171 -------------------------------------------------------------------------------
1172 Please note that i3 uses exactly the same API as xrandr does, so it will see
1173 only what you can see in xrandr.
1174
1175 See also <<presentations>> for more examples of multi-monitor setups.
1176
1177 === Interesting configuration for multi-monitor environments
1178
1179 There are several things to configure in i3 which may be interesting if you
1180 have more than one monitor:
1181
1182 1. You can specify which workspace should be put on which screen. This
1183    allows you to have a different set of workspaces when starting than just
1184    1 for the first monitor, 2 for the second and so on. See
1185    <<workspace_screen>>.
1186 2. If you want some applications to generally open on the bigger screen
1187    (MPlayer, Firefox, …), you can assign them to a specific workspace, see
1188    <<assign_workspace>>.
1189 3. If you have many workspaces on many monitors, it might get hard to keep
1190    track of which window you put where. Thus, you can use vim-like marks to
1191    quickly switch between windows. See <<vim_like_marks>>.
1192
1193 == i3 and the rest of your software world
1194
1195 === Displaying a status line
1196
1197 A very common thing amongst users of exotic window managers is a status line at
1198 some corner of the screen. It is an often superior replacement to the widget
1199 approach you have in the task bar of a traditional desktop environment.
1200
1201 If you don’t already have your favorite way of generating such a status line
1202 (self-written scripts, conky, …), then i3status is the recommended tool for
1203 this task. It was written in C with the goal of using as few syscalls as
1204 possible to reduce the time your CPU is woken up from sleep states. Because
1205 i3status only spits out text, you need to combine it with some other tool, like
1206 i3bar. Use a pipe to connect them: +i3status | i3bar -d+.
1207
1208 Regardless of which application you use to display the status line, you
1209 want to make sure that it registers as a dock window using EWMH hints. i3 will
1210 position the window either at the top or at the bottom of the screen, depending
1211 on which hint the application sets. With i3bar, you can use +-d+ or +-dbottom+
1212 for positioning it at the bottom and +-dtop+ to position it at the top of the
1213 screen.
1214
1215 === Giving presentations (multi-monitor)
1216
1217 When giving a presentation, you typically want the audience to see what you see
1218 on your screen and then go through a series of slides (if the presentation is
1219 simple). For more complex presentations, you might want to have some notes
1220 which only you can see on your screen, while the audience can only see the
1221 slides.
1222
1223 [[presentations]]
1224 ==== Case 1: everybody gets the same output
1225 This is the simple case. You connect your computer to the video projector,
1226 turn on both (computer and video projector) and configure your X server to
1227 clone the internal flat panel of your computer to the video output:
1228 -----------------------------------------------------
1229 xrandr --output VGA1 --mode 1024x768 --same-as LVDS1
1230 -----------------------------------------------------
1231 i3 will then use the lowest common subset of screen resolutions, the rest of
1232 your screen will be left untouched (it will show the X background). So, in
1233 our example, this would be 1024x768 (my notebook has 1280x800).
1234
1235 ==== Case 2: you can see more than your audience
1236 This case is a bit harder. First of all, you should configure the VGA output
1237 somewhere near your internal flat panel, say right of it:
1238 -----------------------------------------------------
1239 xrandr --output VGA1 --mode 1024x768 --right-of LVDS1
1240 -----------------------------------------------------
1241 Now, i3 will put a new workspace (depending on your settings) on the new screen
1242 and you are in multi-monitor mode (see <<multi_monitor>>).
1243
1244 Because i3 is not a compositing window manager, there is no ability to
1245 display a window on two screens at the same time. Instead, your presentation
1246 software needs to do this job (that is, open a window on each screen).