I had this issue, then compiled emacs
--with-pgtk
and fonts became way better.However, recently, wsl2 was updated in my win11 and out of curiosity I had recompiled emacs without pgtk and fonts are actually crisp and look the same as
--with-pgtk
.I am staying with X due to better clipboard support, though, ugly white borders are something you have to “embrace” :)
It looks a lot like when an app doesn’t know about the current fractional scaling. Are you doing any scaling?
I find it looks and performs* better in WSL1 with GWSL
*until I access files in the Windows volumes.
I didn’t know gwsl works for wsl1. I’m gonna give it a try. WSL1 is so much better if you exclude missing syscalls.
To get rid of the ugly border you can recompile wslg and set the colors to something different. You can also use something like X410 to handle your X windows, which is where I ended up.
Interesting. I’ll have to investigate. I use wsl2 and always have. I’ll report back if I notice some differences.
First and foremost these are different fonts, so it’s hard to draw a comparison. However, I do agree that the font used in the gui lacks crispness.
You can try emacs-pgtk package, cause WSLg relies on Wayland
Yep that’s what finally caused me to switch to using Emacs on WSL2 (instead of the Windows build). Then you can also get rid of that ugly white border from WSLg.
any details on that white border stuff? pgtk didnt autofix it for me in the past and id love to not have it searing my eyes
Not sure if there’s something else missing in your setup. I’m using WSL2 (Ubuntu), and in my case all I had to do was compile Emacs passing the
--with-pgtk
flag, then:sudo apt install gnome-tweaks yaru-theme-gtk yaru-theme-icons
And ran
gnome-tweaks
in the terminal, and changed the application and icon themes to Yaru-dark.that sometimes happens when wslg has issues with bind mounting the runtime dir from the system distro or runtime dir permissions, were you by chance using it with a uid != 1000?
I downloaded the source code for emacs and compiling it locally with the --with-pgtk flag. (And --with-native-compilation for better performance)
That made my life improve a lot.
You can also install pgtk emacs directly from snaps when under Ubuntu in wsl, if you prefer.
I get a warning when compiling emacs from source with the pgtk flag telling me about a known bug in my version of gtk that causes problems when opening and closing multiple emacs instances. Do you know anything about this? In particular would it be resolved by switching to the snap?
I have no idea about that compilation issue you get. Since the emacs snaps (pgtk and x) are pre built binaries, you wont get that problem. Ive been using Emacs PGTK from snaps on WSLg for a year without any issue.
takes notes
Looks like you have application scaling enabled.
My fonts look OK but they’re different fonts (and I’m running Citrix thin clients etc so that may well be messing with ability to do sub-pixel tweaking etc).
And I actually like my “native” and “wsl” emacs to look different… I share init.el files (~/.emacs.d/ is a symlink to /mnt/c/Users/… etc) but make sure I use different themes and change the frame title to make it easy to distinguish between the two instances.
I know I could do it all in just one instance but somehow this just feels cleaner for my cross-platform dev work…
just use
M-x set-frame-font
to adjust font settings and improve crispness in wsl2.Just run the native Windows binary of Emacs. It uses the native Windows font rendering APIs, so the text should end looking the same as it does in other Windows applications (assuming it’s the same font and size, of course). The Linux version that you’re running uses a completely different font renderer, so it will be very hard to make it match exactly.
I don’t know much about wsl but they probably want to develop on headless linux why still being able to use GUI Emacs.
That doesn’t make any sense. WSL is not a headless Linux.
It actually is, you can’t run a desktop enviroment with it for example but it does let you open linux gui apps to be used from windows.
That’s exactly why it’s not headless.