mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 20:51:52 -07:00
Add a binding for Gnome's "Run Application" dialog
This commit is contained in:
@@ -14,12 +14,15 @@
|
|||||||
module XMonad.Config.Gnome (
|
module XMonad.Config.Gnome (
|
||||||
-- * Usage
|
-- * Usage
|
||||||
-- -- $usage
|
-- -- $usage
|
||||||
gnomeConfig
|
gnomeConfig,
|
||||||
|
gnomeRun
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Config.Desktop
|
import XMonad.Config.Desktop
|
||||||
|
|
||||||
|
import qualified Data.Map as M
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- To use this module, start with the following @~\/.xmonad\/xmonad.hs@:
|
-- To use this module, start with the following @~\/.xmonad\/xmonad.hs@:
|
||||||
--
|
--
|
||||||
@@ -29,4 +32,23 @@ import XMonad.Config.Desktop
|
|||||||
-- > main = xmonad gnomeConfig
|
-- > main = xmonad gnomeConfig
|
||||||
--
|
--
|
||||||
|
|
||||||
gnomeConfig = desktopConfig { terminal = "gnome-terminal" }
|
gnomeConfig = desktopConfig
|
||||||
|
{ terminal = "gnome-terminal"
|
||||||
|
, keys = \c -> gnomeKeys c `M.union` keys desktopConfig c }
|
||||||
|
|
||||||
|
gnomeKeys (XConfig {modMask = modm}) = M.fromList $
|
||||||
|
[ ((modm, xK_p), gnomeRun) ]
|
||||||
|
|
||||||
|
-- | Launch the "Run Application" dialog. gnome-panel must be running for this
|
||||||
|
-- to work.
|
||||||
|
gnomeRun :: X ()
|
||||||
|
gnomeRun = withDisplay $ \dpy -> do
|
||||||
|
rw <- asks theRoot
|
||||||
|
gnome_panel <- getAtom "_GNOME_PANEL_ACTION"
|
||||||
|
panel_run <- getAtom "_GNOME_PANEL_ACTION_RUN_DIALOG"
|
||||||
|
|
||||||
|
io $ allocaXEvent $ \e -> do
|
||||||
|
setEventType e clientMessage
|
||||||
|
setClientMessageEvent e rw gnome_panel 32 panel_run 0
|
||||||
|
sendEvent dpy rw False structureNotifyMask e
|
||||||
|
sync dpy False
|
||||||
|
Reference in New Issue
Block a user