comparison gbwm.c @ 2:3ad7c3ab949e

improve config and set default root cursor
author Atarwn Gard <a@qwa.su>
date Sat, 11 Oct 2025 10:15:35 +0500
parents 286d4af85ebe
children 3726f37deac1
comparison
equal deleted inserted replaced
1:286d4af85ebe 2:3ad7c3ab949e
2 #include <X11/Xlib.h> 2 #include <X11/Xlib.h>
3 #include <X11/Xatom.h> 3 #include <X11/Xatom.h>
4 #include <X11/Xft/Xft.h> 4 #include <X11/Xft/Xft.h>
5 #include <X11/Xutil.h> 5 #include <X11/Xutil.h>
6 #include <X11/keysym.h> 6 #include <X11/keysym.h>
7 #include <X11/cursorfont.h>
7 #include <stdio.h> 8 #include <stdio.h>
8 #include <stdlib.h> 9 #include <stdlib.h>
9 #include <string.h> 10 #include <string.h>
10 #include <unistd.h> 11 #include <unistd.h>
11 #include <signal.h> 12 #include <signal.h>
53 static const char *col_border_normal = "#444444"; 54 static const char *col_border_normal = "#444444";
54 static const char *col_border_focused = "#4a90e2"; 55 static const char *col_border_focused = "#4a90e2";
55 static const char *col_bg = "#000000"; 56 static const char *col_bg = "#000000";
56 static const char *col_fg = "#ffffff"; 57 static const char *col_fg = "#ffffff";
57 static const char *col_sel = "#4a90e2"; 58 static const char *col_sel = "#4a90e2";
59 static const char *overlay_font = "monospace:size=48";
58 60
59 static Display *dpy; 61 static Display *dpy;
60 static Window root; 62 static Window root;
61 static Client *workspaces[9] = {NULL}; // 9 workspaces 63 static Client *workspaces[9] = {NULL}; // 9 workspaces
62 static int current_ws = 0; 64 static int current_ws = 0;
743 745
744 XftColorAllocName(dpy, visual, cmap, col_bg, &xft_col_bg); 746 XftColorAllocName(dpy, visual, cmap, col_bg, &xft_col_bg);
745 XftColorAllocName(dpy, visual, cmap, col_fg, &xft_col_fg); 747 XftColorAllocName(dpy, visual, cmap, col_fg, &xft_col_fg);
746 XftColorAllocName(dpy, visual, cmap, col_sel, &xft_col_sel); 748 XftColorAllocName(dpy, visual, cmap, col_sel, &xft_col_sel);
747 749
748 font = XftFontOpenName(dpy, DefaultScreen(dpy), "monospace:size=48"); 750 font = XftFontOpenName(dpy, DefaultScreen(dpy), overlay_font);
749 751
750 // Allocate border colors 752 // Allocate border colors
751 XColor color; 753 XColor color;
752 XParseColor(dpy, cmap, col_border_normal, &color); 754 XParseColor(dpy, cmap, col_border_normal, &color);
753 XAllocColor(dpy, cmap, &color); 755 XAllocColor(dpy, cmap, &color);
774 XSetErrorHandler(xerror_handler); 776 XSetErrorHandler(xerror_handler);
775 777
776 sw = DisplayWidth(dpy, DefaultScreen(dpy)); 778 sw = DisplayWidth(dpy, DefaultScreen(dpy));
777 sh = DisplayHeight(dpy, DefaultScreen(dpy)); 779 sh = DisplayHeight(dpy, DefaultScreen(dpy));
778 root = RootWindow(dpy, DefaultScreen(dpy)); 780 root = RootWindow(dpy, DefaultScreen(dpy));
781 Cursor cursor = XCreateFontCursor(dpy, XC_left_ptr);
782 XDefineCursor(dpy, root, cursor);
779 783
780 setup_colors(); 784 setup_colors();
781 setup_icccm(); 785 setup_icccm();
782 786
783 XSelectInput(dpy, root, 787 XSelectInput(dpy, root,