与XMonad交配DE

时间:2012-10-27 21:34:56

标签: ubuntu xmonad mate-desktop

由于MATE只是GNOME2的一个分支,显然可以使用命令mateconftool-2 -s /desktop/mate/session/required_components/windowmanager xmonad --type string替换另一个窗口管理器(即xmonad)。这在我登录MATE时启动XMonad的意义上是有效的,但是,看起来xmonad正在尝试平铺面板或其他东西。其中一个面板填充了它不应该的所有空间(顶部和底部都是空的),系统完全无法使用(重启时间)。

我的xmonad.hs:

{-# LANGUAGE OverloadedStrings #-}

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import Control.Monad
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import qualified XMonad.Actions.FlexibleResize as Flex
import XMonad.Hooks.EwmhDesktops

import XMonad.Config.Desktop
import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
import XMonad.Layout.LayoutHints

import XMonad.Util.Run (safeSpawn)

import System.Environment (getEnvironment)

main = xmonad mateConfig

mateConfig = desktopConfig
            { logHook = spawn "wmname LG3D"
            , manageHook = myManageHook <+> manageHook mateConfig
            , workspaces = ["1", "2", "3", "4", "5", "="]
            , modMask = mod4Mask
            , terminal = "gnome-terminal"
            , startupHook = takeTopFocus >> setWMName "LG3D"
            , handleEventHook = fullscreenEventHook
            --, layoutHook = layoutHints $ avoidStruts (noBorders Full) ||| Mirror (Tall (1 (3/100) (1/2))) 
            , layoutHook = avoidStruts ((noBorders Full) ||| Mirror (Tall 1 (3/100) (1/2)))
         }

         `additionalKeys` [ ((mod4Mask, xK_d), spawn "dmenu_run -fn \"Ubuntu_Mono-13:Normal\" -nb black -nf skyblue -sb skyblue -sf black")
                           ,((mod4Mask, xK_v), spawn "gvim")
                           ,((mod4Mask, xK_x), spawn "gvim ~/.xmonad/xmonad.hs")
                           ,((mod4Mask, xK_p), spawn "gnome-terminal")
                           -- ,((0       , xF86XK_AudioPlay), spawn "echo \"PLAY\" > ~/Desktop/hi")
                            ]

         `additionalMouseBindings` [ ((mod4Mask, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
                                    ]


myManageHook = composeAll
    [ className =? "Amarok" --> doShift "="
    , manageDocks
    ]


{--- DBus Stuff-}
-- | Register xmonad with mate. 'dbus-send' must be in the $PATH with which
-- xmonad is started.
--
-- This action reduces a delay on startup only only if you have configured
-- mate-session>=2.26: to start xmonad with a command as such:
--
-- > mateconftool-2 -s /desktop/mate/session/required_components/windowmanager xmonad --type string
mateRegister :: MonadIO m => m ()
mateRegister = io $ do
    x <- lookup "DESKTOP_AUTOSTART_ID" `fmap` getEnvironment
    whenJust x $ \sessionId -> safeSpawn "dbus-send"
            ["--session"
            ,"--print-reply=string"
            ,"--dest=org.mate.SessionManager"
            ,"/org/mate/SessionManager"
            ,"org.mate.SessionManager.RegisterClient"
            ,"string:xmonad"
            ,"string:"++sessionId]




atom_WM_TAKE_FOCUS ::
  X Atom
atom_WM_TAKE_FOCUS =
  getAtom "WM_TAKE_FOCUS"

takeFocusX ::
  Window
  -> X ()
takeFocusX w =
  withWindowSet . const $ do
    dpy       <- asks display
    wmtakef   <- atom_WM_TAKE_FOCUS
    wmprot    <- atom_WM_PROTOCOLS
    protocols <- io $ getWMProtocols dpy w
    when (wmtakef `elem` protocols) $
      io . allocaXEvent $ \ev -> do
          setEventType ev clientMessage
          setClientMessageEvent ev w wmprot 32 wmtakef currentTime
          sendEvent dpy w False noEventMask ev

takeTopFocus ::
  X ()
takeTopFocus =
  withWindowSet $ maybe (setFocusX =<< asks theRoot) takeFocusX . W.peek

我唯一的假设是xmonad没有正确地忽略面板。

我正在使用从12.04升级的Ubuntu x64 12.10

编辑:我尝试在xmonad.hs中将className =? "mate-panel" --> doIgnore添加到manageHooks。没有区别。

2 个答案:

答案 0 :(得分:1)

我正在使用XMonad运行MATE。检查配置。在此repo

答案 1 :(得分:0)

啊,我找到了。我在manageHook部分的mateConfig部分犯了一个愚蠢的错误。行manageHook = myManageHook <+> manageHook mateConfig并没有真正意义,因为它指的是mateConfig,它仍然由这一行定义。它应该是manageHook = myManageHook <+> manageHook desktopConfig。 mateConfig应该是desktopConfig。

此外,logHook,handleEventHook等......缺少<+> *Hook desktopConfig部分,它打破了一大堆东西。