diff options
author | Adam Vogt <vogt.adam@gmail.com> | 2009-09-18 01:21:50 +0200 |
---|---|---|
committer | Adam Vogt <vogt.adam@gmail.com> | 2009-09-18 01:21:50 +0200 |
commit | 96ac00bed28fb3e30a8db4d1426a4d2c32a1730f (patch) | |
tree | aaac66ca284caf8f5cdd02babd98f78d53a0506a /XMonad/Config | |
parent | d1f30705f1ecca6ecc5c3fd52411c56d8e0f7525 (diff) | |
download | XMonadContrib-96ac00bed28fb3e30a8db4d1426a4d2c32a1730f.tar.gz XMonadContrib-96ac00bed28fb3e30a8db4d1426a4d2c32a1730f.tar.xz XMonadContrib-96ac00bed28fb3e30a8db4d1426a4d2c32a1730f.zip |
Add gnomeRegister to C.Gnome.
Ignore-this: 5b2960004418c04bdbb921e3aa777fc2
Credit to Joachim Breitner here:
http://www.haskell.org/pipermail/xmonad/2009-May/007984.html
darcs-hash:20090917232150-1499c-e3dcf06bb7ef538057bfc7ed7c593d880c8a2574.gz
Diffstat (limited to 'XMonad/Config')
-rw-r--r-- | XMonad/Config/Gnome.hs | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/XMonad/Config/Gnome.hs b/XMonad/Config/Gnome.hs index abb73f0..6b1e94f 100644 --- a/XMonad/Config/Gnome.hs +++ b/XMonad/Config/Gnome.hs @@ -15,7 +15,8 @@ module XMonad.Config.Gnome ( -- * Usage -- $usage gnomeConfig, - gnomeRun + gnomeRun, + gnomeRegister ) where import XMonad @@ -23,14 +24,20 @@ import XMonad.Config.Desktop import qualified Data.Map as M +import System.Environment (getEnvironment) +import System.Cmd (rawSystem) + +import Control.Concurrent (forkIO) + -- $usage -- To use this module, start with the following @~\/.xmonad\/xmonad.hs@: -- -- > import XMonad -- > import XMonad.Config.Gnome -- > --- > main = xmonad gnomeConfig --- +-- > main = do +-- > gnomeRegister +-- > xmonad gnomeConfig gnomeConfig = desktopConfig { terminal = "gnome-terminal" @@ -53,3 +60,24 @@ gnomeRun = withDisplay $ \dpy -> do setClientMessageEvent e rw gnome_panel 32 panel_run 0 sendEvent dpy rw False structureNotifyMask e sync dpy False + +-- | Register xmonad with gnome. '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 +-- gnome-session>=2.26: to start xmonad with a command as such: +-- +-- > gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string +gnomeRegister :: IO () +gnomeRegister = do + let void_ = fmap (const ()) + x <- lookup "DESKTOP_AUTOSTART_ID" `fmap` getEnvironment + whenJust x $ \sessionId -> void_ $ forkIO $ void_ $ + rawSystem "dbus-send" + ["--session" + ,"--print-reply=string" + ,"--dest=org.gnome.SessionManager" + ,"/org/gnome/SessionManager" + ,"org.gnome.SessionManager.RegisterClient" + ,"string:xmonad" + ,"string:"++sessionId] |