Xmonad/Config archive/Kapil gnomemenuadd.hs
< Xmonad | Config archive
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This gives a hacky solution to Issue 451 in xmonad
import XMonad
import XMonad.Config.Gnome
import XMonad.Config.Desktop
import Control.Concurrent (threadDelay)
import qualified Data.Map as M
main = xmonad $ gnomeConfig {
,keys = addlKeys <+> keys desktopConfig
}
addlKeys conf@(XConfig {modMask = modm}) = M.fromList $
[ ((modm, xK_F1), gnomeMenu) ]
gnomeMenu :: X ()
gnomeMenu = withDisplay $ \dpy -> do
rw <- asks theRoot
gnome_panel <- getAtom "_GNOME_PANEL_ACTION"
panel_menu <- getAtom "_GNOME_PANEL_ACTION_MAIN_MENU"
-- a "magic" delay that just makes this work. The problem
-- is specified at
-- https://code.google.com/p/xmonad/issue/detail?id=451
-- Increase the delay if it doesn't work for you.
io $ threadDelay 200000
io $ allocaXEvent $ \e -> do
setEventType e clientMessage
setClientMessageEvent e rw gnome_panel 32 panel_menu 0
sendEvent dpy rw False structureNotifyMask e
sync dpy False