mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-06 15:01:53 -07:00
XMonadContrib: add a utility module to set the default cursor
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.
This commit is contained in:
@@ -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").
|
||||
|
||||
|
42
XMonad/Util/Cursor.hs
Normal file
42
XMonad/Util/Cursor.hs
Normal file
@@ -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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user