Skip to content

Instantly share code, notes, and snippets.

@lheckemann
Last active January 13, 2019 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lheckemann/a613f7eaf19b5fdd8b490ff7019de134 to your computer and use it in GitHub Desktop.
Save lheckemann/a613f7eaf19b5fdd8b490ff7019de134 to your computer and use it in GitHub Desktop.
nice cursors for urxvt
nix-build -E 'with import <nixpkgs> {}; rxvt_unicode.overrideAttrs (o: {patches = [(builtins.fetchurl https://gist.githubusercontent.com/lheckemann/a613f7eaf19b5fdd8b490ff7019de134/raw/bae5dccf7c5fdf20bec44ad337f0f20ebcd91495/urxvt-nice-cursors.patch)] ++ o.patches or []; buildInputs = [xorg.libXcursor] ++ o.buildInputs or []; nativeBuildInputs = [autoreconfHook] ++ o.nativeBuildInputs or [];})'
diff --git a/configure.ac b/configure.ac
index 0da3b59..df0f69a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,6 +469,12 @@ if test x$support_frills = xyes; then
], [:])
fi
+RXVT_CHECK_MODULES([XCURSOR], [xcursor], [
+ X_LIBS="$XCURSOR_LIBS $X_LIBS"
+ CPPFLAGS="$CPPFLAGS $XCURSOR_CFLAGS"
+ AC_DEFINE(HAVE_XCURSOR, 1, Define to enable Xcursor support)
+], [:])
+
dnl# --------------------------------------------------------------------------
dnl# CHECKING FOR HEADER FILES
dnl# --------------------------------------------------------------------------
diff --git a/src/init.C b/src/init.C
index 5a96603..91ae5c3 100644
--- a/src/init.C
+++ b/src/init.C
@@ -49,6 +49,10 @@
# include <X11/Xmu/CurUtil.h>
#endif
+#ifdef HAVE_XCURSOR
+# include <X11/Xcursor/Xcursor.h>
+#endif
+
#ifdef HAVE_XSETLOCALE
# define X_LOCALE
# include <X11/Xlocale.h>
@@ -1421,7 +1425,11 @@ rxvt_term::create_windows (int argc, const char *const *argv)
}
#endif
- TermWin_cursor = XCreateFontCursor (dpy, shape);
+#ifdef HAVE_XCURSOR
+ TermWin_cursor = XcursorLibraryLoadCursor (dpy, "xterm");
+#else
+ TermWin_cursor = XCreateFontCursor(dpy, shape);
+#endif
/* the vt window */
vt = XCreateSimpleWindow (dpy, top,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment