i3 config

Abhirag

Mod Key

Set super (aka win key) as the mod key:

set $mod Mod4

Font for Window Titles

font pango:Ubuntu Mono 12

Basic Keybindings

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

# start a terminal, I use termite
bindsym $mod+Return exec termite

# kill focused window 
# deviation from the standard $mod+Shift+q
bindsym $mod+q kill

# start rofi (a program launcher)
# using Geo font in rofi
# rest of rofi config done through .Xresources 
bindsym $mod+d exec rofi -show run -font "Geo 13.5" -color-window black 
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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+semicolon 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 toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
# deviation from the standard $mod+w 
bindsym $mod+t 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+z focus child

Config for Workspaces

set $ws1 "[1] Term"
set $ws2 "[2] Emacs"
set $ws3 "[3] Web"
set $ws4 "[4] Code"
set $ws5 "[5] Misc"
set $ws6 "[6]"
set $ws7 "[7]"
set $ws8 "[8]"
set $ws9 "[9]"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

# assign workspaces
assign [class="Emacs"] $ws2
assign [class="Google-chrome"] $ws3
assign [class="Firefox"] $ws3
assign [class="Code"] $ws4
assign [class="Slack"] $ws5

# switch to next/previous active workspace
bindsym $mod+p workspace prev
bindsym $mod+n workspace next

Music

bindsym $mod+Shift+p exec --no-startup-id mpc prev
bindsym $mod+Shift+n exec --no-startup-id mpc next
bindsym $mod+Shift+t exec --no-startup-id mpc toggle
exec --no-startup-id mopidy

Miscellaneous

# reload the configuration file
bindsym $mod+Shift+c reload

# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart

# exit i3 (logs you out of your X session)
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'"

# lock
bindsym $mod+Shift+x exec --no-startup-id ~/lock_script.sh

# screenshot
bindsym --release Print exec "scrot -m '/home/abhirag/Pictures/Screenshots/%s_%H%M_%d.%m.%Y_$wx$h.png'"

# nautilus
bindsym $mod+Shift+f exec --no-startup-id nautilus --no-desktop

# 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 Up resize grow height 10 px or 10 ppt
        bindsym Down 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"

# remove window title bars but keep a 2 pixel border to highlight active workspace
for_window [class="^.*"] border pixel 2

# wallpaper
exec_always --no-startup-id feh --bg-scale /home/abhirag/wallpaper.jpg

i3 Color Scheme

# $i3-theme-window
# class                 border  backgr. text    indicator
client.focused          #383838 #00FF00 #383838 #EFEFEF
client.focused_inactive #333333 #333333 #ffffff #EFEFEF
client.unfocused        #333333 #333333 #888888 #EFEFEF
client.urgent           #2f343a #900000 #ffffff #900000

Bar

# font used is Geo
# refer to i3blocks config for the rest
bar {
        position bottom
        status_command i3blocks
        font pango:Geo 13.5
        colors {
  background #272822
  statusline #FFFFFF
  separator #272822
  focused_workspace  #4F4F4F #00FF00 #000000
  active_workspace   #0D0D0D #00FF00 #000000
  inactive_workspace #0D0D0D #0D0D0D #EFEFEF
  urgent_workspace   #2f343a #F92672 #000000
}
}