-
Notifications
You must be signed in to change notification settings - Fork 0
Windows Subsystem for Linux
Stuart Hicks edited this page Apr 18, 2024
·
4 revisions
These snippets only work in WSL2.
https://x410.dev/ (This should also work for any other third-party X server)
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
https://github.com/microsoft/wslg
export DISPLAY=:0
This makes the default browser in Windows, the default browser in WSL.
export BROWSER="powershell.exe /C start"
(If your WSL distro has wslutilities installed, then you can also register wslview to update the default browser, eg wslview -r
).
https://github.com/Chronial/wsl-sudo
This is only really useful if you free up a load of space within WSL, and then want to shrink the volume to make more space available to Windows. Make a copy of this script, and update the path to the WSL virtual disk depending on your system:
select vdisk file="C:\Users\stuar\AppData\Local\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState\ext4.vhdx"
compact vdisk
- Shut down WSL using
wsl --shutdown
in Windows. - Open a PowerShell prompt with elevated permissions.
- Launch
diskpart
with the path to the script, eg:diskpart /s C:\Users\stuar\Documents\shrink_wsl.txt
- If it fails, reboot and try again (likely something keeping a file handle open on the vhdx file).
- Shut down WSL:
wsl --shutdown
- Navigate to
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\{f063e071-a1b6-48b3-a125-366eebf80011}]
in the windows registry (this is for fedoraremix. The UUID will be different for different WSL distros. Find the right one for your system) - Set BasePath to the new directory that will contain the ext4.vhdx file.
- Move the file to the new target dir.
- Done!