Where It All Started.

Where It All Started.

Life, Stock Trading, Investments, Business and Startup. Most are programming stuff.

Tag: desktop

Limit Window Subsystem Linux v2 (WSL2) Resources To Speed Up Kubernetes

Window Subsystem Linux v2 (WSL2) is an iteration of the VM created by Microsoft, from Hyper-V to WSL and this the second generation of WSL. If it’s your first time accessing WSL2, it automatically provide you with the default setup which doesn’t provide any limits accessing your full workstation resources (CPU, RAM and other HDD). It means that if you have 8 cores cpu and 16Gb memory, it will use all that up. The problem with it is sometimes it affects your host computer and it gets slow. So to solve that problem we try to limit the resource consumption of WSL2.

Photo by Sadik Brika on Unsplash

Limit WSL Resource Consumption

On your profile directory %USERPROFILE% create a new file named .wslconfig. Set it’s content to the following:

[wsl2]
memory=8GB
processors=8

Change the settings base on your workstation capability, and this is what works for me.

Next, open up a powershell terminal in administrator mode and restart the LxssManager as this manages WSL2.

Get-Service LxssManager | Restart-Service

You could also use the wsl --shutdown method to restart WSL. Check if the vmmem process still consumes beyond its limit.

Troubleshoot

If the changes still not reflecting, try to restart your machine and also restart Docker Desktop.

Changing Xserver Default Applications Using XDG Tools

XDG (freedesktop.org) which stands for X Desktop Group is a group which develop the X11 and xdg utilities which currently runs as barebones of linux desktop. So how do we change the defaults when opening a file on XServer?

Be free, and live life fully.

β€” Caroline Shaw.

So how do we configure XDG?

Tools that we will be using to configure xdg can be found in xdg-utils package (utilities like xdg-settings and xdg-mime).
So to set the default application to open a certain mime type, you need run the code below:

xdg-mime default Thunar.desktop inode/directory

The command above would add the new mime application settings to ~/.local/share/applications/defaults.list. It basically tells xdg-mime to open a directory using Thunar (XFCE filemanager).

Fun Fact

  1. freedesktop.org (fd.o) is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operating systems. It was founded by Havoc Pennington, a GNOME developer working for Red Hat in March 2000. The project’s servers are hosted by Portland State University, sponsored by Hewlett-Packard, Intel, and Google. β†©οΈŽ