Skip to content

Commit 0c9ee68

Browse files
committed
Remove xresources patch
1 parent 399a908 commit 0c9ee68

File tree

6 files changed

+48
-408
lines changed

6 files changed

+48
-408
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ sudo make clean install
4040
- [swallow](https://dwm.suckless.org/patches/swallow/)
4141
- [systray](https://dwm.suckless.org/patches/systray/)
4242
- [vanitygaps](https://dwm.suckless.org/patches/vanitygaps/)
43-
- [Xresources](https://dwm.suckless.org/patches/xresources/)
4443
- [viewontag](https://dwm.suckless.org/patches/viewontag/)
4544
- [restartsig](https://dwm.suckless.org/patches/restartsig/)
4645
- [shiftview](https://lists.suckless.org/dev/1104/7590.html)

config.h

+44-91
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,51 @@
55
#define TERMCLASS "St"
66

77
/* appearance */
8-
static unsigned int borderpx = 3; /* border pixel of windows */
9-
static unsigned int snap = 32; /* snap pixel */
10-
static unsigned int gappih = 20; /* horiz inner gap between windows */
11-
static unsigned int gappiv = 10; /* vert inner gap between windows */
12-
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
13-
static unsigned int gappov = 30; /* vert outer gap between windows and screen edge */
14-
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
15-
static unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
16-
static unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
17-
static unsigned int systrayspacing = 2; /* systray spacing */
18-
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
19-
static int showsystray = 1; /* 0 means no systray */
20-
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
21-
static int showbar = 1; /* 0 means no bar */
22-
static int topbar = 1; /* 0 means bottom bar */
23-
static int viewontag = 1; /* Switch view on tag switch */
24-
static char *fonts[] = { "monospace:size=10", "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
25-
static char normbgcolor[] = "#222222";
26-
static char normbordercolor[] = "#444444";
27-
static char normfgcolor[] = "#bbbbbb";
28-
static char selfgcolor[] = "#eeeeee";
29-
static char selbordercolor[] = "#770000";
30-
static char selbgcolor[] = "#005577";
31-
static char color0[] = "#000000"; /* black dark */
32-
static char color8[] = "#79A9FF"; /* black light */
33-
static char color1[] = "#ff5555"; /* red dark */
34-
static char color9[] = "#ff6e67"; /* red light */
35-
static char color2[] = "#50fa7b"; /* green dark */
36-
static char color10[] = "#5af78e"; /* green light */
37-
static char color3[] = "#f1fa8c"; /* yellow dark */
38-
static char color11[] = "#f4f99d"; /* yellow light */
39-
static char color4[] = "#6790EB"; /* blue dark */
40-
static char color12[] = "#79A9FF"; /* blue light */
41-
static char color5[] = "#ff79c6"; /* purple dark */
42-
static char color13[] = "#ff92d0"; /* purple light */
43-
static char color6[] = "#8be9fd"; /* cyan dark */
44-
static char color14[] = "#9aedfe"; /* cyan light */
45-
static char color7[] = "#bfbfbf"; /* white dark */
46-
static char color15[] = "#e6e6e6"; /* white light */
8+
static const unsigned int borderpx = 3; /* border pixel of windows */
9+
static const unsigned int snap = 32; /* snap pixel */
10+
static const unsigned int gappih = 20; /* horiz inner gap between windows */
11+
static const unsigned int gappiv = 10; /* vert inner gap between windows */
12+
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
13+
static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */
14+
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
15+
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
16+
static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
17+
static const unsigned int systrayspacing = 2; /* systray spacing */
18+
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
19+
static const int showsystray = 1; /* 0 means no systray */
20+
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
21+
static const int showbar = 1; /* 0 means no bar */
22+
static const int topbar = 1; /* 0 means bottom bar */
23+
static const int viewontag = 1; /* Switch view on tag switch */
24+
static const char *fonts[] = { "Inconsolata Nerd Font:size=12", "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
25+
static const char normbgcolor[] = "#222222";
26+
static const char normbordercolor[] = "#444444";
27+
static const char normfgcolor[] = "#bbbbbb";
28+
static const char selfgcolor[] = "#eeeeee";
29+
static const char selbordercolor[] = "#770000";
30+
static const char selbgcolor[] = "#005577";
31+
static const char color0[] = "#000000"; /* black dark */
32+
static const char color8[] = "#79A9FF"; /* black light */
33+
static const char color1[] = "#ff5555"; /* red dark */
34+
static const char color9[] = "#ff6e67"; /* red light */
35+
static const char color2[] = "#50fa7b"; /* green dark */
36+
static const char color10[] = "#5af78e"; /* green light */
37+
static const char color3[] = "#f1fa8c"; /* yellow dark */
38+
static const char color11[] = "#f4f99d"; /* yellow light */
39+
static const char color4[] = "#6790EB"; /* blue dark */
40+
static const char color12[] = "#79A9FF"; /* blue light */
41+
static const char color5[] = "#ff79c6"; /* purple dark */
42+
static const char color13[] = "#ff92d0"; /* purple light */
43+
static const char color6[] = "#8be9fd"; /* cyan dark */
44+
static const char color14[] = "#9aedfe"; /* cyan light */
45+
static const char color7[] = "#bfbfbf"; /* white dark */
46+
static const char color15[] = "#e6e6e6"; /* white light */
4747

4848
enum { SchemeNorm, SchemeCol0, SchemeCol1, SchemeCol2, SchemeCol3, SchemeCol4,
4949
SchemeCol5, SchemeCol6, SchemeCol7, SchemeCol8, SchemeCol9, SchemeCol10,
5050
SchemeCol11, SchemeCol12, SchemeCol13, SchemeCol14, SchemeCol15, SchemeSel }; /* color schemes */
5151

52-
static char *colors[][3] = {
52+
static const char *colors[][3] = {
5353
/* fg bg border */
5454
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor }, // \x0b
5555
[SchemeCol0] = { color0, normbgcolor, normbordercolor }, // \x0c
@@ -107,10 +107,10 @@ static const Rule rules[] = {
107107
};
108108

109109
/* layout(s) */
110-
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
111-
static int nmaster = 1; /* number of clients in master area */
112-
static int resizehints = 0; /* 1 means respect size hints in tiled resizals */
113-
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
110+
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
111+
static const int nmaster = 1; /* number of clients in master area */
112+
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
113+
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
114114
#include "vanitygaps.c"
115115
static const Layout layouts[] = {
116116
/* symbol arrange function */
@@ -144,53 +144,6 @@ static const Layout layouts[] = {
144144
/* commands */
145145
static const char *termcmd[] = { TERMINAL, NULL };
146146

147-
/*
148-
* Xresources preferences to load at startup
149-
*/
150-
ResourcePref resources[] = {
151-
{ "borderpx", INTEGER, &borderpx },
152-
{ "snap", INTEGER, &snap },
153-
{ "gappih", INTEGER, &gappih },
154-
{ "gappiv", INTEGER, &gappiv },
155-
{ "gappoh", INTEGER, &gappoh },
156-
{ "gappov", INTEGER, &gappov },
157-
{ "smartgaps", INTEGER, &smartgaps },
158-
{ "systraypinning", INTEGER, &systraypinning },
159-
{ "systrayonleft", INTEGER, &systrayonleft },
160-
{ "systrayspacing", INTEGER, &systrayspacing },
161-
{ "showsystray", INTEGER, &showsystray },
162-
{ "swallowfloating", INTEGER, &swallowfloating },
163-
{ "showbar", INTEGER, &showbar },
164-
{ "topbar", INTEGER, &topbar },
165-
{ "viewontag", INTEGER, &viewontag },
166-
// { "font", STRING, &font },
167-
// { "color0", STRING, &normbgcolor },
168-
// { "color0", STRING, &normbordercolor },
169-
// { "color4", STRING, &normfgcolor },
170-
// { "color0", STRING, &selfgcolor },
171-
// { "color8", STRING, &selbordercolor },
172-
// { "color4", STRING, &selbgcolor },
173-
{ "color0", STRING, &color0 },
174-
{ "color1", STRING, &color1 },
175-
{ "color2", STRING, &color2 },
176-
{ "color3", STRING, &color3 },
177-
{ "color4", STRING, &color4 },
178-
{ "color5", STRING, &color5 },
179-
{ "color6", STRING, &color6 },
180-
{ "color7", STRING, &color7 },
181-
{ "color8", STRING, &color8 },
182-
{ "color9", STRING, &color9 },
183-
{ "color10", STRING, &color10 },
184-
{ "color11", STRING, &color11 },
185-
{ "color12", STRING, &color12 },
186-
{ "color13", STRING, &color13 },
187-
{ "color14", STRING, &color14 },
188-
{ "color15", STRING, &color15 },
189-
{ "mfact", FLOAT, &mfact },
190-
{ "nmaster", INTEGER, &nmaster },
191-
{ "resizehints", INTEGER, &resizehints },
192-
};
193-
194147
#include <X11/XF86keysym.h>
195148
#include "shiftview.c"
196149

drw.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ xfont_free(Fnt *font)
154154
}
155155

156156
Fnt*
157-
drw_fontset_create(Drw* drw, char *fonts[], size_t fontcount)
157+
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
158158
{
159159
Fnt *cur, *ret = NULL;
160160
size_t i;
@@ -195,7 +195,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
195195
/* Wrapper to create color schemes. The caller has to call free(3) on the
196196
* returned color scheme when done using it. */
197197
Clr *
198-
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
198+
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
199199
{
200200
size_t i;
201201
Clr *ret;

drw.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h);
3232
void drw_free(Drw *drw);
3333

3434
/* Fnt abstraction */
35-
Fnt *drw_fontset_create(Drw* drw, char *fonts[], size_t fontcount);
35+
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
3636
void drw_fontset_free(Fnt* set);
3737
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
3838
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
3939

4040
/* Colorscheme abstraction */
4141
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
42-
Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount);
42+
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
4343

4444
/* Cursor abstraction */
4545
Cur *drw_cur_create(Drw *drw, int shape);

dwm.c

-72
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <X11/Xlib.h>
3737
#include <X11/Xproto.h>
3838
#include <X11/Xutil.h>
39-
#include <X11/Xresource.h>
4039
#ifdef XINERAMA
4140
#include <X11/extensions/Xinerama.h>
4241
#endif /* XINERAMA */
@@ -181,19 +180,6 @@ typedef struct {
181180
int monitor;
182181
} Rule;
183182

184-
/* Xresources preferences */
185-
enum resource_type {
186-
STRING = 0,
187-
INTEGER = 1,
188-
FLOAT = 2
189-
};
190-
191-
typedef struct {
192-
char *name;
193-
enum resource_type type;
194-
void *dst;
195-
} ResourcePref;
196-
197183
typedef struct Systray Systray;
198184
struct Systray {
199185
Window win;
@@ -311,8 +297,6 @@ static int xerror(Display *dpy, XErrorEvent *ee);
311297
static int xerrordummy(Display *dpy, XErrorEvent *ee);
312298
static int xerrorstart(Display *dpy, XErrorEvent *ee);
313299
static void zoom(const Arg *arg);
314-
static void load_xresources(void);
315-
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
316300

317301
static pid_t getparentprocess(pid_t p);
318302
static int isdescprocess(pid_t p, pid_t c);
@@ -2939,60 +2923,6 @@ zoom(const Arg *arg)
29392923
pop(c);
29402924
}
29412925

2942-
void
2943-
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
2944-
{
2945-
char *sdst = NULL;
2946-
int *idst = NULL;
2947-
float *fdst = NULL;
2948-
2949-
sdst = dst;
2950-
idst = dst;
2951-
fdst = dst;
2952-
2953-
char fullname[256];
2954-
char *type;
2955-
XrmValue ret;
2956-
2957-
snprintf(fullname, sizeof(fullname), "%s.%s", "dwm", name);
2958-
fullname[sizeof(fullname) - 1] = '\0';
2959-
2960-
XrmGetResource(db, fullname, "*", &type, &ret);
2961-
if (!(ret.addr == NULL || strncmp("String", type, 64)))
2962-
{
2963-
switch (rtype) {
2964-
case STRING:
2965-
strcpy(sdst, ret.addr);
2966-
break;
2967-
case INTEGER:
2968-
*idst = strtoul(ret.addr, NULL, 10);
2969-
break;
2970-
case FLOAT:
2971-
*fdst = strtof(ret.addr, NULL);
2972-
break;
2973-
}
2974-
}
2975-
}
2976-
2977-
void
2978-
load_xresources(void)
2979-
{
2980-
Display *display;
2981-
char *resm;
2982-
XrmDatabase db;
2983-
ResourcePref *p;
2984-
2985-
display = XOpenDisplay(NULL);
2986-
resm = XResourceManagerString(display);
2987-
if (!resm)
2988-
return;
2989-
2990-
db = XrmGetStringDatabase(resm);
2991-
for (p = resources; p < resources + LENGTH(resources); p++)
2992-
resource_load(db, p->name, p->type, p->dst);
2993-
XCloseDisplay(display);
2994-
}
2995-
29962926
int
29972927
main(int argc, char *argv[])
29982928
{
@@ -3007,8 +2937,6 @@ main(int argc, char *argv[])
30072937
if (!(xcon = XGetXCBConnection(dpy)))
30082938
die("dwm: cannot get xcb connection\n");
30092939
checkotherwm();
3010-
XrmInitialize();
3011-
load_xresources();
30122940
setup();
30132941
scan();
30142942
runautostart();

0 commit comments

Comments
 (0)