You are not logged in.

#1 2011-11-30 16:53:33

Registered: 2011-05-26
Posts: 5

[SOLVED] Xmonad not transferring control of mouse to Minecraft

Let me start by saying that I know this is an Xmonad issue. I have Minecraft running perfectly in XFCE.

Minecraft is one of those games which in order for it to function properly, it has to (for lack of a better word) "steal" the mouse. Xmonad won't let it do that. When I load a map (multiplayer or otherwise) it starts me out in the game options screen. Normally I click "return to game," the cursor disappears and I play normally. In Xmonad, it makes the sound for click confirmation but stays in the options. I've tried turning borders off, setting Minecraft to be floating automatically, and setting the WMName to "LG3D" (which works for the screen resizes but not the problem I'm having.)

Currently  my only workaround is to run Minecraft in fullscreen mode (F11). Anyone else ran into this problem and managed to fix it?

Thanks in advance :3

Last edited by Cyphus (2011-12-16 21:13:13)


#2 2011-12-16 21:21:25

Registered: 2011-05-26
Posts: 5

Re: [SOLVED] Xmonad not transferring control of mouse to Minecraft

Found a solution on my own. I'll leave this information here for future searches:

When you turn off borders, you must make sure that you TURN OFF borders. Don't set borderWidth to 0; instead you must import XMonad.Layout.NoBorders and then set noBorders somewhere in your layoutHook. Here's my implementation that handles noBorders nicely with a PerWorkspace layout:

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.Spacing
import XMonad.Layout.NoBorders
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.InsertPosition
import XMonad.Util.Dmenu
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myManageHook = composeAll
    [ className =? "net-minecraft-LauncherFrame" --> doShift "4:media"
    , className =? "net-minecraft-LauncherFrame" --> doFloat
    , manageDocks]

myWorkspaces = ["1:main", "2:social", "3:dev", "4:media", "5:monitor", "6", "7", "8"]
defaultLayout = tiled ||| Mirror tiled ||| Full
    tiled = spacing 5 $ Tall nmaster delta ratio
    nmaster = 1
    ratio = 3/5
    delta = 5/100

mediaLayout = noBorders $ Full
myLayout = onWorkspace "4:media" mediaLayout $ defaultLayout
main = do
  xmproc <- spawnPipe "/usr/bin/xmobar ~/.xmobarrc"
  xmonad $ defaultConfig
      manageHook = insertPosition Below Newer <+> myManageHook
    , layoutHook = avoidStruts $ myLayout
    , logHook = dynamicLogWithPP xmobarPP
      { ppOutput = hPutStrLn xmproc
      , ppTitle = xmobarColor "green" "" . shorten 150
    , terminal           = "urxvt" 
    , modMask            = mod4Mask
    , workspaces = myWorkspaces
      -- keeps Minecraft in line
    , startupHook = setWMName "LG3D"
    , borderWidth        = 2
      -- border colors set to match 256 color terminal PS1
    , normalBorderColor  = "#0087ff"
    , focusedBorderColor = "#5fd700"
    } `additionalKeys`
    [ ((mod4Mask .|. shiftMask, xK_l), spawn "xscreensaver-command -lock")
    , ((mod4Mask,               xK_v), spawn "gvim")
    , ((mod4Mask,               xK_p), spawn "dmenu_run")


#3 2012-11-26 00:43:40

Registered: 2012-10-04
Posts: 25

Re: [SOLVED] Xmonad not transferring control of mouse to Minecraft

Hmm, mine doesn't seem to work very well.  I've added `className =? "net-minecraft-LauncherFrame" --> doFloat` to my manage hook, but that doesn't seem to have any effect.  What do I need to add?  Reading your xmonad.hs file it seems like this'll effect all applications on the 4th workspace, is that true?  if so, will minecraft not work on the other workspaces?  Thanks,



#4 2012-12-05 00:45:26

Registered: 2012-12-05
Posts: 1

Re: [SOLVED] Xmonad not transferring control of mouse to Minecraft

I was having the same problem - it turns out the class name of the Minecraft window had changed. Using xprop to get the class name and following the OP's setup using "net-minecraft-MinecraftLauncher" worked as expected.

This was quite an annoying issue!


Board footer

Powered by FluxBB