[xmonad] [PATCH] XMonad: set the default root cursor to XC_left_ptr

Andres Salomon dilinger at collabora.co.uk
Sun Sep 13 23:01:39 EDT 2009


I've noticed that the default root cursor isn't changed from X's default.  Is
there a reason for this, other than just no one noticing because their display
manager overrides it?  I've noticed this with nodm.  The patch below changes
xmonad to override the default cursor.



From 90fcde3dc0fbe47aa9cc046315d0ee05c311e2bd Mon Sep 17 00:00:00 2001
From: Andres Salomon <dilinger at collabora.co.uk>
Date: Sun, 13 Sep 2009 22:48:17 -0400
Subject: [PATCH] XMonad: set the default root cursor to XC_left_ptr

The default root cursor is ugly (X_cursor).  Most window managers and
display managers set it to something else (ie, XC_left_ptr).  This adds
similar behavior.

Signed-off-by: Andres Salomon <dilinger at collabora.co.uk>
---
 XMonad/Main.hsc |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index 430e60c..c2d3289 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -113,6 +113,9 @@ xmonad initxmc = do
     selectInput dpy rootw $  substructureRedirectMask .|. substructureNotifyMask
                          .|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask
 
+    -- set the default cursor to XC_left_ptr (which is 68 in X11/cursorfont.h)
+    setDefaultCursor dpy rootw 68
+
     allocaXEvent $ \e ->
         runX cf st $ do
 
@@ -312,3 +315,13 @@ grabButtons = do
     ems <- extraModifiers
     ba <- asks buttonActions
     mapM_ (\(m,b) -> mapM_ (grab b . (m .|.)) ems) (M.keys $ ba)
+
+
+-- | Set the default (root) cursor
+setDefaultCursor :: Display -> Window -> Glyph -> IO ()
+setDefaultCursor dpy win glyph = do
+    curs <- createFontCursor dpy glyph
+    defineCursor dpy win curs
+    flush dpy
+    freeCursor dpy curs
+
-- 
1.6.3.3





More information about the xmonad mailing list