This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
i3
i3 is a minimalist window manager, focusing on keyboard commands to manipulate windows. By default all windows are in full-screen in order to best maximize the use of the screen and have less fiddling with positioning. Even with the doc
USE flag enabled its installed size is less than 1.6 MB. It also uses less than 10 MB of RAM under normal operating conditions.
Installation
USE flags
USE flags for x11-wm/i3 An improved dynamic tiling window manager
Emerge
root #
emerge --ask x11-wm/i3
Additional software
It is also assumed that dmenu will be emerged. Available USE flags include:
USE flags for x11-misc/dmenu a generic, highly customizable, and efficient menu for the X Window System
savedconfig
|
Use this to restore your config from /etc/portage/savedconfig ${CATEGORY}/${PN}. Make sure your USE flags allow for appropriate dependencies |
xinerama
|
Add support for querying multi-monitor screen geometry through the Xinerama API |
i3status
i3status provides status information that can be used by i3bar which, by default, sits at the bottom of the screen. Available USE flags include:
USE flags for x11-misc/i3status Generates a status bar for dzen2, xmobar or similar
+filecaps
|
Linux capabilities library is required for i3status to be able to read net bandwidth |
pulseaudio
|
Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire) |
i3blocks
A more (relative to the more popular i3status) advanced, extensively-customizable status (for the i3bar config to use) is provided by i3block.
root #
emerge --ask x11-misc/i3blocks
i3lock
i3lock is an i3 compatible screen locker.
root #
emerge --ask x11-misc/i3lock
Configuration
i3 can be extensively customized by editing its config. The main user config file for i3 can be either in ~/.config/i3/config or ~/.i3/config. By default when i3 is run for the first time a new config file is added to ~/.i3/config and a dialog asks what the modifier key should be set to. The default modifier key is Alt and a popular alternative is the Super (Windows) key (referred to as $mod4
in ~/.i3/config). A popular starting point for writing the config file is copying the system config file /etc/i3/config to one of the user config locations if one is not already generated.
Starting i3
Most users will probably want i3 started via the X server's ~/.xinitrc file:
~/.xinitrc
exec i3
After this code has been added to a user's .xinitrc file, running startx will start i3.
Default keybinding
Additional keybinding information can be found on upstream's website.
Basics
- Spawn a new terminal: META+Enter
- Kill the focused window: META+Shift+Q
Moving around
- Move the focus: META+Arrow_key
- Alternative (vi like) way of moving the focus: META+J,K,L,;
- Switch to workplace num: META+num
- Set vertical split mode for the focused container: META+V
- Set horizontal split mode for the focused container: META+H
Moving windows
- Toggle floating for focused window: META+Shift+Space
- Move focused window: META+MOUSE1
- Resize focused window: META+MOUSE2
- Resize focused windows in tiled mode: META+R
- Open focused window in fullscreen: META+f
Utilities keybinding
- Open dmenu (or an alternative application launcher): META+d
Administrative keybinding
- Exit i3: META+Shift+E
- Restart i3: META+Shift+R
Adding commands
In the user config file, adding a keyboard command is as simple as adding a line. For example, adding the following to the end of the config will open the firefox utility when Ctrl+Shift+Escape is pressed:
bindsym Ctrl+Shift+Escape exec firefox
You can also have it use the default key that all other commands use by using the built-in variable:
bindsym $mod+f exec firefox
You can also set you own variable names or override values of variables. It works by replacing text, like the c pre-processor, and has no concept other than strings.
set $someVarName SomeValue
Changing default terminal
Default terminal can be configured in /home/̩$USER/.config/i3/config by changing bindsym $mod+Return exec i3-sensitive-terminal
on terminal of your choice. Alternatively, you can set the TERMINAL environment variable.
Adding modes
You can also add in what is called a mode. An example is the resize mode for floating windows. This changes what keyboard commands are bound and will be able to run. This is useful if there is a large set of commands often run together, or that override the keys on the keyboard as in the example below which takes over the arrow keys and the vim-style movement keys.
mode "resize" { # These bindings trigger as soon as you enter the resize mode # Pressing left will shrink the window’s width. # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. bindsym j resize shrink width 10 px or 10 ppt bindsym k resize grow height 10 px or 10 ppt bindsym l resize shrink height 10 px or 10 ppt bindsym semicolon resize grow width 10 px or 10 ppt # same bindings, but for the arrow keys bindsym Left resize shrink width 10 px or 10 ppt bindsym Down resize grow height 10 px or 10 ppt bindsym Up resize shrink height 10 px or 10 ppt bindsym Right resize grow width 10 px or 10 ppt # back to normal: Enter or Escape bindsym Return mode "default" bindsym Escape mode "default" } # A binding to change over into the resize mode bindsym $mod+r mode "resize"
Always provide a binding inside of any mode that returns you to the default mode, or else you will be stuck in that mode. If you get stuck, you must restart X to reset i3 into default mode.
Enabling multimedia keys
You can add multimedia key bindings in your i3 config. Below are example of working multimedia keys with i3wm.
# Put this in your i3 config file # Alsa key bindings bindsym XF86AudioRaiseVolume exec amixer -q set Master 10%+ unmute bindsym XF86AudioLowerVolume exec amixer -q set Master 10%- unmute bindsym XF86AudioMute exec amixer -q set Master toggle # PulseAudio key bindings bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 10%+ unmute bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 10%- unmute bindsym XF86AudioMute exec amixer -D pulse sset Master toggle # Media player key bindings (you need playerctl for this to work.) bindsym XF86AudioPlay exec playerctl play bindsym XF86AudioPause exec playerctl pause bindsym XF86AudioNext exec playerctl next bindsym XF86AudioPrev exec playerctl previous # Brightness key bindings bindsym XF86MonBrightnessUp exec xbacklight -inc 10 bindsym XF86MonBrightnessDown exec xbacklight -dec 10
For a complete reference, visit the i3 official user guide.
Tips and tricks
Section for I3 users to share their tips and tricks.
Setting a wallpaper
A wallpaper can be easily set using Feh. Example configuration line: exec --no-startup-id feh --bg-scale /path/to/wallpaper
.
Adding Alt+Tab functionality
Add this to your i3 config file to enable META + TAB to switch to next open workspace and META + SHIFT + TAB to switch to the previous one:
# enable Alt+Tab Functionality bindsym $mod+Tab workspace next bindsym $mod+Shift+Tab workspace prev
The Scratchpad (i3's solution to minimising windows)
The i3 wm has an invisible workspace called the Scratchpad workspace. Users can move windows to and from it to hide them from the main workspaces. The i3 commands move scratchpad
and scratchpad show
hide and show windows respectively. It may be useful to bind these to keys within your config:
~/.config/i3/config
# Make the currently focused window a scratchpad bindsym $mod+minus move scratchpad # Show the first scratchpad window bindsym $mod+plus scratchpad show
Configuring gaps between tiled windows (i3-gaps only)
A detailed description of i3-gaps can be found on the [Github page].
The following lines remove the window decorations and add gaps between the windows. smart_gaps on
will disable the gaps if only one window is present on a workspace.
Change the values for preference. This will put a 5px gap between all containers and the edge of the screen.
gaps inner
sets the distance between adjacent containers. gaps outer
sets the distance between containers and the edge of the screen. It is worth noting that the actual distance from the containers to the edge of the screen is the sum of the inner
and outer
values. The actual distance between adjacent containers is the inner
value alone.
for_window [class="^.*"] border pixel 0 gaps inner 5 gaps outer 0 smart_gaps on
Known issues
i3 softbricks if xrandr with scale is used
i3 softbricks if xrandr --scale 1.1x1.1 (or any scale above 1.1x1.1) is invoked.
Partially solved?, resolving on https://github.com/i3/i3/issues/3392
1. xrandr with --scale is still unable to work correctly (results in softbrick with GPU glitches if used) with multiple outputs. Temporary solution is to invoke xorg-server for each output, but it will make them independant from each other meaning that you can NOT drag windows through multiple outputs.
2. xrandr with --scale sometimes work and sometimes it doesn't...
Reported by Kreyren (talk) 14:47, 15 September 2018 (UTC)
Changing kill command on Alt+F4 does not affect terminal.
Changing /home/$USER/.config/i3/config
section # kill focused windows
on bindsym ALT+F4 kill
does not affect terminal emulator -> unable to close terminal emulator.
If anyone knows the solution please share it. Kreyren (talk) 18:26, 8 September 2018 (UTC)
Troubleshooting
This section was created to help users diagnose their i3.
Error: status_command not found or is missing a library dependency (exit 127)
The default setting of status_command
in the /home/$USER/.config/i3/config expects installed i3status. This error could be resolved by either emerging x11-misc/i3status or changing the status_command
.