diff options
| author | uint <abhinav.prsai@gmail.com> | 2025-12-14 17:22:59 +0000 |
|---|---|---|
| committer | uint <abhinav.prsai@gmail.com> | 2025-12-14 17:22:59 +0000 |
| commit | 61d0cff357389f5e6b7b729035b677d7ca9588c0 (patch) | |
| tree | 07791cdc3d0b3a5796d00fbfff7dfe7deb0945cf | |
| parent | b1ac729f34756ed63323c76386e631fda94a2adb (diff) | |
add cursor fonts
| -rw-r--r-- | config.h | 4 | ||||
| -rw-r--r-- | xnap.c | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -0,0 +1,4 @@ +#include <X11/cursorfont.h> + +static int cursor_font = XC_heart; +static const char* save_path = "/path/to/your/screenshots"; @@ -2,6 +2,7 @@ #include <stdio.h> #include <X11/X.h> +#include <X11/cursorfont.h> #include <X11/Xlib.h> #include <X11/keysym.h> #include <X11/Xutil.h> @@ -13,7 +14,10 @@ struct pointer_t { int ret; + Bool sel; + Cursor selcur; + int x0; int y0; int x1; @@ -113,6 +117,7 @@ void mkppm(const char* path, XImage* img) void quit(Bool ex) { XUngrabPointer(dpy, CurrentTime); + XFreeCursor(dpy, p.selcur); XCloseDisplay(dpy); if (ex) exit(EXIT_SUCCESS); @@ -156,10 +161,11 @@ void setup(void) root = RootWindow(dpy, scr); /* pointer */ + p.selcur = XCreateFontCursor(dpy, cursor_font); p.ret = XGrabPointer( dpy, root, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, None, None, CurrentTime + GrabModeAsync, GrabModeAsync, None, p.selcur, CurrentTime ); if (p.ret != GrabSuccess) die("XGrabPointer failed"); |
