11

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?

Brian
  • 20,195
  • 6
  • 34
  • 55

2 Answers2

11

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

Martin Marconcini
  • 26,875
  • 19
  • 106
  • 144
Brian
  • 20,195
  • 6
  • 34
  • 55
  • the import should be `Monad.Hooks.SetWMName`. I wonder why StackOverflow doesn't allow edits that change only one character. – Haemin Yoo Aug 03 '18 at 07:44
  • This works for Android Studio (3.6.x at the moment) on a fresh Ubuntu where you install XMonad and launch Android Studio. – Martin Marconcini May 20 '20 at 12:34
3

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

import XMonad
import XMonad.Hooks.SetWMName

main = xmonad defaultConfig
    { startupHook = setWMName "LG3D" }
David Kay
  • 1,006
  • 10
  • 16