3

由于 MATE 只是 GNOME2 的一个分支,显然可以使用以下命令将窗口管理器替换为另一个(即 xmonad)mateconftool-2 -s /desktop/mate/session/required_components/windowmanager xmonad --type string:. 这在我登录 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

编辑:我尝试添加className =? "mate-panel" --> doIgnore到 xmonad.hs 中的 manageHooks。没有不同。

4

2 回答 2

1

我正在使用 XMonad 运行 MATE。检查配置。在这个回购

于 2013-01-21T16:19:43.230 回答
0

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

此外,logHook、handleEventHook 等...缺少<+> *Hook desktopConfig部分,这会破坏一大堆东西。

于 2012-11-06T20:27:55.883 回答