Difference between revisions of "I3"

From ArchWiki
Jump to: navigation, search
(Undo revision 241964 by AlexanderR (talk))
m (fixed typo)
(17 intermediate revisions by 7 users not shown)
Line 5: Line 5:
 
[http://i3wm.org/ i3] is a dynamic [[Wikipedia:Tiling window manager|tiling window manager]] inspired by [[wmii]] that is primarily targeted at developers and advanced users.
 
[http://i3wm.org/ i3] is a dynamic [[Wikipedia:Tiling window manager|tiling window manager]] inspired by [[wmii]] that is primarily targeted at developers and advanced users.
  
== Introduction ==
+
Clients (windows) are organized in a tree data structure within containers. The tree branches via horizontal or vertical splits, and containers can also be set to tabbed or stacked layouts. Floating windows are available for corner cases that don't mix well with tiling, and remain on a separate layer above the tiled windows.
The developers' attempt to hack and fix [[wmii]] led to the creation of i3. At the time Wmii didn't provide certain features, like support for [[Wikipedia:Xinerama|Xinerama]], and lacked source code comments and documentation.
+
 
+
Clients within i3 are either allowed to float or placed into containers. Clients can be stacked or tabbed within containers.  
+
  
 
== Installation ==
 
== Installation ==
i3 is located in the {{ic|[[community]]}} repository. Installing i3 can be accomplished by choosing the {{Pkg|i3}} group, which includes the packages {{Pkg|i3lock}}, {{Pkg|i3status}} and {{Pkg|i3-wm}}. Alternatively, you can install the window manager ({{Pkg|i3-wm}}) exclusively.
+
Install the {{Pkg|i3}} [[Pacman#Installing package groups|package group]] from the [[official repositories]], which includes the {{Pkg|i3lock}}, {{Pkg|i3status}} and {{Pkg|i3-wm}} packages. Install {{ic|i3-wm}} for the window manger, {{ic|i3status}} to write a status line to i3bar through [[Wikipedia:Standard streams#Standard output (stdout)|stdout]], or {{ic|i3lock}} for an improved screenlocker.
  
A status line is provided by piping text to i3bar, with {{Pkg|i3status}} or any other program that writes a statusline to stdout.
+
Additional packages are available in the [[Arch User Repository]]. Install {{AUR|i3-git}} for the development version. Install {{AUR|i3-gnome}} to add a [[GNOME]]-session.
  
Additionally, {{AUR|i3-git}} is available in the [[AUR]].
+
== Configuration ==
 
+
For gnome users, see {{AUR|i3-gnome}} in [[AUR]] to add a i3 gnome session (gtk theme, gnome-keyring, notifications, gnome online accounts).
+
 
+
==Running i3==
+
  
 
Edit your {{ic|~/.xinitrc}} and add:
 
Edit your {{ic|~/.xinitrc}} and add:
Line 28: Line 21:
 
  exec i3 --force-xinerama
 
  exec i3 --force-xinerama
  
== Basic Keybindings and Window Management ==
+
=== Status bar ===
The default keybindings mostly depend on Mod1 (usually mapped to Alt) or Mod3/Mod4 (usually mapped to the Windows key) as the basic modifier key sometimes combined with Ctrl or Shift. To identify the different Mod# keys on your system, use the
+
command {{ic|xmodmap}} without arguments.
+
 
+
The key combinations are configured in the file {{ic|~/.i3/config}} (or, if it does not exist, {{ic|/etc/i3/config}}).
+
 
+
The default key combinations rely on key codes and not on the actual letters of your keyboard layout! You can replace the {{ic|bind}} directives in the config with {{ic|bindsym}} directives if you do not like this. For more info on configuration see the next section.
+
 
+
Some of the most important keybindings include the following:
+
* Run a program: Mod1+d
+
* Create a new terminal: Mod1+Enter
+
* Switch between different windows: Mod1+ any of "jkl;" or cursor keys  (somewhat Vim-like keybindings)
+
* Move a window: Mod1+Shift+ any of "jkl;" or cursor keys
+
* Switch to a different workspace: Mod1+ any number
+
* Move window to a different workspace: Mod1+Shift+ any number
+
 
+
Note that i3 uses containers for window management. So in contrast to [[Wmii]] you can also tile windows horizontally. To do this, simply move a window up or down (with Mod1+Shift+DirectionKey) beyond the edge of the screen. A new row will appear. You can then use Mod4+Ctrl+DirectionKey to enlarge the window into the chosen direction. DirectionKey can be the arrow keys as well as "jkl;".
+
 
+
There are 3 container modes:
+
* Normal (columns): Mod1+e
+
* Tabbed: Mod1+w
+
* Stacked: Mod1+s
+
 
+
Additionally, you can put a window into fullscreen mode with Mod1+f.
+
 
+
[http://i3wm.org/docs/refcard.pdf i3 keybinding cheatsheet (pdf)]
+
 
+
== Configuration ==
+
 
+
i3 is configured using a simple text file.  It first looks for {{ic|~/.i3/config}} and if it doesn't exist, reads the default config at {{ic|/etc/i3/config}}.  So to start customizing, copy the config file to your home directory:
+
cp /etc/i3/config ~/.i3/config
+
The config allows you to change such things as:
+
*Terminal emulator (see [http://buildbot.i3wm.org/docs/i3-sensible-terminal.html i3-sensible-terminal])
+
*Border colors
+
*Font
+
*Keybindings
+
*Workspace names
+
*Default container layout
+
*Assignment of apps to specific workspaces
+
 
+
The i3 [http://i3wm.org/docs/userguide.html User's Guide] gives a nice overview of the config settings.
+
 
+
For users seeking to convert their configuration to v4, i3-wm comes with a perl script for conversion:
+
{{bc|mv config config.old #save the old file
+
i3-migrate-config-to-v4 config.old > config
+
}}
+
Have a look at the changes!
+
 
+
== Status bar ==
+
 
The internal status bar, i3-''ws''bar, was deprecated and replaced by i3bar in i3 v4.0.
 
The internal status bar, i3-''ws''bar, was deprecated and replaced by i3bar in i3 v4.0.
  
=== New method: i3bar ===
+
==== New method: i3bar ====
Unlike i3-wsbar, which requires dzen2, i3bar does not have any dependecies other than {{Pkg|i3-wm}}.  It can be used to view information generated by [[conky]] or i3status. For example (as of version 4.1):
+
Unlike i3-wsbar, which requires dzen2, i3bar does not have any dependencies other than {{Pkg|i3-wm}}.  It can be used to view information generated by [[conky]] or i3status. For example (as of version 4.1):
 
{{hc|~/.i3/config|<nowiki>
 
{{hc|~/.i3/config|<nowiki>
 
bar {
 
bar {
Line 106: Line 51:
 
For further information see the [http://i3wm.org/docs/userguide.html#_configuring_i3bar Configuring i3bar] section of the official User Guide.
 
For further information see the [http://i3wm.org/docs/userguide.html#_configuring_i3bar Configuring i3bar] section of the official User Guide.
  
=== Old method: i3-wsbar and dzen ===
+
==== Comparison of i3bar and dzen2 ====
[[Dzen]] can be placed in the status bar at the bottom of the screen. Information for dzen2 can be generated using {{Pkg|i3status}}
+
i3status | dzen2 &
+
or {{Pkg|conky}}
+
conky | dzen2 &
+
The svn development version of [https://aur.archlinux.org/packages.php?ID=19926 dzen2] in the [[AUR]] offers a {{ic|-dock}} option, which puts dzen2 at the bottom of the screen and tells i3 not to manage it.
+
 
+
In the AUR you can also find {{AUR|i3-wsbar}}, which is able to get the list of workspaces from the socket that i3 offers for IPC. Thus you can pipe the conky output to i3-wsbar and tell it to use dzen2. For example, put the following in your i3 configuration file:
+
{{hc|~/.i3/config|<nowiki>exec conky | i3-wsbar -c "dzen2 -x %x -dock -fn -*-profont-*-*-*-*-11-*-*-*-*-*-*-* -ta l"</nowiki>}}
+
 
+
For further information see ''[http://i3wm.org/docs/wsbar.html External workspace bars]''.
+
 
+
{{note|Dzen color codes can be used in your conky configuration file.}}
+
 
+
=== Comparison of i3bar and dzen2 ===
+
 
This comparison of i3bar and dzen2 only takes into account how well the two programs can handle the input from conky or i3status.
 
This comparison of i3bar and dzen2 only takes into account how well the two programs can handle the input from conky or i3status.
 
{| border="1" cellpadding="5" align="center"
 
{| border="1" cellpadding="5" align="center"
Line 133: Line 64:
 
Though development of i3bar is very active and support for custom formatting and fonts has been announced, dzen2-svn has an edge over i3bar (as of August 7th).
 
Though development of i3bar is very active and support for custom formatting and fonts has been announced, dzen2-svn has an edge over i3bar (as of August 7th).
  
== Other tools ==
+
==== Alternatives ====
i3 currently uses [[dmenu]] as a application launcher, which is bound by default to {{Keypress|Mod1|background=#FF0}}+{{Keypress|d}}.  
+
* [https://github.com/enkore/i3pystatus i3pystatus] - extensible i3status replacement with many modules and very flexible configuration. Multi-threaded and lock-up free.
 +
* [https://github.com/ultrabug/py3status py3status] – an extensible i3status wrapper written in python
 +
 
 +
=== Quickly jumping to open window ===
 +
* [https://github.com/proxypoke/quickswitch-for-i3 quickswitch-for-i3] – A Python utility to quickly change to and locate windows in i3
 +
* [https://github.com/yiuin/i3-wm-scripts i3-wm-scripts] – search for and jump to windows with particular names matching regexp
 +
* [https://github.com/ziberna/i3-py/tree/master/examples#winmenupy winmenupy] launches dmenu with a list of clients, sorted after workspaces. Selecting a client jumps to that window.
 +
 
 +
== Suspending with i3lock ==
 +
You need to add unit file below and enable it with {{ic|# systemctl enable suspend@<user>.service}}.
 +
 
 +
{{hc|/etc/systemd/system/suspend@.service|2=<nowiki>
 +
[Unit]
 +
Description=Starts i3lock at suspend time
 +
Before=sleep.target
 +
 
 +
[Service]
 +
User=%I
 +
Type=forking
 +
Environment=DISPLAY=:0
 +
ExecStartPre=
 +
ExecStart=/usr/bin/i3lock
 +
 
 +
[Install]
 +
WantedBy=sleep.target</nowiki>}}
 +
 
 +
== Usage ==
 +
{{Box BLUE||See the [http://i3wm.org/docs official documentation] on this subject for more information: [http://i3wm.org/docs/userguide.html i3 User’s Guide]}}
 +
 
 +
i3 currently uses [[dmenu]] as a application launcher, which is bound by default to {{Keypress|Mod1|background=#FF0}}+{{Keypress|d}}.
 +
 
 +
=== Clipboard (copy & paste issues) ===
  
{{Pkg|i3lock}} is a screen locker inspired by {{Pkg|slock}}.
+
By default, when you close a window, the buffer with the clipboard info will dissapear. You have to use a clipboard manager like "Parcellite" to avoid that.
  
== Additional sources ==
+
== See also ==
 
* [[Comparison of Tiling Window Managers]]
 
* [[Comparison of Tiling Window Managers]]
* [http://i3wm.org/docs/ Official i3 Documentation]
+
* [http://i3wm.org Official website]
* [https://bbs.archlinux.org/viewtopic.php?id=99064 The i3 thread]
+
* [http://code.stapelberg.de/git/i3 Source code]
 +
* [https://wiki.archlinux.org/index.php/Systemd#Suspend.2Fresume_service_files Suspend/resume service files]
 +
* [https://github.com/ashinkarov/i3-extras Collection of scripts and patches]
 +
'''Arch Linux Forums'''
 +
* [https://bbs.archlinux.org/viewtopic.php?id=99064 ''The i3 thread''] - A general discussion about i3
 +
* [https://bbs.archlinux.org/viewtopic.php?pid=1229978 ''i3 desktop screenshots and config sharing'']

Revision as of 00:23, 29 April 2013

i3 is a dynamic tiling window manager inspired by wmii that is primarily targeted at developers and advanced users.

Clients (windows) are organized in a tree data structure within containers. The tree branches via horizontal or vertical splits, and containers can also be set to tabbed or stacked layouts. Floating windows are available for corner cases that don't mix well with tiling, and remain on a separate layer above the tiled windows.

Installation

Install the i3 package group from the official repositories, which includes the i3lock, i3status and i3-wm packages. Install i3-wm for the window manger, i3status to write a status line to i3bar through stdout, or i3lock for an improved screenlocker.

Additional packages are available in the Arch User Repository. Install i3-gitAUR for the development version. Install i3-gnomeAUR to add a GNOME-session.

Configuration

Edit your ~/.xinitrc and add:

exec i3

If you want i3 to log its output (useful for debugging), add this line to ~/.xinitrc:

exec i3 -V >> ~/.i3/i3log 2>&1

If you use the Nvidia binary driver <302.17 you need to add the --force-xinerama flag to ~/.xinitrc. A detailed explanation can be found at i3wm.org.

exec i3 --force-xinerama

Status bar

The internal status bar, i3-wsbar, was deprecated and replaced by i3bar in i3 v4.0.

New method: i3bar

Unlike i3-wsbar, which requires dzen2, i3bar does not have any dependencies other than i3-wm. It can be used to view information generated by conky or i3status. For example (as of version 4.1):

~/.i3/config
bar {
    output            LVDS1
    status_command    i3status
    position          top
    mode              hide
    workspace_buttons yes
    tray_output       none
    
    font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1

    colors {
        background #000000
        statusline #ffffff

        focused_workspace  #ffffff #285577
        active_workspace   #ffffff #333333
        inactive_workspace #888888 #222222
        urgent_workspace   #ffffff #900000
    }
}

For further information see the Configuring i3bar section of the official User Guide.

Comparison of i3bar and dzen2

This comparison of i3bar and dzen2 only takes into account how well the two programs can handle the input from conky or i3status.

Program Color Codes Formatting Special Fonts Dock Trayer
i3bar Yes No, right aligned No (UTF8 only) Yes Yes
dzen2 Yes No, left aligned Yes Yes (the svn version) No

Though development of i3bar is very active and support for custom formatting and fonts has been announced, dzen2-svn has an edge over i3bar (as of August 7th).

Alternatives

  • i3pystatus - extensible i3status replacement with many modules and very flexible configuration. Multi-threaded and lock-up free.
  • py3status – an extensible i3status wrapper written in python

Quickly jumping to open window

  • quickswitch-for-i3 – A Python utility to quickly change to and locate windows in i3
  • i3-wm-scripts – search for and jump to windows with particular names matching regexp
  • winmenupy launches dmenu with a list of clients, sorted after workspaces. Selecting a client jumps to that window.

Suspending with i3lock

You need to add unit file below and enable it with # systemctl enable suspend@<user>.service.

/etc/systemd/system/suspend@.service
[Unit]
Description=Starts i3lock at suspend time
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStartPre= 
ExecStart=/usr/bin/i3lock

[Install]
WantedBy=sleep.target

Usage

See the official documentation on this subject for more information: i3 User’s Guide

i3 currently uses dmenu as a application launcher, which is bound by default to Template:Keypress+Template:Keypress.

Clipboard (copy & paste issues)

By default, when you close a window, the buffer with the clipboard info will dissapear. You have to use a clipboard manager like "Parcellite" to avoid that.

See also

Arch Linux Forums