• untoreh-light
  • I am Francesco Giannelli. The website «unto.re» is the place where I put stuff I should remember...or forget. Located in south italy. Born in the early nineties.
    italy

Make Windows Bearable

A list of tools to make Windows feel more like Linux

Since I switched to windows 10 with WSL I figured I'd make a list of software that I had to use to bring windows closer to my usual linux workflow. Let's make it clear that Windows UI sucks, it is stuck in the 90s and everything is supposed to be clicked and dragged with your mouse pointer. I don't know if it is a culture thing (windows devs must like the mouse very much), or for target demographic ("click at that thing!" is easy to explain), or because of security best practice (if we give too much control to the user, malware will exploit it) or just the Windows Shell being made of a pile of technological debt which makes it harder to add functionality for advanced users. The fact is that simple things in Linux need convoluted solutions in Windows.

Virtual Desktops

In linux every windows manager has some form of virtual desktop, windows got built virtual desktops fairly recently with W10. The thing is that at the time of writing you can only cycle left and right with hotkeys, and there aren't hotkeys to go to desktop X. There is this vd library but I haven't found software that makes use of it, instead only AHK[1] scripts with poor implementations like "loop until we are at the correct VD".

The lack of proper shortcuts for windows built-in virtual desktops made me force to use 3rd party software, of which there are many, I chose dexpot as it does all the things I would need and more (I would be happy with just go to X and move window to X shortcuts). The only problem was that dexpot isn't able to bind already bound keys...somewhat AHK is able to override keys used by other applications, whereas dexpot doesn't, I assume it is because it relies on a different windows API (or [dll]). Workaround is to remap shortcuts the I wanted (e.g. Win+1) with a free shortcut that could be set on dexpot (e.g. Win+Shift+F1)

Keyboard mapping

Powertoys allows to map keys, and shortcuts, such that I can map CapsLock->LeftControl and RightControl->LeftControl. And shortcuts like Win+hjkl to arrows. Too bad Win+l is a windows default shortcut for locking the screen and can't be remapped...a registry key overrides the shortcuts and fixes this...until you update windows...so you have to apply the fix at each boot!

Launcher

The apps launcher provided by powertoys is instead quite featureful, doesn't use much more memory than KRunner and is fast and responsive. The only complaint is that from time to time it looses focus, but this is most likely a problem with Windows sick (as in perverted) control of which window is supposed to be focused at any given time.

Tiling

I switched from sway to KDE on Linux, so I wasn't that much of a tiled windows lover. Powertoys has FancyZones which is a slight improvement over basic windows Snaps that window offers, as it gives you gaps and layouts. Yet it is still lacking the most important thing that make tiling useful, that is rules to apply to matching windows, but this would also need support for virtual desktops...and we have already mentioned their current state. In Comparison KWin allows you to match windows with very complex definitions. FancyZones works around the rules issue by preserving windows positions across sessions, but I haven't investigated how well this works with different virtual desktops.

Dragging windows

Windows can only be dragged from the titlebar, and an additional utility needs to be used to move them with a shortcut combination.

System monitor

With KDE you have plasma widgets to display system informations, although plasma widgets tend to consume a lot of memory so I didn't use them that much. With Windows there isn't a built-in utility for this, after trying a few utilities I settled on Traffic Monitor which gives network, cpu, memory, and just recently were added GPU and temps. The result is a nice low-profile rectangle displayed within the taskbar:

Bonus point for Windows is that my UPS is recognized and is shown in the tray area, so doesn't need additional configuration, whereas in linux NUT there are drivers problems.

System Services

Many didn't like systemd when it came along into the linux kernel..With Windows I instead started missing it..Windows Services is not really something oriented towards users like systemd. Windows has the Task Scheduler to deal with things that look like one-shot unit files, but again its interface (or lack thereof) is dreadful. Lucky us we don't really need custom daemons in windows, since most of the windows applications we use are supposed are just run at startup kind of logic, and don't need more advanced configurations. In fact, apart the litter of tools (sigh) to make windows work like a modern environment, then only other native windows applications in use are the browser (firefox) since browser GPU acceleration is bad within WSL (well even on native linux...) and the video player (mpv)..and games of course...

Packages

I don't like chocolatey as it requires administrator privileges, I always look first for scoop packages as those are installed in the user folder, which is more convenient and more consistent, and simplifies backups.

WSL/g

I was induced to switch to windows from the recent WSLg update. Which required mesa drivers compiled with the d3d12backend support for opengl. Windows provides a community preview ubuntu layer, but I opted for arch linux since there was already an AUR package for mesa with d3d12. Since WSL currently doesn't support systemd, I ended up using supervisor to manage a few services. To make sure supervisor is active there is a check in the shell profile for a lock file that should be created on tmpfs if supervisor has been previously started.

WSL supports only ext4 file systems, to use other file systems, you have to mount the partition (or the disk) directly insider the WSL VM. However they have to be mounted manually as administrator from windows. To automate this we can use the task scheduler that allows to bypass UAC prompt by running tasks with the highest priviledge. We can run a wsl --mount command to mount our desired disks/partitions and then run mount the filesystem from within linux. Because my /home/ resisde in a mounted btrfs filesystem I have to mount it automatically, so we use /etc/fstab to map our partition (by LABEL) to /home. Because we use nix with nix-env we need to bind mount our nix store to /nix on every wsl startup, and because /tmp is not on tmpfs we have to create an overlay mount which mounts tmpfs over the existing /tmp directory, to preserve important files, specifically the X11 files, required to talk to the X server.

These mounts are execute with a script, which should be run after we have mounted the disk inside linux. We need a task that runs after the mount task is completed, and because WSL uses different VMs for different windows users the script must be run NOT with highest priviledges (oterwise it would mount on the Administrator VM).

To ensure WSLg works, we have to make sure the XDGRUNTIMEDIR is set, since it is different and located (by default) at /mnt/wlsg/runtime-dir. This is how windows under wayland look, you can see that since with wayland window decorations can be drawn by either the compositor or the application, they keep the configuration of your GTK/QT theming, so you end up with a native linux theme looking window inside a Windows shell...which is a little bit disorienting at first.

Terminal emulator

On linux I was using kitty, since it was one of the newer terminal emulators with GPU acceleration [2] and a somewhat stable daemon mode which allows multiple windows with the same instance. However on windows, I dabbled with a few windows based terminals like Windows Terminal, fluent terminal, wsltty, conemu, but eventually I switched to wezterm. Despite being a more recent terminal it has all the features you would want from a terminal emulator:

With Windows I also modified my workflow a bit such that I don't need a terminal with daemon mode that supports multiple separate windows, by using a dropdown terminal. To make wezterm drop down after tried many drop-down AHK scripts, eventually I found one that worked fairly well. A better alternative however would be windows-terminal-quake, but I have had problem with it misbehaving with the virtual desktops managed by dexpot, whereas mitty-quake-console seems to be compatible with dexpot virtual desktops. Most likely when the built-in Windows virtual desktops experience improves, I will switch to windows-terminal-quake. WezTerm is also cross-platform which means, I can keep using it with a native linux installation. It has been a really fortunate finding for this Windows+WSL switch, since Kitty doesn't yet support Windows, and the other terminal alternatives, had some failry major annoyances that I couldn't come to terms with.

[1] AutoHotKey
[2] why again do I need gpu acceleration in the terminal?