如何让 xmonad 与 Gnome 3 兼容?

如何让 xmonad 与 Gnome 3 兼容?

如何让 xmonad 与 Gnome 3 协同工作?

-Sidenote,有些命令(例如重新编译 xmonad ( Alt+ Q) 和退出 ( Alt+ Shift+ Q) 以及 dmenu ( Alt+ P))除非我将它们添加到 xmonad.hs 文件中,否则无法使用,而其他命令则可以。但是,其余命令(例如在工作区之间切换、打开终端、更改布局)无法使用,所以我必须添加所有这些命令,这很奇怪。

import XMonad
import XMonad.Config.Gnome
import System.Exit
import qualified Data.Map as M
import qualified XMonad.StackSet as W

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    -- launch dmenu
    [ ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")

    -- Start a terminal.  Terminal to start is specified by myTerminal variable.
    , ((modm .|. shiftMask, xK_Return), spawn "gnome-terminal")

 -- Rotate through the available layout algorithms
    , ((modm,               xK_space ), sendMessage NextLayout)

    --  Reset the layouts on the current workspace to default
    , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)

    -- Resize viewed windows to the correct size
    , ((modm,               xK_n     ), refresh)

    -- Move focus to the next window
    , ((modm,               xK_Tab   ), windows W.focusDown)

    -- Move focus to the next window
    , ((modm,               xK_j     ), windows W.focusDown)

    -- Move focus to the previous window
    , ((modm,               xK_k     ), windows W.focusUp  )

    -- Move focus to the master window
    , ((modm,               xK_m     ), windows W.focusMaster  )

    -- Swap the focused window and the master window
    , ((modm,               xK_Return), windows W.swapMaster)

    -- Swap the focused window with the next window
    , ((modm .|. shiftMask, xK_j     ), windows W.swapDown  )

    -- Swap the focused window with the previous window
    , ((modm .|. shiftMask, xK_k     ), windows W.swapUp    )

    -- Shrink the master area
    , ((modm,               xK_h     ), sendMessage Shrink)

    -- Expand the master area
    , ((modm,               xK_l     ), sendMessage Expand)

    -- Push window back into tiling
    , ((modm,               xK_t     ), withFocused $ windows . W.sink)

    -- Increment the number of windows in the master area
    , ((modm              , xK_comma ), sendMessage (IncMasterN 1))

    -- Deincrement the number of windows in the master area
    , ((modm              , xK_period), sendMessage (IncMasterN (-1)))

    -- close focused window
    , ((modm .|. shiftMask, xK_c     ), kill)

    -- Quit xmonad
    , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))

    -- Restart xmonad
    , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
    ]
    ++

    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

myManageHook = composeAll (
    [ manageHook gnomeConfig
    , className =? "Unity-2d-panel" --> doIgnore
    , className =? "Unity-2d-launcher" --> doFloat
    ])

main = xmonad gnomeConfig { manageHook = myManageHook, keys = myKeys }

/usr/share/gnome-session/sessions/xmonad.session

[GNOME Session]
Name=Xmonad/GNOME
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;notifications;
DefaultProvider-windowmanager=xmonad
DefaultProvider-notifications=notification-daemon

/usr/share/xsessions/xmonad

[Desktop Entry]
Name=Xmonad/GNOME
Comment=Tiling window manager
Exec=gnome-session --session=xmonad
TryExec=/usr/bin/gnome-session
Type=XSession

相关内容