]> git.sur5r.net Git - i3/i3.github.io/blobdiff - _docs/userguide
update /docs for 4.3
[i3/i3.github.io] / _docs / userguide
index 4145279302eff8368eaf01d353a8add6840d8d49..2214f016522764598a3f7517cee285cf735c228e 100644 (file)
@@ -1,11 +1,11 @@
 i3 User’s Guide
 ===============
-Michael Stapelberg <michael+i3@stapelberg.de>
-April 2012
+Michael Stapelberg <michael@i3wm.org>
+August 2012
 
 This document contains all the information you need to configure and use the i3
-window manager. If it does not, please contact us on IRC (preferred) or post your
-question(s) on the mailing list.
+window manager. If it does not, please check http://faq.i3wm.org/ first, then
+contact us on IRC (preferred) or post your question(s) on the mailing list.
 
 == Default keybindings
 
@@ -61,16 +61,18 @@ windows.
 
 TODO: picture of the tree
 
-To split a window vertically, press +mod+v+. To split it horizontally, press
-+mod+h+.
+To split a window vertically, press +mod+v+ before you create the new window.
+To split it horizontally, press +mod+h+.
 
 === Changing the container layout
 
 A split container can have one of the following layouts:
 
-default::
+splith/splitv::
 Windows are sized so that every window gets an equal amount of space in the
-container.
+container. splith distributes the windows horizontally (windows are right next
+to each other), splitv distributes them vertically (windows are on top of each
+other).
 stacking::
 Only the focused window in the container is displayed. You get a list of
 windows at the top of the container.
@@ -78,8 +80,8 @@ tabbed::
 The same principle as +stacking+, but the list of windows at the top is only
 a single line which is vertically split.
 
-To switch modes, press +mod+e+ for default, +mod+s+ for stacking and
-+mod+w+ for tabbed.
+To switch modes, press +mod+e+ for splith/splitv (it toggles), +mod+s+ for
+stacking and +mod+w+ for tabbed.
 
 image:modes.png[Container modes]
 
@@ -196,20 +198,21 @@ image::tree-shot4.png["shot4",title="Two terminals on standard workspace"]
 
 It is only natural to use so-called +Split Containers+ in order to build a
 layout when using a tree as data structure. In i3, every +Container+ has an
-orientation (horizontal, vertical or unspecified). So, in our example with the
-workspace, the default orientation of the workspace +Container+ is horizontal
-(most monitors are widescreen nowadays). If you change the orientation to
-vertical (+mod+v+ in the default config) and *then* open two terminals, i3 will
-configure your windows like this:
+orientation (horizontal, vertical or unspecified) and the orientation depends
+on the layout the container is in (vertical for splitv and stacking, horizontal
+for splith and tabbed). So, in our example with the workspace, the default
+layout of the workspace +Container+ is splith (most monitors are widescreen
+nowadays). If you change the layout to splitv (+mod+l+ in the default config)
+and *then* open two terminals, i3 will configure your windows like this:
 
 image::tree-shot2.png["shot2",title="Vertical Workspace Orientation"]
 
