i3 wm

I've been hearing about i3 Window Manager for a while now, and had been waiting to have a go. I finally did.

i3wm.org
i3 User Guide

All the major advantages are listed on the homepage itself. What I particularly like:
"Don’t be bloated, don’t be fancy (simple borders are the most decoration we want to have)."

For now I am making it my home. I don't need any fancy distracting frills. The only thing I seem to be missing is Alt+Tab, as I keep hitting it. [Update: I got that working. See config below.]

You can have a really beautiful desktop, but how long are you going to look at it, before you open some windows which cover most of your desktop? As for me, I usually have all windows maximised on my smallish screen.

i3 has three layouts - split ($mod+e), stacking ($mod+s), and tabbed ($mod+w). I particularly like the tabbed layout maximising screen estate use on small laptop screen. (Auto)Hide the statusbar, and or full-screen ($mod+f) your windows.

$mod+Enter will open a new terminal window in your chosen layout. You can change layouts anytime.
$mod+Shift+q will close your active window.
$mod+Shift+e will exit i3.

Armed with this basic knowledge, we can start exploring i3.

It is a very simple install - three packages - i3 + i3status and dmenu.

On first run, i3 will prompt you and create it's config in ~/.config/i3/config.

Below are my config files.

$ cat ~/.xinitrc
#!/bin/sh
setxkbmap -option terminate:ctrl_alt_bksp
exec i3

$ cat ~/.config/i3/config
set $mod Mod4

#font pango:monospace 8
#font pango:DejaVu Sans Mono 8
font pango:DejaVu Sans, FontAwesome 8

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

bindsym $mod+Shift+q kill
bindsym $mod+Return exec i3-sensible-terminal

#bindsym $mod+d exec dmenu_run
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right

bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

bindsym $mod+h split h
bindsym $mod+v split v

bindsym $mod+f fullscreen toggle

bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

set $workspace1 "1  "
set $workspace2 "2  "
set $workspace3 "3  "
set $workspace4 "4  "
set $workspace5 "5  "
set $workspace6 "6  "
set $workspace7 "7  "
set $workspace8 "8  "
set $workspace9 "9  "
set $workspace10 "10  "

assign [class="Geany"]  $workspace1
assign [class="Sylpheed"] $workspace2
assign [class="Opera"]  $workspace3
assign [class="QupZilla"] $workspace4
assign [class="Firefox"]  $workspace4
assign [class="mpv"]  $workspace9
assign [class="Spotify"] $workspace10

new_window none  #borders none
workspace_layout default #default|tabbed|stacking|splitv|splith
#force_display_urgency_hint 2000

for_window [class="mpv"] workspace $workspace9, floating enable, focus
#for_window [class="Spotify"] workspace $workspace10
for_window [class="Gimp"] floating enable
for_window [class="Uzbl-core"] focus child, layout tabbed, focus

bindsym $mod+1 workspace $workspace1, layout splith;
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4, layout tabbed;
bindsym $mod+5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+9 workspace $workspace9, layout floating;
bindsym $mod+0 workspace $workspace10

bindsym $mod+Shift+1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4
bindsym $mod+Shift+5 move container to workspace $workspace5
bindsym $mod+Shift+6 move container to workspace $workspace6
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $workspace8
bindsym $mod+Shift+9 move container to workspace $workspace9
bindsym $mod+Shift+0 move container to workspace $workspace10

# resize window (you can also use the mouse for that)
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"
}

bindsym $mod+r mode "resize"

bar {
 status_command nice -n19 i3status -c ~/.config/i3/i3status.conf
 position top
 colors {
  statusline #55BB55
 }
}

hide_edge_borders both
workspace_auto_back_and_forth yes

## http://slackword.net/?p=657
#bindsym $mod+z workspace back_and_forth
#bindsym $mod+Shift+z move container to workspace back_and_forth
#bindsym $mod+Shift+z move container to workspace back_and_forth; workspace back_and_forth

bindsym $mod+Tab workspace back_and_forth
bindsym $mod+Shift+Tab move container to workspace back_and_forth

bindsym Mod1+Tab workspace back_and_forth
bindsym Mod1+Shift+Tab move container to workspace back_and_forth

bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -q set Master 2+
bindsym XF86AudioLowerVolume exec --no-startup-id amixer -q set Master 2-
bindsym XF86AudioMute exec --no-startup-id amixer -q set Master toggle

bindsym XF86MonBrightnessUp exec xbacklight -inc 20
bindsym XF86MonBrightnessDown exec xbacklight -dec 20

bindsym $mod+b exec --no-startup-id i3-msg border toggle

bindsym $mod+t exec urxvt -e tmuxj
bindsym $mod+g exec geany, workspace $workspace1;
bindsym $mod+m exec sylpheed, workspace $workspace2;
bindsym $mod+o exec opera
#bindsym $mod+o exec opera, workspace $workspace3;
bindsym $mod+q exec qupzilla, workspace $workspace4;
bindsym $mod+Shift+s exec spotify, workspace $workspace10;

## http://faq.i3wm.org/question/1262/exiting-i3-without-mouse-click.1.html
#bindsym $mod+Shift+e exec sh -c '[ $(echo "NO\nYES" | dmenu -sb "#ff6600" -i -p "Really exit i3 X session?") = "YES" ] && i3-msg exit'

exec --no-startup-id "nice -n19 volumeicon"
exec --no-startup-id "nice -n19 wpa_gui -t"
exec --no-startup-id "nice -n19 dunst"
exec urxvt -e tmux

The default i3status config is ~/.config/i3status/config, but I wanted to keep all my i3 stuff together. There's not much there.. just two files.

$ cat ~/.config/i3/i3status
# i3status configuration file.
# see "man i3status" for documentation.

# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!

general {
 output_format = "i3bar"
 colors = true
 interval = 5
 separator = ""
 color_good = "#55bb55"
 color_bad = "#ff0000"
 color_degraded = "#bbbb00"
}

order += "wireless _first_"
#order += "ethernet _first_"
order += "disk /"
#order += "cpu_temperature 0"
order += "cpu_usage"
order += "load"
order += "volume master"
order += "battery 0"
order += "time"

wireless _first_ {
 format_up = " %bitrate %quality  %essid %frequency"
 format_down = ""
}

ethernet _first_ {
 ## %speed requires root privileges
 format_up = "E %ip %speed"
 format_down = "E"
}

disk "/" {
 format = " %avail"
 prefix_type = "custom"
 low_threshold = "1"
 threshold_type = "gbytes_avail"
}

cpu_usage {
 format = " %usage"
}

load {
 format = " %1min"
}

cpu_temperature 0 {
 format = "%degrees °C"
 path = "/sys/devices/platform/coretemp.0/temp1_input"
}

volume master {
 format = " %volume"
 format_muted = " %volume"
 device = "default"
 mixer = "Master"
 mixer_idx = 0
}

battery 0 {
 #format = " %status %percentage %remaining %emptytime %consumption"
 format = " %status %percentage %consumption %remaining"
 format_down = ""
 integer_battery_capacity = "true"
 hide_seconds = true
 status_chr = ""
 status_bat = ""
 status_full = "☻"
 path = "/sys/class/power_supply/BAT%d/uevent"
 low_threshold = 10
 threshold_type = percentage
}

time {
 format = " %b %d %a %R"
}

ref: i3wm Jump Start, by Alex Booker

No comments:

Post a Comment

most viewed