Java Swing GUI Not Displaying in Xmonad

2.1k views Asked by At

I have a Java swing GUI that runs and displays fine using other window managers but when I run it in Xmonad it does not display correctly. All that displays is the frame of the window which is grayed out with no buttons, menus, etc. How can I make the Swing GUI display correctly?

2

There are 2 answers

2
Brian On

In ~/.xmonad/xmonad.hs add import XMonad.Hooks.SetWMName.

Then add startupHook = setWMName "LG3D" to tell Xmonad to use LG3D as the window manager name.

xmonad $ defaultConfig
  { ...
    startupHook = setWMName "LG3D",
  }

Lastly, restart Xmonad using mod-q to reload xmonad.hs.

Sources:

http://thinkingeek.com/2012/01/24/fix-java-gui-applications-xmonad/

http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html

1
David Kay On

For a 100% explicit answer, just paste this into ~/.xmonad/xmonad.hs:

import XMonad
import XMonad.Hooks.SetWMName

main = xmonad defaultConfig
    { startupHook = setWMName "LG3D" }