Starting from version 3.7.0, X410 supports running JetBrains products such as IntelliJ IDEA in their new UI without the native Windows title bar. However, JetBrains recently added some codes to disable that new UI feature for WSL. It seems JetBrains was trying to fix the following problem and ended up penalizing WSL and SSH X11 forwarding users.
Menu bar missing on all windows except one on tiling WM / under WSLgAnyhow, while investigating this problem, we found the following snippets in IntelliJ IDEA Community Edition open-source codes.
internal val hideNativeLinuxTitleSupported: Boolean
get() = SystemInfoRt.isUnix && !SystemInfoRt.isMac
&& ExperimentalUI.isNewUI()
&& JBR.isWindowMoveSupported()
&& ((StartupUiUtil.isXToolkit() && !X11UiUtil.isWSL() && !X11UiUtil.isTileWM() && !X11UiUtil.isUndefinedDesktop())
|| StartupUiUtil.isWaylandToolkit())
public static boolean isWSL() {
return SystemInfoRt.isUnix && !SystemInfoRt.isMac && System.getenv("WSL_DISTRO_NAME") != null;
}
public static boolean isUndefinedDesktop() {
String desktop = System.getenv("XDG_CURRENT_DESKTOP");
return SystemInfoRt.isUnix && !SystemInfoRt.isMac && desktop == null;
}
As you can see from the codes, IntelliJ IDEA specifically checks for WSL and disables its title bar hiding feature regardless of the X server it runs on. Hence, this issue cannot be fixed from X410. But fortunately, you should be able to trick IntelliJ IDEA by removing the environment variable it uses for identifying WSL, i.e., WSL_DISTRO_NAME, before launching it. You can execute the following command to remove the variable.
unset WSL_DISTRO_NAME
Unsetting WSL_DISTRO_NAME
environment variable should also work for other JetBrains products as they share their source codes. Since WSL_DISTRO_NAME is rarely used in WSL, removing it should have minimal impact on running other Linux GUI apps. You can of course also restore it back to its original value once your JetBrains product is started.
You should also be able to notice from the snippets shown above that IntelliJ IDEA also checks for the environment variable that denotes the current GUI desktop. That variable is XDG_CURRENT_DESKTOP
. XDG_CURRENT_DESKTOP
is not just for WSL, but it is never automatically added when you first install WSL. Hence, you need to manually define the variable before launching IntelliJ IDEA. It can be set to any text such as shown below.
export XDG_CURRENT_DESKTOP=X410
Along with XDG_CURRENT_DESKTOP
, there are other environment variables commonly defined for a Linux GUI desktop. If you are using an Ubuntu based WSL, we recommend adding the environment variables listed in the following post to your login startup script; XDG_CURRENT_DESKTOP
should also be set to ubuntu:GNOME
instead of the one shown above.
Step 10. Set up additional environment variables for Ubuntu desktop
You should also create default folders (ex. Documents, Pictures etc.) commonly found in a Linux GUI desktop as shown in the following post. Some Linux GUI apps expect those folders to exist already.
SSH X11 Forwarding
If you are using a JetBrains product running in a regular Linux machine over SSH X11 forwarding, you just need to ensure the XDG_CURRENT_DESKTOP
environment variable for the same reason described above. If you want to automatically set the variable just for SSH X11 forwarding sessions, you can add something similar to the following snippet to your login script (ex. ~\.bashrc).
if [ -n "${SSH_TTY}" ] && [ -n "${DISPLAY}" ] && [ -z "${XDG_CURRENT_DESKTOP}" ]; then
export XDG_CURRENT_DESKTOP=X410
fi
If you already have a GUI desktop environment set up for your Linux machine, you should be able to get the default XDG_CURRENT_DESKTOP
environment variable by executing the following command from a graphical terminal on your GUI desktop and use the same value for the login script snippet shown above.
env | grep XDG_CURRENT_DESKTOP
if [ -n "${SSH_TTY}" ] && [ -n "${DISPLAY}" ] && [ -z "${XDG_CURRENT_DESKTOP}" ]; then
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
fi