aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Util
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@collabora.co.uk>2009-09-15 18:56:04 +0200
committerAndres Salomon <dilinger@collabora.co.uk>2009-09-15 18:56:04 +0200
commitcd29d500d627ad79606d566c0f8b6d39b8d28b20 (patch)
tree3b6460de9daccef5ebe29bfada662a6e1abad313 /XMonad/Util
parent41ab49b08e374f864b99e8c09989eec04f0261e1 (diff)
downloadXMonadContrib-cd29d500d627ad79606d566c0f8b6d39b8d28b20.tar.gz
XMonadContrib-cd29d500d627ad79606d566c0f8b6d39b8d28b20.tar.xz
XMonadContrib-cd29d500d627ad79606d566c0f8b6d39b8d28b20.zip
XMonadContrib: add a utility module to set the default cursor
Ignore-this: b0559b7b2617db90506492aa1479cde This adds XMonad.Util.Cursor, which defines a function that allows setting the default mouse cursor. This can be useful for (for example) gnomeConfig, to ensure that the root cursor is changed from X_cursor to left_ptr. darcs-hash:20090915165604-40516-682a702c21bdb6b712bdab38a370849932e9f632.gz
Diffstat (limited to 'XMonad/Util')
-rw-r--r--XMonad/Util/Cursor.hs42
1 files changed, 42 insertions, 0 deletions
diff --git a/XMonad/Util/Cursor.hs b/XMonad/Util/Cursor.hs
new file mode 100644
index 0000000..45a3087
--- /dev/null
+++ b/XMonad/Util/Cursor.hs
@@ -0,0 +1,42 @@
+----------------------------------------------------------------------------
+-- |
+-- Module : XMonad.Util.Cursor
+-- Copyright : (c) 2009 Collabora Ltd
+-- License : BSD-style (see xmonad/LICENSE)
+--
+-- Maintainer : Andres Salomon <dilinger@collabora.co.uk>
+-- Stability : unstable
+-- Portability : unportable
+--
+-- A module for setting the default mouse cursor.
+--
+-- Some ideas shamelessly stolen from Nils Schweinsberg; thanks!
+-----------------------------------------------------------------------------
+
+module XMonad.Util.Cursor
+ ( -- * Usage:
+ -- $usage
+ module Graphics.X11.Xlib.Cursor,
+ setDefaultCursor
+ ) where
+
+import Graphics.X11.Xlib.Cursor
+import XMonad
+
+-- $usage
+-- setDefaultCursor xC_left_ptr
+-- For example, to override the default gnome cursor:
+-- import XMonad.Util.Cursor
+-- main = xmonad gnomeConfig { startupHook = setDefaultCursor xC_pirate }
+-- Arrr!
+
+-- | Set the default (root) cursor
+setDefaultCursor :: Glyph -> 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