How to Setup i3 on a Kali VM for VMWare Fusion

This post is intended to help out anyone who's looking to setup i3 with Kali Linux, specifically useful for anyone running Kali on a Mac using VMWare Fusion.  This was a collection of what I pieced together from other various sources, distilled into a GitHub repo for easy use.  The blog post really just details the journey to the final product, and some of my reasonings behind it's final state.  I figured out my configuration a few months back, and procrastinated on writing the blog post.  However, this is my effort in trying to get into the habit of posting more, even if it might seem useless to most.  I've learned so much from random blog posts that explain what I now realize to be "simple" concepts, but at the time were mind boggling to me, so this is my effort in giving back to the community.

In short, read on if you're interest in turning this:

Lots of unused real estate (bottom left), uneven windows, and would-be time wasted trying to organize

Into this:

Windows can be evenly spaced, or adjusted as preferred. Each column can also be stacked, tabbed, etc.

Why i3 + Kali?

In short, it's likely a combination of: 1) having an ultrawide, and 2) being a little OCD.  

When I was going through my PWK/OSCP Journey, I got used to working in Kali daily.  For those unaware, the advantage of an ultrawide is getting a ton of screen real estate with great resolution, without needing to move your head much (or at least that's the feeling).  For my use, I found it useful to split my 38" ultrawide into thirds: 1/3 for a terminal/`burpsuite`, 1/3 for a browser, and 1/3 for my notes (formerly Joplin, now Obsidian).  Kali has built in hot corners, automatically resizing the window you've selected, but they're limited in their capabilities, mainly just splitting the screen into halves, or quarters.  This led to me manually moving and resizing windows to try and fit things into the real estate of the screen.  Not only was it time consuming, but also became distracting as the windows weren't evenly sized (despite my best reminders to tell myself that visual symmetry does not improve your likelihood of popping shells). I knew of software on Mac such as Spectacle existed, and even there was awesome functionality within terminal emulators such as tmux which allowed you to split terminals evenly with a few keystrokes.

Aesthetics aside, I think i3 with Kali can be advantageous for:

  • Screenshots - screenshots can look symmetric, and easily organized, especially if 1 screenshot includes multiple applications
  • Organization - can easily create workspaces, make "tabs" spanning various applications for logical groupings during a pentest
  • Time Saved - no time is wasted painfully resizing windows

Enter i3

After some short googling I found AkatsukiSec's Github Repo which I attempted to use, coupled with a walkthrough on Kali + i3 from zdnet and began my journey on learning more about dynamic tiling window managers.  However, these instructions are intended for using Kali on a Windows host. I ran into issues with utilizing i3, mainly the fact that OOTB, the i3 config used the Windows Key in lieu of the Alt key as the configured modifier.  My first attempt failed, mainly due to a lack of RTFM'ing the i3 documentation, and couldn't really perform much of the intended functionality of i3 with just simply changing the Mod key.  Looking back it was due to poor personal resiliency coupled with a lack of desire to dig into the documentation to better understand how to reassign specific commands.  Once I was able to troubleshoot and tweak the i3 configuratin file, I finally understood the greatness of i3.

Tweaks to i3 Config

Below are just a long form explanation of why I made changes to Akatsuki's version.  Many may just be able to read the change log and infer the reasoning, but this is for a more novice reader to understand each change's purpose.  I've tried to group the changes into categories from "mandatory" to "personal preferences". Please note the line references I mention in the following sections relate to the change log, not my config file itself.  This can be used as a guide to further customize and tweak your i3 install to your personal liking.

Mandatory Changes

These changes need to occur in order to have i3 work on a Kali VMWare Fusion instance on Mac

Mod1

In line 12, as we've discussed previously, Mod4 won't work as the modifier button, for Macs. Changed it to the Alt button (`set $mod Mod1`)

$mod+Shift vs $mod+Control

There were a few commands, such as killing the focused window (Line 54) and moving the focused window (Lines 78-81, 83-87) were due to Mac limitations. The combination of ALT + CTRL + Q on Macs lock the screen, and for whatever reason, ALT + CTRL + [Arrow Key] didn't work within the Kali i3 when I tried to move the window.  For Lines 141-153, again was a limitation where it just seemed like I was unable to ever move any applications to another workspace. This same limitation applies to the intended commands for lines 156,158, and 160.

Note: Moving a focused window with the arrow keys (lines 78-81) still don't work.  However, I've gotten used to moving the windows using the j, k, l, and ; instead, and it works as expected.

Rofi

I had issues using dmenu - the program launcher used to search the computer's PATH.  This might be useful for you if you use apps such as Obsidian. My kali setup had executables in the /home/kali/.local/bin . For whatever reason - I forgot the specifics as it was a few months back now that I was configuring this - dmenu wouldn't work to list programs in that directory, even if I changed the PATH.  My workaround was to install rofi, and list the PATH before launching (line 58).  While it might not be elegant, this little piece of metaphorical duct tape has my setup working just as expected, and I'm able to find the executables when trying to launch new applications.

Personal Preferences

I didn't find any personal use in having my i3 configured identically to Akatsuki's.  Feel free to review and tweak to your own personal liking!

Default Workspace Names

I personally didn't need so many workspaces to open up at startup, nor did I want them to be named as Akatsuki chose.  Note that $mod+n allows you to rename the existing workspace - so my typical go to is to open 1 workspace, and add additional as I need.  Another note is that if you do rename the workspace, be sure to always to start the naming with a number to ensure the $mod+Number shortcut works to quickly switch between workspaces.

Borders, Spaces, etc.

I commented out lines 197, 199, 200, 202, and 203 because I preferred the windows touching.  Personally it seems like a waste of space to introduce gaps, but to each their own!

Desktop Wallpaper & Moving VMWare-User Startup

In lines 33-39 I commented out the command to startup the VMWare tools.  You need this command in order to successfully run VMWare tools with i3.  In my troubleshooting of other aspects, I moved it towards the end of the file. I forget specifically if it fixed any issue.  However, I can confirm that currently my i3 works as is. So since it ain't broke, I'm not trying to mess with it :)

