summaryrefslogtreecommitdiffstats
path: root/XMonad.hs
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2007-06-04 03:39:38 +0200
committerStefan O'Rear <stefanor@cox.net>2007-06-04 03:39:38 +0200
commitba5df371e716f720fb4fcea769983dbb596fd75b (patch)
tree87f7c9dfae0cc1597d9151974dccff52f7c45f86 /XMonad.hs
parent70745502cf6771981a2a89281a06d4fa194ecaa0 (diff)
downloadmetatile-ba5df371e716f720fb4fcea769983dbb596fd75b.tar
metatile-ba5df371e716f720fb4fcea769983dbb596fd75b.zip
do not cache atom values within Xmonad, instead let Xlib worry about caching (a documented feature)
darcs-hash:20070604013938-e3110-8dc84f03278c55076a5cf83013974689c4861ffc
Diffstat (limited to 'XMonad.hs')
-rw-r--r--XMonad.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/XMonad.hs b/XMonad.hs
index 9f89f19..df60e23 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -17,7 +17,7 @@
module XMonad (
X, WindowSet, WorkspaceId(..), ScreenId(..), XState(..), XConf(..), Layout(..),
- Typeable, Message, SomeMessage(..), fromMessage,
+ Typeable, Message, SomeMessage(..), fromMessage, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW,
runX, io, withDisplay, withWindowSet, isRoot, spawn, restart, trace, whenJust, whenX
) where
@@ -26,6 +26,7 @@ import StackSet (StackSet)
import Control.Monad.State
import Control.Monad.Reader
import System.IO
+import System.IO.Unsafe (unsafePerformIO)
import System.Posix.Process (executeFile, forkProcess, getProcessStatus, createSession)
import System.Exit
import System.Environment
@@ -47,8 +48,6 @@ data XState = XState
data XConf = XConf
{ display :: Display -- ^ the X11 display
, theRoot :: !Window -- ^ the root window
- , wmdelete :: !Atom -- ^ window deletion atom
- , wmprotocols :: !Atom -- ^ wm protocols atom
, normalBorder :: !Color -- ^ border color of unfocused windows
, focusedBorder :: !Color } -- ^ border color of the focused window
@@ -92,6 +91,15 @@ withWindowSet f = gets windowset >>= f
isRoot :: Window -> X Bool
isRoot w = liftM (w==) (asks theRoot)
+-- | Wrapper for the common case of atom internment
+getAtom :: String -> X Atom
+getAtom str = withDisplay $ \dpy -> io $ internAtom dpy str False
+
+-- | Common non-predefined atoms
+atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW :: X Atom
+atom_WM_PROTOCOLS = getAtom "WM_PROTOCOLS"
+atom_WM_DELETE_WINDOW = getAtom "WM_DELETE_WINDOW"
+
------------------------------------------------------------------------
-- Layout handling