A month with Linux desktop
Dec 20, 2015Up until last week and the whole month of November I had to switch to Linux as my primary development environment and before that I haven’t used Linux primarily for development since 2009 when I switched to OSX. And in more than a month I experienced how things have changed a lot in the Linux desktop landscape, I’ve spent quite a bit of time trying to piece all these components together so hopefully this will you some time.
A week ago this is what my desktop looks like:
There are a couple of things going on in there and here’s a summary of the components I’ve used:
- i3 - Tiling window manager
- i3blocks - Status line for i3
- i3-nagbar - Error bar for i3
- i3lock - Improved screen locker for i3
- rofi - Window switcher and run dialog
- Font Awesome - Workspace icons
- Ohsnap - Widget font
- ClipIt - Clipboard manager
- California - Calendar
- AlsaMixer - Volume control
- WICD - Wireless network manager
- NetworkManager - For wired and VPN network connection
- xclip - CLI interface to clipboard
- lxappearance - GTK theme switcher
- Arc Darker - GTK + Firefox theme
- gnome-screenshot - Taking screenshots
- gnome-terminal - Terminal emulator
- imwheel - Mouse wheel translator for X
- compton - Compositor for X11
- Spotify - Music to my ears
Together, all these components greatly improves my development experience. Most of them are just install and run applications but i3 is what holds all of them together so we’ll going though some of the configurations:
i3
This is a tiling window manager just like xmonad and several others. But I’m using a fork which is actually called i3-gaps, the main difference being that windows have configurable gaps in them just like in the screenshot.
Moving of focused container, I’d like to use the same movements I used at vim whenever possible:
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
Split horizontally and vertically so the keys are together side-by-side:
bindsym $mod+b split h
bindsym $mod+v split v
Going full-screen:
bindsym $mod+f fullscreen
There will be times when a popup window looks awkward when tiled, so we can toggle it to be floated instead:
bindsym $mod+Shift+space floating toggle
Workspace labels and shortcuts, the icons might not display correctly on this page but if you have font-awesome locally installed it should render correctly:
set $ws1 "1 "
set $ws2 "2 "
set $ws3 "3 "
set $ws4 "4 "
set $ws5 "5 "
set $ws6 "6 "
set $ws10 "10 "
# 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 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace $ws10
Move containers from one workspace to another:
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 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 $ws10
Auto-assigning workspace for certain programs so that when launched, they go in to their respective workspace:
assign [class="Firefox"] $ws2
assign [class="Skype"] $ws3
assign [class="HipChat"] $ws3
assign [class="Vlc"] $ws4
assign [class="Spotify"] $ws10
Reloading i3 config and/or restarting in-place, the nice thing about restart is that it preserves your layout/session:
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
Resizing, of course still want those vim movements:
mode "resize" {
bindsym h resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym j resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
...
}
bindsym $mod+r mode "resize"
Some visual tweaks:
# window colors
# border background text indicator
client.focused $yellowgreen $yellowgreen $text-color $yellowgreen
client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color $inactive-bg-color
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $inactive-bg-color
client.urgent $urgent-bg-color $urgent-bg-color $text-color $urgent-bg-color
# thin borders
hide_edge_borders both
Configuring i3bar:
bar {
status_command i3blocks -c ~/.i3/i3blocks.conf
colors {
background $bg-color
separator #757575
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $text-color
}
}
Change the font to Ohsnap:
font pango:Ohsnap 12
Keybindings for screen locking, replacing command launcher with rofi and logging-out:
bindsym $mod+shift+x exec ~/.i3/scripts/lock
bindsym $mod+d exec rofi -show run -lines 3 -eh 2 -width 100 -padding 460 -opacity "85" -bw 0 -bc "$bg-color" -bg "$bg-color" -fg "$text-color" -hlbg "$bg-color" -hlfg "#9575cd" -font "Ohsnap Bold 18"
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'"
Auto-launch some programs:
exec spotify
exec compton -f
exec imwheel
exec_always clipit -n
Windows and gaps:
for_window [class="^.*"] border pixel 4
gaps inner 10
gaps outer 20
smart_gaps on
smart_borders on
I made a backup of all my configuration before I nuked my PC, feel free to use them. Also most of what I’ve used come from this great video series from Code Cast which you should totally watch.
And that’s it, there are still some areas where OSX really does it well but overall although there’s a lot of manual configuration this setup makes my workflow easier. Now that I’m back to OSX, admittedly I miss i3 but Hammerspoon brings it close and some more but that’s for another blog post. :)