mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 04:31:52 -07:00
New module : X.H.SetCursor
Idea from Andres Salomon (http://www.haskell.org/pipermail/xmonad/2009-September/008553.html).
This commit is contained in:
47
XMonad/Hooks/SetCursor.hs
Normal file
47
XMonad/Hooks/SetCursor.hs
Normal file
@@ -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
|
Reference in New Issue
Block a user