Compare commits
8 Commits
7e1de0b8a2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| e77a1963d6 | |||
|
|
f31f24c7ae | ||
|
|
76e4761e00 | ||
|
|
477d33baa0 | ||
|
|
574b69eb37 | ||
|
|
8888121330 | ||
|
|
85fe518c1a | ||
|
|
244fa852fe |
2
LICENSE
2
LICENSE
@@ -1,5 +1,6 @@
|
|||||||
MIT/X Consortium License
|
MIT/X Consortium License
|
||||||
|
|
||||||
|
© 2010-2026 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
||||||
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
@@ -11,7 +12,6 @@ MIT/X Consortium License
|
|||||||
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||||
© 2008 Neale Pickett <neale dot woozle dot org>
|
© 2008 Neale Pickett <neale dot woozle dot org>
|
||||||
© 2009 Mate Nagy <mnagy at port70 dot net>
|
© 2009 Mate Nagy <mnagy at port70 dot net>
|
||||||
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
|
|
||||||
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
||||||
© 2011 Christoph Lohmann <20h@r-36.net>
|
© 2011 Christoph Lohmann <20h@r-36.net>
|
||||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -13,9 +13,6 @@ all: dwm
|
|||||||
|
|
||||||
${OBJ}: config.h config.mk
|
${OBJ}: config.h config.mk
|
||||||
|
|
||||||
config.h:
|
|
||||||
cp config.def.h $@
|
|
||||||
|
|
||||||
dwm: ${OBJ}
|
dwm: ${OBJ}
|
||||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
@@ -24,8 +21,8 @@ clean:
|
|||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dwm-${VERSION}
|
mkdir -p dwm-${VERSION}
|
||||||
cp -R LICENSE Makefile README config.def.h config.mk\
|
cp -R LICENSE Makefile README config.mk\
|
||||||
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
dwm.1 drw.h util.h ${SRC} transient.c dwm-${VERSION}
|
||||||
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
||||||
gzip dwm-${VERSION}.tar
|
gzip dwm-${VERSION}.tar
|
||||||
rm -rf dwm-${VERSION}
|
rm -rf dwm-${VERSION}
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -2,13 +2,6 @@
|
|||||||
|
|
||||||
This is my fork of suckless's dwm, for my customizations/configurations.
|
This is my fork of suckless's dwm, for my customizations/configurations.
|
||||||
|
|
||||||
**Upstream:** `https://git.suckless.org/dwm/` or `git://git.suckless.org/dwm`
|
**Upstream:** [https://git.suckless.org/dwm/](https://git.suckless.org/dwm/)
|
||||||
|
or [git://git.suckless.org/dwm](git://git.suckless.org/dwm)
|
||||||
## TODO
|
|
||||||
|
|
||||||
- patches to add:
|
|
||||||
- fibonacci (for spiral layout)
|
|
||||||
- stacker (for moving windows up and down stack)
|
|
||||||
- swallow (the replace-windows-in-place feature)
|
|
||||||
- xresources (maybe? for my theme-changing logic)
|
|
||||||
|
|
||||||
|
|||||||
67
config.def.h
67
config.def.h
@@ -1,21 +1,29 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
/* NOTE: config.h replaces this file, but I'm keeping this one to help distinguish
|
||||||
|
* between others' patches (published via suckless.org) and my own additions.
|
||||||
|
* - to see others' patches, diff config.def.h against upstream's config.def.h
|
||||||
|
* - to see my additional changes, diff config.h against config.def.h
|
||||||
|
*/
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static char font[] = "monospace:size=10";
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char *fonts[] = { font };
|
||||||
static const char col_gray2[] = "#444444";
|
static char normbgcolor[] = "#222222";
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static char normbordercolor[] = "#444444";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static char normfgcolor[] = "#bbbbbb";
|
||||||
static const char col_cyan[] = "#005577";
|
static char selfgcolor[] = "#eeeeee";
|
||||||
static const char *colors[][3] = {
|
static char selbordercolor[] = "#005577";
|
||||||
/* fg bg border */
|
static char selbgcolor[] = "#005577";
|
||||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
static char *colors[][3] = {
|
||||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
|
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* window replacement */
|
/* window replacement */
|
||||||
@@ -37,9 +45,9 @@ static const Rule rules[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static int nmaster = 1; /* number of clients in master area */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||||
|
|
||||||
@@ -74,9 +82,30 @@ static const Layout layouts[] = {
|
|||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xresources preferences to load at startup
|
||||||
|
*/
|
||||||
|
ResourcePref resources[] = {
|
||||||
|
{ "font", STRING, &font },
|
||||||
|
{ "dmenufont", STRING, &dmenufont },
|
||||||
|
{ "normbgcolor", STRING, &normbgcolor },
|
||||||
|
{ "normbordercolor", STRING, &normbordercolor },
|
||||||
|
{ "normfgcolor", STRING, &normfgcolor },
|
||||||
|
{ "selbgcolor", STRING, &selbgcolor },
|
||||||
|
{ "selbordercolor", STRING, &selbordercolor },
|
||||||
|
{ "selfgcolor", STRING, &selfgcolor },
|
||||||
|
{ "borderpx", INTEGER, &borderpx },
|
||||||
|
{ "snap", INTEGER, &snap },
|
||||||
|
{ "showbar", INTEGER, &showbar },
|
||||||
|
{ "topbar", INTEGER, &topbar },
|
||||||
|
{ "nmaster", INTEGER, &nmaster },
|
||||||
|
{ "resizehints", INTEGER, &resizehints },
|
||||||
|
{ "mfact", FLOAT, &mfact },
|
||||||
|
};
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
|||||||
163
config.h
Normal file
163
config.h
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
/* Copied from config.dev.h file. */
|
||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
// define BROWSER_CMD "qutebrowser"
|
||||||
|
#define BROWSER_CMD "brave"
|
||||||
|
#define SYSTEM_MONITOR "htop"
|
||||||
|
// define TERMINAL_CLASS "St"
|
||||||
|
// define TERMINAL_CMD "st"
|
||||||
|
#define TERMINAL_CLASS "Kitty"
|
||||||
|
#define TERMINAL_CMD "kitty"
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static unsigned int snap = 32; /* snap pixel */
|
||||||
|
static int showbar = 1; /* 0 means no bar */
|
||||||
|
static int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static char font[] = "monospace:size=10";
|
||||||
|
static char dmenufont[] = "monospace:size=10";
|
||||||
|
static const char *fonts[] = { font };
|
||||||
|
static char normbgcolor[] = "#222222";
|
||||||
|
static char normbordercolor[] = "#444444";
|
||||||
|
static char normfgcolor[] = "#bbbbbb";
|
||||||
|
static char selfgcolor[] = "#eeeeee";
|
||||||
|
static char selbordercolor[] = "#005577";
|
||||||
|
static char selbgcolor[] = "#005577";
|
||||||
|
static char *colors[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
|
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* window replacement */
|
||||||
|
static const int swallowfloating = 0;
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
|
||||||
|
|
||||||
|
static const Rule rules[] = {
|
||||||
|
/* xprop(1):
|
||||||
|
* WM_CLASS(STRING) = instance, class
|
||||||
|
* WM_NAME(STRING) = title
|
||||||
|
*/
|
||||||
|
/* class instance title tags mask isfloating isterminal noswallow monitor */
|
||||||
|
{ TERMINAL_CLASS, NULL, NULL, 0, 0, 1, 0, -1 },
|
||||||
|
{ "Gimp", NULL, NULL, 0, 0, 0, 0, -1 },
|
||||||
|
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
|
static int nmaster = 1; /* number of clients in master area */
|
||||||
|
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||||
|
|
||||||
|
#include "fibonacci.c"
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function, (first entry is default) */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
{ "[@]", spiral },
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* floating */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
#define MODKEY Mod4Mask
|
||||||
|
#define TAGKEYS(KEY,TAG) \
|
||||||
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
#define STACKKEYS(MOD,ACTION) \
|
||||||
|
{ MOD, XK_j, ACTION##stack, {.i = INC(+1) } }, \
|
||||||
|
{ MOD, XK_k, ACTION##stack, {.i = INC(-1) } },
|
||||||
|
|
||||||
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
|
/* commands */
|
||||||
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
|
||||||
|
static const char *termcmd[] = { TERMINAL_CMD, NULL };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xresources preferences to load at startup
|
||||||
|
*/
|
||||||
|
ResourcePref resources[] = {
|
||||||
|
{ "font", STRING, &font },
|
||||||
|
{ "dmenufont", STRING, &dmenufont },
|
||||||
|
{ "normbgcolor", STRING, &normbgcolor },
|
||||||
|
{ "normbordercolor", STRING, &normbordercolor },
|
||||||
|
{ "normfgcolor", STRING, &normfgcolor },
|
||||||
|
{ "selbgcolor", STRING, &selbgcolor },
|
||||||
|
{ "selbordercolor", STRING, &selbordercolor },
|
||||||
|
{ "selfgcolor", STRING, &selfgcolor },
|
||||||
|
{ "borderpx", INTEGER, &borderpx },
|
||||||
|
{ "snap", INTEGER, &snap },
|
||||||
|
{ "showbar", INTEGER, &showbar },
|
||||||
|
{ "topbar", INTEGER, &topbar },
|
||||||
|
{ "nmaster", INTEGER, &nmaster },
|
||||||
|
{ "resizehints", INTEGER, &resizehints },
|
||||||
|
{ "mfact", FLOAT, &mfact },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY|ShiftMask, XK_f, togglebar, {0} },
|
||||||
|
STACKKEYS(MODKEY, focus)
|
||||||
|
STACKKEYS(MODKEY|ShiftMask, push)
|
||||||
|
/* { MODKEY, XK_h, zxcv, {.f = -0.05} }, */
|
||||||
|
/* { MODKEY, XK_l, zxcv, {.f = +0.05} }, */
|
||||||
|
{ MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} }, // zxcv
|
||||||
|
{ MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} }, // zxcv
|
||||||
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, zoom, {0} }, /* swap current and master clients */
|
||||||
|
{ MODKEY, XK_comma, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XK_period, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_slash, togglefloating, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_slash, setlayout, {.v = &layouts[3]} }, /* TODO: does this do anything? is it needed? */
|
||||||
|
{ MODKEY|ShiftMask, XK_m, focusmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_m, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_t, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_t, tagmon, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_grave, view, {.ui = ~0 } }, /* ` -> view all tags */
|
||||||
|
{ MODKEY|ShiftMask, XK_grave, tag, {.ui = ~0 } }, /* shift + ` -> apply all tags */
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
TAGKEYS( XK_4, 3)
|
||||||
|
TAGKEYS( XK_5, 4)
|
||||||
|
TAGKEYS( XK_6, 5)
|
||||||
|
TAGKEYS( XK_7, 6)
|
||||||
|
TAGKEYS( XK_8, 7)
|
||||||
|
TAGKEYS( XK_9, 8)
|
||||||
|
TAGKEYS( XK_0, 9)
|
||||||
|
{ MODKEY, XK_q, killclient, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
||||||
|
{ MODKEY, XK_s, spawn, SHCMD(TERMINAL_CMD " -e " SYSTEM_MONITOR) },
|
||||||
|
{ MODKEY|ShiftMask, XK_b, spawn, {.v = (const char*[]){ BROWSER_CMD, NULL } } },
|
||||||
|
{ MODKEY, XK_b, spawn, SHCMD(TERMINAL_CMD " -e bookmark-find") },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* button definitions */
|
||||||
|
/* click options: ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin */
|
||||||
|
static const Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 6.6
|
VERSION = 6.7
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
|||||||
2
drw.c
2
drw.c
@@ -180,7 +180,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
|||||||
|
|
||||||
/* Create color schemes. */
|
/* Create color schemes. */
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
Clr *ret;
|
Clr *ret;
|
||||||
|
|||||||
2
drw.h
2
drw.h
@@ -41,7 +41,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in
|
|||||||
/* Colorscheme abstraction */
|
/* Colorscheme abstraction */
|
||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
void drw_clr_free(Drw *drw, Clr *c);
|
void drw_clr_free(Drw *drw, Clr *c);
|
||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount);
|
||||||
void drw_scm_free(Drw *drw, Clr *scm, size_t clrcount);
|
void drw_scm_free(Drw *drw, Clr *scm, size_t clrcount);
|
||||||
|
|
||||||
/* Cursor abstraction */
|
/* Cursor abstraction */
|
||||||
|
|||||||
82
dwm.c
82
dwm.c
@@ -36,6 +36,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xresource.h>
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
@@ -156,6 +157,19 @@ typedef struct {
|
|||||||
int monitor;
|
int monitor;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
|
/* Xresources preferences */
|
||||||
|
enum resource_type {
|
||||||
|
STRING = 0,
|
||||||
|
INTEGER = 1,
|
||||||
|
FLOAT = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *name;
|
||||||
|
enum resource_type type;
|
||||||
|
void *dst;
|
||||||
|
} ResourcePref;
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
static void applyrules(Client *c);
|
static void applyrules(Client *c);
|
||||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||||
@@ -250,6 +264,8 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
|||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
static void load_xresources(void);
|
||||||
|
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
||||||
|
|
||||||
static pid_t getparentprocess(pid_t p);
|
static pid_t getparentprocess(pid_t p);
|
||||||
static int isdescprocess(pid_t p, pid_t c);
|
static int isdescprocess(pid_t p, pid_t c);
|
||||||
@@ -937,7 +953,8 @@ getatomprop(Client *c, Atom prop)
|
|||||||
|
|
||||||
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||||
&da, &di, &dl, &dl, &p) == Success && p) {
|
&da, &di, &dl, &dl, &p) == Success && p) {
|
||||||
atom = *(Atom *)p;
|
if (dl > 0)
|
||||||
|
atom = *(Atom *)p;
|
||||||
XFree(p);
|
XFree(p);
|
||||||
}
|
}
|
||||||
return atom;
|
return atom;
|
||||||
@@ -1385,6 +1402,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||||||
c->oldw = c->w; c->w = wc.width = w;
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
c->oldh = c->h; c->h = wc.height = h;
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
|
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
&& !c->isfullscreen && !c->isfloating) {
|
||||||
|
c->w = wc.width += c->bw * 2;
|
||||||
|
c->h = wc.height += c->bw * 2;
|
||||||
|
wc.border_width = 0;
|
||||||
|
}
|
||||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@@ -2410,6 +2434,60 @@ zoom(const Arg *arg)
|
|||||||
pop(c);
|
pop(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
||||||
|
{
|
||||||
|
char *sdst = NULL;
|
||||||
|
int *idst = NULL;
|
||||||
|
float *fdst = NULL;
|
||||||
|
|
||||||
|
sdst = dst;
|
||||||
|
idst = dst;
|
||||||
|
fdst = dst;
|
||||||
|
|
||||||
|
char fullname[256];
|
||||||
|
char *type;
|
||||||
|
XrmValue ret;
|
||||||
|
|
||||||
|
snprintf(fullname, sizeof(fullname), "%s.%s", "dwm", name);
|
||||||
|
fullname[sizeof(fullname) - 1] = '\0';
|
||||||
|
|
||||||
|
XrmGetResource(db, fullname, "*", &type, &ret);
|
||||||
|
if (!(ret.addr == NULL || strncmp("String", type, 64)))
|
||||||
|
{
|
||||||
|
switch (rtype) {
|
||||||
|
case STRING:
|
||||||
|
strcpy(sdst, ret.addr);
|
||||||
|
break;
|
||||||
|
case INTEGER:
|
||||||
|
*idst = strtoul(ret.addr, NULL, 10);
|
||||||
|
break;
|
||||||
|
case FLOAT:
|
||||||
|
*fdst = strtof(ret.addr, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
load_xresources(void)
|
||||||
|
{
|
||||||
|
Display *display;
|
||||||
|
char *resm;
|
||||||
|
XrmDatabase db;
|
||||||
|
ResourcePref *p;
|
||||||
|
|
||||||
|
display = XOpenDisplay(NULL);
|
||||||
|
resm = XResourceManagerString(display);
|
||||||
|
if (!resm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
db = XrmGetStringDatabase(resm);
|
||||||
|
for (p = resources; p < resources + LENGTH(resources); p++)
|
||||||
|
resource_load(db, p->name, p->type, p->dst);
|
||||||
|
XCloseDisplay(display);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -2424,6 +2502,8 @@ main(int argc, char *argv[])
|
|||||||
if (!(xcon = XGetXCBConnection(dpy)))
|
if (!(xcon = XGetXCBConnection(dpy)))
|
||||||
die("dwm: cannot get xcb connection\n");
|
die("dwm: cannot get xcb connection\n");
|
||||||
checkotherwm();
|
checkotherwm();
|
||||||
|
XrmInitialize();
|
||||||
|
load_xresources();
|
||||||
setup();
|
setup();
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio rpath proc exec ps", NULL) == -1)
|
if (pledge("stdio rpath proc exec ps", NULL) == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user