i3

Contents

Installation

apt install i3 suckless-tools py3status rxvt-unicode i3lock # on Debian, suckless-tools for dmenu
emerge -av x11-wm/i3 x11-misc/dmenu x11-misc/py3status x11-terms/rxvt-unicode x11-misc/i3lock # on Gentoo
pacman -S i3-wm dmenu py3status rxvt-unicode i3lock # on Arch

Configuration

First place the main config file ~/.i3/config

# i3 config file

# default modifier
set $mod Mod4
# second modifier
set $mod2 Mod1

exec setxkbmap de nodeadkeys

# font for window titles. ISO 10646 = Unicode
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1

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

##########
# coloring				border	backgr	text indicator
client.focused			#333333 #333333 #aaaaaa #333333
client.focused_inactive	#111111 #111111 #aaaaaa #111111
client.unfocused		#111111 #111111 #999999 #111111
client.urgent			#aa2222 #aa2222 #000000 #aa2222

# redshift
#exec --no-startup-id redshift

# background
exec xsetroot -solid "#000000"

# disable screensaver
exec xset -dpms
exec xset s off

# start a terminal
bindsym $mod+Return exec urxvt

# kill focused window
bindsym $mod+Shift+q kill

##########
# program & action menu

set $dmenuopts -i -nb "#000000" -nf "#999999" -sb "#999999" -sf "#111111"
#bindsym $mod+d exec dmenu_run $dmenuopts
bindsym $mod+d exec i3-dmenu-desktop --dmenu="dmenu $dmenuopts"
bindsym $mod+a exec ~/.i3/actions/`ls ~/.i3/actions/ | dmenu $dmenuopts`

##########
# some custom key bindings
bindsym Print exec ~/.i3/actions/screenshot
bindsym XF86ScreenSaver exec ~/.i3/actions/lock
#bindsym XF86WakeUp+XF86Switch_VT_12 exec ~/.i3/actions/hibernate
bindsym XF86Launch1 exec todo

bindsym XF86AudioMute exec amixer sset Master toggle
bindsym XF86AudioLowerVolume exec amixer sset Master "2%-"
bindsym XF86AudioRaiseVolume exec amixer sset Master "2%+"

##########
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+odiaeresis focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

##########
# move focused window
bindsym $mod+Shift+J move left
bindsym $mod+Shift+K move down
bindsym $mod+Shift+L move up
bindsym $mod+Shift+Odiaeresis move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

##########
# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen

# change container layout (stacked, tabbed, toggle split)
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
#bindcode $mod+d focus child

##########
# workspaces

# switch to last used workspace
workspace_auto_back_and_forth yes

bindsym $mod+Tab workspace back_and_forth
bindsym $mod2+Tab workspace next

bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# resize window (you can also use the mouse for that)
mode "resize"
{

	bindsym j resize shrink left 10 px or 10 ppt
	bindsym Shift+J resize grow   left 10 px or 10 ppt

	bindsym k resize shrink down 10 px or 10 ppt
	bindsym Shift+K resize grow   down 10 px or 10 ppt

	bindsym l resize shrink up 10 px or 10 ppt
	bindsym Shift+L resize grow   up 10 px or 10 ppt

	bindsym odiaeresis resize shrink right 10 px or 10 ppt
	bindsym Shift+Odiaeresis resize grow   right 10 px or 10 ppt

	# same bindings, but for the arrow keys
	bindsym Left resize shrink left 10 px or 10 ppt
	bindsym Shift+Left resize grow   left 10 px or 10 ppt

	bindsym Down resize shrink down 10 px or 10 ppt
	bindsym Shift+Down resize grow   down 10 px or 10 ppt

	bindsym Up resize shrink up 10 px or 10 ppt
	bindsym Shift+Up resize grow   up 10 px or 10 ppt

	bindsym Right resize shrink right 10 px or 10 ppt
	bindsym Shift+Right resize grow   right 10 px or 10 ppt

	# back to normal: Enter or Escape
	bindsym Return mode "default"
	bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"

##########
# status bar
bar 
{
	status_command py3status -c ~/.i3/i3status.conf -l ~/.i3/i3status.log
	
	# show tray on primary monitor
	tray_output primary
	
	font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
        
	colors
	{
		background #000000
		statusline #aaaaaa
		
		# class				border	backgr	text
		focused_workspace	#999999	#999999	#000000
		active_workspace	#aaaaaa #aaaaaa #111111
		inactive_workspace	#222222	#222222	#999999
		urgent_workspace	#aa2222	#aa2222	#000000
	}
}

##########
# organize...

# Thunderbird -> Workspace 2
#assign [class="^Thunderbird$"] 2

# Pidgin -> Workspace 3 (& 4)
#assign [class="^Pidgin$"] 3
# assign [class="^Pidgin$" window_role="^buddy_list$"] 3
# assign [class="^Pidgin$" window_role="^preferences$"] 3
# assign [class="^Pidgin$" window_role="^conversation$"] 3

for_window [class="^Key-mon$"] floating enable

##########
# autostart
#rename workspace "1" to "Console"
# exec --no-startup-id i3-msg 'workspace 2; exec thunderbird'
#rename workspace "2" to "Mail"
# exec --no-startup-id i3-msg 'workspace 3; exec gajim'
#rename workspace "3" to "Jabber"
# exec --no-startup-id i3-msg 'workspace 4; exec urxvt -e "htop"'
#rename workspace "4" to "Top"

und the config file for i3status / py3status ~/.i3/i3status.conf

order += "diskdata /boot"
order += "diskdata /"
order += "diskdata /home"
order += "ethernet enp0s25" # TODO substitute ethernet device (in the complete file)
order += "wifi"
#order += "imap mail"
#order += "systemd firewall"
#order += "emerge_status"
order += "battery_level"
order += "sysdata"
order += "volume_status"
order += "clock"

diskdata "/boot" {
	disk = "/dev/sda1"
	format = " /boot {used} GB {free} GB "
	format_space = "{value:.2f}"
}

diskdata "/" {
	disk = "/dev/sda2"
	format = " / {used} GB {free} GB "
	format_space = "{value:.1f}"
}

diskdata "/home" {
	disk = "/dev/sda4"
	format = " /home {used} GB {free} GB "
	format_space = "{value:.1f}"
}

ethernet enp0s25 {
	format_down = ""
	format_up = " %ip "
}

wifi {
	bitrate_bad = 0
	bitrate_degraded = 0
	device = "wlp3s0"  # TODO substitute wlan device
	format = " {ssid} ({ip}, {signal_percent}) |"
}

#imap mail {
#	cache_timeout = 60
#	format = ' {unseen} '
#	hide_if_zero = True
#	mailbox = 'INBOX'
#	name = 'Mail'
#	on_click 1 = "exec thunderbird" # "exec urxvt -e mutt"
#	password = '' # TODO
#	port = '993'
#	security = 'ssl'
#	server = '' # TODO IMAP-Server
#	user = '' # TODO Username / Mail-Address
#}

#systemd firewall {
#	format = ' \?if=!hide {unit} '
#	hide_extension = True
#	hide_if_default = 'on'
#	unit = 'firewall.service'
#}

#emerge_status {
#	format = "[\?if=is_running  [\?if=!total=0 {current}/{total} {action} {category}/{pkg}|calculating...] ]"
#}

battery_level {
	format = " [\?if=charging Charging {percent}%|Discharging {percent}% {time_remaining}h] "
	hide_seconds = True
	hide_when_full = True
}

sysdata {
	format = " {load1} {mem_used} GB "
}

volume_status {
	cache_timeout = 1
	command = "amixer"
	format = " [\?if=is_input 😮|♪] {percentage}% "
	format_muted = " [\?if=is_input 😶|♪] {percentage}% "
	thresholds = [(0, 'good')]
}

clock {
	format = "{Europe/Berlin}"
	format_time = " %a %d.%m.%Y %T"
}

We placed a bunch of scripts in ~/.i3/actions/. They can be run by Meta+A.

~/.i3/actions/hibernate

#!/bin/sh
i3lock -c "#000000" && systemctl hibernate

~/.i3/actions/lock

#!/bin/sh
# enable screensaver
xset +dpms
xset s default
i3lock -n -c "#000000"
# disable screensaver
xset -dpms
xset s off

~/.i3/actions/poweroff

#!/bin/sh
systemctl poweroff

~/.i3/actions/quit

#!/bin/sh
i3-msg "exit"

~/.i3/actions/reboot

#!/bin/sh
systemctl reboot

~/.i3/actions/reload

#!/bin/sh
i3-msg "reload"

~/.i3/actions/restart

#!/bin/sh
i3-msg "restart"

Remember to make these scripts executable

chmod 755 ~/.i3/actions/*

Finally configure the rxvt-unicode terminal in ~/.Xdefaults

URxvt.saveLines: 10000
URxvt.scrollBar: false
URxvt.foreground: white
URxvt.background: black
URxvt.secondaryScroll: true
#URxvt.font: xft:Bitstream Vera Sans Mono:pixelsize=9
URxvt.perl-ext-common: default,matcher
URxvt.urlLauncher: firefox
URxvt.matcher.button: 1
URxvt.matcher.pattern.1: \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]
URxvt.urlLauncher: firefox
URxvt.tabbed.saveLines: 1000
URxvt.tabbed.scrollBar: false
URxvt.tabbed.tabbar-fg: 3
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 0
URxvt.tabbed.tab-bg: 1
URxvt.tabbed.secondaryScroll: true
#URxvt.tabbed.font: xft:Bitstream Vera Sans Mono:pixelsize=12
URxvt.tabbed.perl-ext-common: mark-urls
URxvt.tabbed.urlLauncher: firefox 
URxvt*inheritPixmap: true 
URxvt*transparent: true
URxvt*shading: 70
URxvt.urgentOnBell: true
URxvt.fading:25
#URxvt.font: 10x20

Run i3 via startx

Run i3 from ~/.xinitrc:

exec i3