Skip to content

Instantly share code, notes, and snippets.

@GuillaumeDesforges
Last active January 18, 2023 19:57
Show Gist options
  • Save GuillaumeDesforges/540bdf5aebbb5b2790020dcadcbf1724 to your computer and use it in GitHub Desktop.
Save GuillaumeDesforges/540bdf5aebbb5b2790020dcadcbf1724 to your computer and use it in GitHub Desktop.
Instructions to get a kitty shortcut on Windows via WSL and WSLg for NixOS-WSL

Get a kitty shortcut on Windows via WSL and WSLg for NixOS-WSL

Pre-requisite

  • have WSLg installed
  • use NixOS-WSL
  • have bash as part of your system packages (just check /run/current-system/sw/bin/bash exists)

First, add kitty to your home-manager profile.

{ ... }:
{
  home-manager.users.<username> = {
    programs.kitty = {
      enable = true;
    };
  };
}

I had some weird font spacing issues, so I had to explicitely specify kitty to use the Hack font.

{ pkgs, ... }:
{
  fonts.fonts = with pkgs; [ hack-font ];
  
  home-manager.users.<username> = {
    fonts.fontconfig.enable = true;
    
    programs.kitty = {
      enable = true;
      font = {
        name = "Hack";
      };
    };
  };
}

After rebuild, create a shortcut on your Windows desktop.

Set its target to:

C:\Windows\System32\wsl.exe -d NixOS --cd ~ -e /run/current-system/sw/bin/bash -l kitty

If you have a high DPI, you might need to set .wslgconfig in your Windows user folder.

[system-distro-env]
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment