Jeremy's Ramblings

A familiar development environment on Windows

Every laptop I've owned for the last ten years has had some form of Linux installed on it (by choice). Usually some variant of Arch, sometimes Ubuntu, sometimes Fedora. But, I much prefer Linux for my development machines, for various reasons (though mostly because of familiarity at this point). However, I recently bought a Framework laptop, and decided to try out Windows as a daily development driver, just for fun. I wasn't expecting much, and fully anticipated switching back within a couple days.

But, I wouldn't be writing this if I hadn't actually found a pretty ergonomic setup using Windows that I am actually enjoying using. Here's a quick rundown of how I have things configured.

This all revolves around Windows Subsystem for Linux, or WSL for short. I'm not going to go into detail here, as that's a different topic, but the short of it is, I can run a full Linux distribution within my Windows environment, and I can access both filesystems from either area. So, this gives me the familiarity I crave for Linux, with the driver support and stability (for some pieces of my hardware) that Windows offers.

My setup is the following:

I really like having a terminal on hand via a hotkey (quake mode, in more common parlance). I also really like being able to open a new Alacritty terminal for various things (I've never been a big fan of tmux for one reason or another, and Alacritty doesn't support tabs), and I've found (as I'll explain below), that it can also be useful to open a Windows powershell terminal from time to time. All via hotkeys. AutoHotkey solves this problem nicely, as I can configure any combination of keys to do any number of things. My bindings are:

One limitation I immediately found with the Windows Terminal app, and Windows in general, is that you cannot bind to certain keys for shortcuts (like F12, it's system reserved for...something). But, with AutoHotkey, you can override those reserved keys, and bind pretty much anything you like. And Alacritty makes it easy to configure a new window with whatever shell you need (powershell, WSL, etc).

Given that the WSL can directly access the windows filesystem, and vice versa, I can kind of work in a couple different ways: I can work solely in the WSL, using Neovim as my editor/IDE, and running programs as I normally would (you can even run GUI applications from the WSL in the windows windowing system, slow, but neat). Or, I can do a hybrid approach. An example, I am writing a game in Rust. Rather than run the GUI app in the WSL via Windows, I can have my codebase, and Rust, on Windows (runs faster, fewer resources), and run it in windows (via the aforementioned powershell Alacritty window), but interact with the codebase via the WSL using Claude Code (could run this in windows, but why not?). I can then edit my code in an IDE of my choice (Jetbrains, usually) on Windows, and still use my more comfortable Linux workflow for everything else.

There's other nice things, like Docker Desktop having tight WSL integration (run the GUI on windows, and the WSL can connect to its docker engine), and integration with VSCode (which I don't use much, but it's WSL integration is slick).

It's all pretty nice, and I find myself not really missing a bespoke Linux install as much as I thought I would. I have all the power, and flexibility, with better support for my hardware. I think I'm going to stick with it for a while.

For the curious, here is my AutoHotkey config (v2 syntax):

; Global variable to track state
global alacrittyVisible := false

; WSL in quake mode
F12:: {
    global alacrittyVisible
    
    if (!WinExist("ahk_exe alacritty.exe")) {
        ; Launch if not running
        Run("alacritty.exe")
        WinWait("ahk_exe alacritty.exe",, 3)
        Sleep(200)
    }
    
    if (alacrittyVisible) {
        ; Hide it
        WinMinimize("ahk_exe alacritty.exe")
        alacrittyVisible := false
    } else {
        ; Show it
        WinRestore("ahk_exe alacritty.exe")
        WinActivate("ahk_exe alacritty.exe")
        WinSetAlwaysOnTop(1, "ahk_exe alacritty.exe")
        WinMove(0, 0, A_ScreenWidth, A_ScreenHeight/2, "ahk_exe alacritty.exe")
        alacrittyVisible := true
    }
}

; WSL in regular window
^F12:: {
    Run("alacritty.exe -o window.decorations='Full' -o window.dimensions.columns=120 -o window.dimensions.lines=40 -o window.startup_mode=Windowed")
}

; PowerShell in regular window
^F11:: {
    Run("alacritty.exe -o window.decorations='Full' -o window.dimensions.columns=120 -o window.dimensions.lines=40 -o window.startup_mode=Windowed -e powershell")
}

#operating systems #software engineering #tools