diff options
author | Andres Salomon <dilinger@collabora.co.uk> | 2009-09-15 18:56:04 +0200 |
---|---|---|
committer | Andres Salomon <dilinger@collabora.co.uk> | 2009-09-15 18:56:04 +0200 |
commit | cd29d500d627ad79606d566c0f8b6d39b8d28b20 (patch) | |
tree | 3b6460de9daccef5ebe29bfada662a6e1abad313 | |
parent | 41ab49b08e374f864b99e8c09989eec04f0261e1 (diff) | |
download | XMonadContrib-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 '')
-rw-r--r-- | XMonad/Doc/Extending.hs | 2 | ||||
-rw-r--r-- | XMonad/Util/Cursor.hs | 42 | ||||
-rw-r--r-- | xmonad-contrib.cabal | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/XMonad/Doc/Extending.hs b/XMonad/Doc/Extending.hs index 88c2c80..0c12c68 100644 --- a/XMonad/Doc/Extending.hs +++ b/XMonad/Doc/Extending.hs @@ -811,6 +811,8 @@ external utilities. A non complete list with a brief description: +* "XMonad.Util.Cursor": configure the default cursor/pointer glyph. + * "XMonad.Util.CustomKeys": configure key bindings (see "XMonad.Doc.Extending#Editing_key_bindings"). 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 diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index e589eeb..aac6145 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -217,6 +217,7 @@ library XMonad.Prompt.Window XMonad.Prompt.Workspace XMonad.Prompt.XMonad + XMonad.Util.Cursor XMonad.Util.CustomKeys XMonad.Util.Dmenu XMonad.Util.Dzen |