-An interesting new feature of the tree branch is the ability to split anything:
-Let’s assume you have two terminals on a workspace (with horizontal
-orientation), focus is on the right terminal. Now you want to open another
-terminal window below the current one. If you would just open a new terminal
-window, it would show up to the right due to the horizontal workspace
-orientation. Instead, press +mod+v+ to create a +Vertical Split Container+ (to
+An interesting new feature of i3 since version 4 is the ability to split anything:
+Let’s assume you have two terminals on a workspace (with splith layout, that is
+horizontal orientation), focus is on the right terminal. Now you want to open
+another terminal window below the current one. If you would just open a new
+terminal window, it would show up to the right due to the splith layout.
+Instead, press +mod+v+ to split the container with the splitv layout (to
 open a +Horizontal Split Container+, use +mod+h+). Now you can open a new
 terminal and it will open below the current one:
 
@@ -235,6 +238,24 @@ windows will be opened to the right of the +Vertical Split Container+:
 
 image::tree-shot3.png["shot3",title="Focus parent, then open new terminal"]
 
+=== Implicit containers
+
+In some cases, i3 needs to implicitly create a container to fulfill your
+command.
+
+One example is the following scenario: You start i3 with a single monitor and a
+single workspace on which you open three terminal windows. All these terminal
+windows are directly attached to one node inside i3’s layout tree, the
+workspace node. By default, the workspace node’s orientation is +horizontal+.
+
+Now you move one of these terminals down (+mod+k+ by default). The workspace
+node’s orientation will be changed to +vertical+. The terminal window you moved
+down is directly attached to the workspace and appears on the bottom of the
+screen. A new (horizontal) container was created to accomodate the other two
+terminal windows. You will notice this when switching to tabbed mode (for
+example). You would end up having one tab called "another container" and the
+other one being the terminal window you moved down.
+
 [[configuring]]
 == Configuring i3
 
@@ -273,11 +294,21 @@ a # and can only be used at the beginning of a line:
 # This is a comment
 -------------------
 
+[[fonts]]
+
 === Fonts
 
-i3 uses X core fonts (not Xft) for rendering window titles. You can use
-+xfontsel(1)+ to generate such a font description. To see special characters
-(Unicode), you need to use a font which supports the ISO-10646 encoding.
+i3 has support for both X core fonts and FreeType fonts (through Pango) to
+render window titles.
+
+To generate an X core font description, you can use +xfontsel(1)+. To see
+special characters (Unicode), you need to use a font which supports the
+ISO-10646 encoding.
+
+A FreeType font description is composed by a font family, a style, a weight,
+a variant, a stretch and a size.
+FreeType fonts support right-to-left rendering and contain often more
+Unicode glyphs than X core fonts.
 
 If i3 cannot open the configured font, it will output an error in the logfile
 and fall back to a working font.
@@ -285,11 +316,13 @@ and fall back to a working font.
 *Syntax*:
 ------------------------------
 font <X core font description>
+font xft:<a FreeType font description>
 ------------------------------
 
 *Examples*:
 --------------------------------------------------------------
 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+font xft:DejaVu Sans Mono 10
 --------------------------------------------------------------
 
 [[keybindings]]
@@ -315,10 +348,15 @@ your bindings in the same physical location on the keyboard, use keycodes.
 If you don’t switch layouts, and want a clean and simple config file, use
 keysyms.
 
+Some tools (such as +import+ or +xdotool+) might be unable to run upon a
+KeyPress event, because the keyboard/pointer is still grabbed. For these
+situations, the +--release+ flag can be used, which will execute the command
+after the keys have been released.
+
 *Syntax*:
 ----------------------------------
-bindsym [Modifiers+]keysym command
-bindcode [Modifiers+]keycode command
+bindsym [--release] [Modifiers+]keysym command
+bindcode [--release] [Modifiers+]keycode command
 ----------------------------------
 
 *Examples*:
@@ -330,7 +368,13 @@ bindsym mod+f fullscreen
 bindsym mod+Shift+r restart
 
 # Notebook-specific hotkeys
-bindcode 214 exec /home/michael/toggle_beamer.sh
+bindcode 214 exec --no-startup-id /home/michael/toggle_beamer.sh
+
+# Simulate ctrl+v upon pressing $mod+x
+bindsym --release $mod+x exec --no-startup-id xdotool key --clearmodifiers ctrl+v
+
+# Take a screenshot upon pressing $mod+x (select an area)
+bindsym --release $mod+x exec --no-startup-id import /tmp/latest-screenshot.png
 --------------------------------
 
 Available Modifiers:
@@ -434,7 +478,8 @@ workspace_layout tabbed
 
 === Border style for new windows
 
-This option determines which border style new windows will have.
+This option determines which border style new windows will have. The default is
+"normal".
 
 *Syntax*:
 ---------------------------------------------
@@ -446,6 +491,22 @@ new_window <normal|1pixel|none>
 new_window 1pixel
 ---------------------
 
+=== Hiding vertical borders
+
+You can hide vertical borders adjacent to the screen edges using
++hide_edge_borders+. This is useful if you are using scrollbars, or do not want
+to waste even two pixels in displayspace. Default is none.
+
+*Syntax*:
+----------------------------
+hide_edge_borders <none|vertical|horizontal|both>
+----------------------------
+
+*Example*:
+----------------------
+hide_edge_borders vertical
+----------------------
+
 === Arbitrary commands for specific windows (for_window)
 
 With the +for_window+ command, you can let i3 execute any command when it
@@ -554,6 +615,22 @@ logfile first (see http://i3wm.org/docs/debugging.html). It includes more
 details about the matching process and the window’s actual class, instance and
 title when starting up.
 
+Note that if you want to start an application just once on a specific
+workspace, but you don’t want to assign all instances of it permanently, you
+can make use of i3’s startup-notification support (see <<exec>>) in your config
+file in the following way:
+
+*Start iceweasel on workspace 3 (once)*:
+-------------------------------------------------------------------------------
+# Start iceweasel on workspace 3, then switch back to workspace 1
+# (Being a command-line utility, i3-msg does not support startup notifications,
+#  hence the exec --no-startup-id.)
+# (Starting iceweasel with i3’s exec command is important in order to make i3
+#  create a startup notification context, without which the iceweasel window(s)
+#  cannot be matched onto the workspace on which the command was started.)
+exec --no-startup-id i3-msg 'workspace 3; exec iceweasel; workspace 1'
+-------------------------------------------------------------------------------
+
 === Automatically starting applications on i3 startup
 
 By using the +exec+ keyword outside a keybinding, you can configure
@@ -691,11 +768,12 @@ the next section.
 
 === Focus follows mouse
 
-If you have a setup where your mouse usually is in your way (like a touchpad
-on your laptop which you do not want to disable completely), you might want
-to disable 'focus follows mouse' and control focus only by using your keyboard.
-The mouse will still be useful inside the currently active window (for example
-to click on links in your browser window).
+By default, window focus follows your mouse movements. However, if you have a
+setup where your mouse usually is in your way (like a touchpad on your laptop
+which you do not want to disable completely), you might want to disable 'focus
+follows mouse' and control focus only by using your keyboard.  The mouse will
+still be useful inside the currently active window (for example to click on
+links in your browser window).
 
 *Syntax*:
 ----------------------------
@@ -990,8 +1068,7 @@ xrandr --output <output> --primary
 
 === Font
 
-Specifies the font (again, X core font, not Xft, just like in i3) to be used in
-the bar.
+Specifies the font to be used in the bar. See <<fonts>>.
 
 *Syntax*:
 ---------------------
@@ -1002,6 +1079,7 @@ font <font>
 --------------------------------------------------------------
 bar {
     font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+    font xft:DejaVu Sans Mono 10
 }
 --------------------------------------------------------------
 
@@ -1170,13 +1248,15 @@ cursor for 60 seconds.
 === Splitting containers
 
 The split command makes the current window a split container. Split containers
-can contain multiple windows. Every split container has an orientation, it is
-either split horizontally (a new window gets placed to the right of the current
-one) or vertically (a new window gets placed below the current one).
+can contain multiple windows. Depending on the layout of the split container,
+new windows get placed to the right of the current one (splith) or new windows
+get placed below the current one (splitv).
 
 If you apply this command to a split container with the same orientation,
 nothing will happen. If you use a different orientation, the split container’s
-orientation will be changed (if it does not have more than one window).
+orientation will be changed (if it does not have more than one window). Use
++layout toggle split+ to change the layout of any split container from splitv
+to splith or vice-versa.
 
 *Syntax*:
 ---------------------------
@@ -1191,19 +1271,32 @@ bindsym mod+h split horizontal
 
 === Manipulating layout
 
-Use +layout default+, +layout stacking+ or +layout tabbed+ to change the
-current container layout to default, stacking or tabbed layout, respectively.
+Use +layout toggle split+, +layout stacking+ or +layout tabbed+ to change the
+current container layout to splith/splitv, stacking or tabbed layout,
+respectively.
 
 To make the current window (!) fullscreen, use +fullscreen+, to make
 it floating (or tiling again) use +floating enable+ respectively +floating disable+
 (or +floating toggle+):
 
+*Syntax*:
+--------------
+layout <tabbed|stacking>
+layout toggle [split|all]
+--------------
+
 *Examples*:
 --------------
 bindsym mod+s layout stacking
-bindsym mod+l layout default
+bindsym mod+l layout toggle split
 bindsym mod+w layout tabbed
 
+# Toggle between stacking/tabbed/split:
+bindsym mod+x layout toggle
+
+# Toggle between stacking/tabbed/splith/splitv:
+bindsym mod+x layout toggle all
+
 # Toggle fullscreen
 bindsym mod+f fullscreen
 
@@ -1293,22 +1386,28 @@ You can also switch to the next and previous workspace with the commands
 workspace 1, 3, 4 and 9 and you want to cycle through them with a single key
 combination. To restrict those to the current output, use +workspace
 next_on_output+ and +workspace prev_on_output+. Similarly, you can use +move
-container to workspace next+ and +move container to workspace prev+ to move a
-container to the next/previous workspace.
+container to workspace next+, +move container to workspace prev+ to move a
+container to the next/previous workspace and +move container to workspace current+
+(the last one makes sense only when used with criteria).
+
+See <<move_to_outputs>> for how to move a container/workspace to a different
+RandR output.
 
 [[back_and_forth]]
 To switch back to the previously focused workspace, use +workspace
 back_and_forth+.
 
-To move a container to another xrandr output such as +LVDS1+ or +VGA1+, you can
-use the +move container to output+ command followed by the name of the target
-output. You may also use +left+, +right+, +up+, +down+ instead of the xrandr
-output name to move to the next output in the specified direction.
-
-To move a whole workspace to another xrandr output such as +LVDS1+ or +VGA1+,
-you can use the +move workspace to output+ command followed by the name of the
-target output. You may also use +left+, +right+, +up+, +down+ instead of the
-xrandr output name to move to the next output in the specified direction.
+*Syntax*:
+-----------------------------------
+workspace <next|prev|next_on_output|prev_on_output>
+workspace back_and_forth
+workspace <name>
+workspace number <number>
+
+move [window|container] [to] workspace <name>
+move [window|container] [to] workspace number <number>
+move [window|container] [to] workspace <prev|next|current>
+-----------------------------------
 
 *Examples*:
 -------------------------
@@ -1325,6 +1424,9 @@ bindsym mod+b workspace back_and_forth
 
 # move the whole workspace to the next output
 bindsym mod+x move workspace to output right
+
+# move firefox to current workspace
+bindsym mod+F1 [class="Firefox"] move workspace current
 -------------------------
 
 ==== Named workspaces
@@ -1356,7 +1458,7 @@ to switch to the workspace which begins with number 1, regardless of which name
 it has. This is useful in case you are changing the workspace’s name
 dynamically.
 
-=== Renaming workspaces
+==== Renaming workspaces
 
 You can rename workspaces. This might be useful to start with the default
 numbered workspaces, do your work, and rename the workspaces afterwards to
@@ -1374,6 +1476,30 @@ i3-msg 'rename workspace 1 to "1: www"'
 i3-msg 'rename workspace "1: www" to "10: www"'
 ------------------------------------------------
 
+=== Moving containers/workspaces to RandR outputs
+
+[[move_to_outputs]]
+
+To move a container to another RandR output (addressed by names like +LVDS1+ or
++VGA1+) or to a RandR output identified by a specific direction (like +left+,
++right+, +up+ or +down+), there are two commands:
+
+*Syntax*:
+--------------------------------------------------------
+move container to output <<left|right|down|up>|<output>>
+move workspace to output <<left|right|down|up>|<output>>
+--------------------------------------------------------
+
+*Examples*:
+--------------------------------------------------------
+# Move the current workspace to the next output
+# (effectively toggles when you only have two outputs)
+bindsym mod+x move workspace to output right
+
+# Put this window on the presentation output.
+bindsym mod+x move container to output VGA1
+--------------------------------------------------------
+
 [[resizingconfig]]
 
 === Resizing containers/windows