In line 38, I restore the desktop wallpaper.  Mainly because I wanted the original Kali wallpapers, and that walkthrough I referenced earlier leverages it. This also had me remove lines 193-195 of the original file.

USA! USA!

Removed the Czech keyboard layout from line 212. Nothing against the Czechs, I just won't use it.

Programs to run on Auto-Startup

I commented out lines 225,227,229,231, and 233 because I didn't want my VM to automatically open applications on startup.  However, I left the commands here for easy reference in the event I change my mind in the future.

Alias updates

I added the following two lines to my ~/.zshrc file.  I recommend following the instructions in this blog post on how to setup and determine your values for --output and --mode, with the latter requiring a bit of DYOR.

alias rezlaptop='xrandr --output Virtual1 --mode 1920x1200'
alias rezwidescreen='xrandr --output Virtual1 --mode 3840x1600'

Worst case... log out

If you give it a try and hate it, you can always just log out of i3 ( mod + CTRL + z , click 'Yes') and log back in with the Default Xsession.

Click the hamburger button when given the kali login screen to swap between tiling managers

Once I got everything installed and configured, it took a few days to get used to navigating around, and remembering the shortcuts.  This could be a simple as keeping the i3 config file open (`~/.config/i3/config`) or just grepping using the command line for quick shortcuts ( grep -C and/or grep -A are your friends for this) .

Feedback Plz

As I've mentioned before, I wasn't the most meticulous with my notes when I went through this process, and procrastinated on making a blog post about it, so there's a decent chance you may run into errors or issues if you try this on your own.  Don't hesitate to reach out with questions, challenges, or feedback.

GitHub Repo: https://github.com/TheZenTester/i3-poly-for-kali-mac