jmpesp.me

Lightening the load for Kali VMs

A setup guide for the i3 on Kali Linux, a stylish window manager that uses less resources than many of its competitors.

2 years ago

Latest Post SharpCookieMonster by m0rv4i

A quick setup guide for i3 on Kali.

If you're anything like me, you regularly use Kali Linux as a VM or on lightweight boxes with fewer resources than you'd like. I recently switched to the window manager instead of Gnome, and have marked a significant increase in the usability of the VM. I've tried Kali's other default Window Managers (KDE, Mate etc) but for the most part they either look like crap or don't make a big difference to the usability, whereas i3 (for me) is simple, looks decent, and uses far fewer resources.

In this guide, we're going to set up i3 on Kali, and get it looking reasonable.

What is it?

i3 is a tiling window manager. This means that, by default, anytime you create a new window (terminal, firefox, etc) it splits the screen, however we're going to set it up slightly differently so that all windows are presented in tabs. We'll also have workspaces of course, as well as a minimalistic status bar. The final product can be seen below.

2018-04-30-15_07_11-Kali---VMware-Workstation

Installation

The first step is to install i3, in addition to a few extras that we'll use to style it.

$ apt install -y gtk-chtheme i3 i3blocks lxappearance 

Now reboot and when we go to log in, after entering the username field and at the password prompt a little cog icon appears next to the login button, from here we can choose "i3" and we're good to start!

Note that it looks pretty horrible at the moment, but we'll quickly change that. If you get prompted for a default modifier key, the recommended option is windows. This is the key that will be used to navigate tabs etc, we'll go over that later.

Configuration

All the configuration for i3 itself takes place in the ~/.config/i3 folder, mostly the config file. We'll need to have logged in using i3 at least once to have these files created.

To start out, hit the modifier key you chose earlier and Enter to launch a terminal.

Add the following lines to the bottom of the config file:

workspace_layout tabbed # Tells i3 to use tabs for new windows, not splits
hide_edge_borders both  # Hides some large black borders around windows

Then add or amend the bar subsection to invoke i3blocks, a much nicer status bar than the default.

set $base00 #101218
set $base01 #1f222d
set $base02 #252936
set $base03 #7780a1
set $base04 #C0C5CE
set $base05 #d1d4e0
set $base06 #C9CCDB
set $base07 #ffffff
set $base08 #ee829f
set $base09 #f99170
set $base0A #ffefcc
set $base0B #a5ffe1
set $base0C #97e0ff
set $base0D #97bbf7
set $base0E #c0b7f9
set $base0F #fcc09e

bar {
        status_command i3blocks -c ~/.config/i3/i3blocks.conf 
	colors {

	    separator           $base03
	    background          $base01
	    statusline          $base05

	    #                  border  background text
	    focused_workspace  $base01 $base01    $base07
	    active_workspace   $base01 $base02    $base03
	    inactive_workspace $base01 $base01    $base03
	    urgent_workspace   $base01 $base01    $base08
	}
}

We can then configure the ~/.config/i3/i3blocks.conf file to alter our status bar, for example commenting the temperature and battery sections, as they're not useful for VMs. We can get this file from the , and alter it as we wish.

Usage

i3 has it's own set of commands, which are quite intuitive and easy to use. It uses a "mod" key which can be changed, but by default is the windows key.

Extras

Spicing up the desktop

There are a great set of YouTube videos by Code Cast that go over some optional extras for i3, such as always launching certain processes (such as a terminal, firefox etc) in a dedicated workspace, or changing the workspace icons in the bottom-left (usually 1,2,3 etc) to font-awesome icons such as the firefox and terminal symbols.

Font

As suggested by the above videos, I use the , originally for Macs. To install this run:

$ wget https://github.com/supermarin/YosemiteSanFranciscoFont/blob/master/System%20San%20Francisco%20Display%20Regular.ttf?raw=true -O ~/.font/System\ San\ Francisco\ Display\ Regular.ttf

Then change the name of the font that's used by editing the ~/.gtkrc-2.0 file, changing the line gtk-font-name="System San Francisco Display 12", where 12 is the font size. If this file does not exist, just create it.

We can also run lxappearance and gtk-chtheme. These programs can be used to alter most appearance settings, however they don't appear to notice the new font file so we have to edit the file manually. We may also have to change it in ~/.config/gtk-3.0/settings.ini in the same way, depending on versions used.

Other UI extras

2018-04-30-15_40_38-Kali---VMware-Workstation

In the above screenshot I'm using as the terminal multiplexer and for vim. Both are great tools I can recommend.

Setting i3 as the default Window Manager

We can change the default window manager in the file /usr/share/gdm/BuiltInSessions/default.desktop by changing the value of Exec to i3.

If it's not been changed from it's default value, we can run:

$ sed -i.bak '/^Exec=/ s/default/i3/' /usr/share/gdm/BuiltInSessions/default.desktop

This will also create a backed up file of the original at /usr/share/gdm/BuiltInSessions/default.desktop.bak.

However I found that Kali Linux still had "GNOME" selected in the window manager menu on the login screen by default, and not the default by default which was frustrating. I didn't find how to change this, so in the end I just backed up the folder where this options are stored, and removed the GNOME options:

$ cp -r /usr/share/xsessions /usr/share/xsessions.bak
$ rm /usr/share/xsessions/gnome*

Then when logging in, the i3 window manager is used by default.

If anyone finds out how to elegantly handle this, please tweet at me to let me know!

Summary

We've had a quick look at setting up i3 as a window manager for Kali Linux. We've touched on the usage and some configuration options, but almost every aspect of i3 is configurable. For more details and options, check out the .

m0rv4i

Published 2 years ago