Ghidra on labwc on Wayland on NixOS

I recently wanted to peek at a binary with Ghidra but after initialization it just showed a grey window. The problem lies with the Java UI library used which looks up the environment's window manager within a hardcoded list of window managers. Unfortunately, this list doesn't include the WM I use: labwc.

The solution is to simply impersonate a WM that is on the list. We can do this with the wmname tool. There is a handy nixpkg available for wmname as well. To actually get Ghidra to go, we first execute
wmname LG3D
Now Ghidra should display the main window.

Be sure to grab a dark theme for Ghidra while you're at it. Happy reversing!