aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Hooks
diff options
context:
space:
mode:
authormail <mail@n-sch.de>2009-09-15 12:13:27 +0200
committermail <mail@n-sch.de>2009-09-15 12:13:27 +0200
commita343d09be11a512c48611b2abbb9d270ff71e75e (patch)
treed60f666fc8fc8ce2c1018d6c8fda92171d37e3ee /XMonad/Hooks
parent1d65f9b570f0ba5f2167c8d80e53331f6b68fd79 (diff)
downloadXMonadContrib-a343d09be11a512c48611b2abbb9d270ff71e75e.tar.gz
XMonadContrib-a343d09be11a512c48611b2abbb9d270ff71e75e.tar.xz
XMonadContrib-a343d09be11a512c48611b2abbb9d270ff71e75e.zip
New module : X.H.SetCursor
Ignore-this: 2f0641155ada05dae955cd6941d52b70 Idea from Andres Salomon (http://www.haskell.org/pipermail/xmonad/2009-September/008553.html). darcs-hash:20090915101327-e34a6-113517da012281d809388a260dd7ab5ca6e2078d.gz
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r--XMonad/Hooks/SetCursor.hs47
1 files changed, 47 insertions, 0 deletions
diff --git a/XMonad/Hooks/SetCursor.hs b/XMonad/Hooks/SetCursor.hs
new file mode 100644
index 0000000..047d582
--- /dev/null
+++ b/XMonad/Hooks/SetCursor.hs
@@ -0,0 +1,47 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonad.Hooks.SetCursor
+-- Copyright : (c) 2009 Nils Schweinsberg
+-- License : BSD3-style (see LICENSE)
+--
+-- Maintainer : Nils Schweinsberg <mail@n-sch.de>
+-- Stability : unstable
+-- Portability : unportable
+--
+-- Set a default cursor on startup.
+--
+-- Thanks to Andres Salomon for his initial idea for this startup hook.
+--
+-----------------------------------------------------------------------------
+
+module XMonad.Hooks.SetCursor (
+ -- * Usage
+ -- $usage
+ setDefaultCursor
+ ) where
+
+import XMonad
+
+{- $usage
+
+To use this startup hook add a line to your startup hook:
+
+> myStartupHook = do
+> setDefaultCursor 68
+> -- more stuff
+
+Where @68@ is the default left pointer.
+
+-}
+
+-- | Set the default (root) cursor
+setDefaultCursor :: Glyph -- ^ the cursor to use
+ -> X ()
+setDefaultCursor glyph = do
+ dpy <- asks display
+ rootw <- asks theRoot
+ liftIO $ do
+ curs <- createFontCursor dpy glyph
+ defineCursor dpy rootw curs
+ flush dpy
+ freeCursor dpy curs