diff options
author | allbery.b <allbery.b@gmail.com> | 2014-08-03 04:06:59 +0200 |
---|---|---|
committer | allbery.b <allbery.b@gmail.com> | 2014-08-03 04:06:59 +0200 |
commit | e41a6f2c909bce695a3127d37de0044ab0b6fbcb (patch) | |
tree | c5d4bf17a664f1af9a37cc269ce72a1fcbf333d1 | |
parent | f2ea4ff515f3f3b0f16616fb11df907ac7f60f47 (diff) | |
download | XMonadContrib-e41a6f2c909bce695a3127d37de0044ab0b6fbcb.tar.gz XMonadContrib-e41a6f2c909bce695a3127d37de0044ab0b6fbcb.tar.xz XMonadContrib-e41a6f2c909bce695a3127d37de0044ab0b6fbcb.zip |
config-mate
Ignore-this: d5de258c0a28cd5ba64a59cf37cd480a
Initial support for the Mate desktop environment (http://mate-desktop.org).
Based on existing Gnome 2 support, since Mate is a maintained fork of
Gnome 2.
darcs-hash:20140803020659-181ff-928c8525cae12676dc77ca7cb299f86421969a40.gz
-rw-r--r-- | XMonad/Config/Mate.hs | 85 | ||||
-rw-r--r-- | xmonad-contrib.cabal | 1 |
2 files changed, 86 insertions, 0 deletions
diff --git a/XMonad/Config/Mate.hs b/XMonad/Config/Mate.hs new file mode 100644 index 0000000..153b259 --- /dev/null +++ b/XMonad/Config/Mate.hs @@ -0,0 +1,85 @@ +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} + +----------------------------------------------------------------------------- +-- | +-- Module : XMonad.Config.Mate +-- Copyright : (c) Brandon S Allbery KF8NH, 2014 +-- License : BSD +-- +-- Maintainer : allbery.b@gmail.com +-- Stability : unstable +-- Portability : unportable +-- +-- This module provides a config suitable for use with the MATE desktop +-- environment. +-- +----------------------------------------------------------------------------- + +module XMonad.Config.Mate ( + -- * Usage + -- $usage + mateConfig, + mateRun, + mateRegister + ) where + +import XMonad +import XMonad.Config.Desktop +import XMonad.Util.Run (safeSpawn) + +import qualified Data.Map as M + +import System.Environment (getEnvironment) + +-- $usage +-- To use this module, start with the following @~\/.xmonad\/xmonad.hs@: +-- +-- > import XMonad +-- > import XMonad.Config.Mate +-- > +-- > main = xmonad gnomeConfig +-- +-- For examples of how to further customize @gnomeConfig@ see "XMonad.Config.Desktop". + +mateConfig = desktopConfig + { terminal = "mate-terminal" + , keys = mateKeys <+> keys desktopConfig + , startupHook = mateRegister >> startupHook desktopConfig } + +mateKeys (XConfig {modMask = modm}) = M.fromList $ + [ ((modm, xK_p), mateRun) + , ((modm .|. shiftMask, xK_q), spawn "mate-session-save --logout-dialog") ] + +-- | Launch the "Run Application" dialog. gnome-panel must be running for this +-- to work. +mateRun :: X () +mateRun = withDisplay $ \dpy -> do + rw <- asks theRoot + mate_panel <- getAtom "_MATE_PANEL_ACTION" + panel_run <- getAtom "_MATE_PANEL_ACTION_RUN_DIALOG" + + io $ allocaXEvent $ \e -> do + setEventType e clientMessage + setClientMessageEvent e rw mate_panel 32 panel_run 0 + sendEvent dpy rw False structureNotifyMask e + sync dpy False + +-- | 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 to start xmonad with a command such as (check local +-- documentation): +-- +-- > gconftool-2 -s /desktop/gnome/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=literal" + ,"--dest=org.mate.SessionManager" + ,"/org/mate/SessionManager" + ,"org.mate.SessionManager.RegisterClient" + ,"string:xmonad" + ,"string:"++sessionId] diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index 698a40c..c7c59e9 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -151,6 +151,7 @@ library XMonad.Config.Droundy XMonad.Config.Gnome XMonad.Config.Kde + XMonad.Config.Mate XMonad.Config.Sjanssen XMonad.Config.Xfce XMonad.Hooks.CurrentWorkspaceOnTop |