Compare commits
No commits in common. "ba5df1bfc34c5130aeb649e7aa3256a02ec36acb" and "bd23da4ee05c12856f4af4ea92a2e38cd09573dc" have entirely different histories.
ba5df1bfc3
...
bd23da4ee0
3 changed files with 75 additions and 27 deletions
6
Makefile
6
Makefile
|
@ -35,12 +35,14 @@ dist: clean
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||||
install -Dm755 ./dwm ${DESTDIR}${PREFIX}/bin
|
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
||||||
|
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
||||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
||||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/share/dwm
|
mkdir -p ${DESTDIR}${PREFIX}/share/dwm
|
||||||
install -Dm644 ./larbs.mom ${DESTDIR}${PREFIX}/share/dwm
|
cp -f larbs.mom ${DESTDIR}${PREFIX}/share/dwm
|
||||||
|
chmod 644 ${DESTDIR}${PREFIX}/share/dwm/larbs.mom
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||||
|
|
24
config.h
24
config.h
|
@ -3,26 +3,26 @@
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define TERMINAL "st"
|
#define TERMINAL "st"
|
||||||
#define TERMCLASS "St"
|
#define TERMCLASS "St"
|
||||||
#define BROWSER "firefox"
|
#define BROWSER "librewolf"
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static unsigned int borderpx = 3; /* border pixel of windows */
|
static unsigned int borderpx = 3; /* border pixel of windows */
|
||||||
static unsigned int snap = 32; /* snap pixel */
|
static unsigned int snap = 32; /* snap pixel */
|
||||||
static unsigned int gappih = 6; /* horiz inner gap between windows */
|
static unsigned int gappih = 20; /* horiz inner gap between windows */
|
||||||
static unsigned int gappiv = 6; /* vert inner gap between windows */
|
static unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||||
static unsigned int gappoh = 6; /* horiz outer gap between windows and screen edge */
|
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||||
static unsigned int gappov = 6; /* vert outer gap between windows and screen edge */
|
static unsigned int gappov = 30; /* vert outer gap between windows and screen edge */
|
||||||
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static int showbar = 1; /* 0 means no bar */
|
static int showbar = 1; /* 0 means no bar */
|
||||||
static int topbar = 1; /* 0 means bottom bar */
|
static int topbar = 1; /* 0 means bottom bar */
|
||||||
static char *fonts[] = { "monospace:size=10", "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" };
|
static char *fonts[] = { "monospace:size=10", "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" };
|
||||||
static char normbgcolor[] = "#4d0066";
|
static char normbgcolor[] = "#222222";
|
||||||
static char normbordercolor[] = "#444444";
|
static char normbordercolor[] = "#444444";
|
||||||
static char normfgcolor[] = "#bbbbbb";
|
static char normfgcolor[] = "#bbbbbb";
|
||||||
static char selfgcolor[] = "#eeeeee";
|
static char selfgcolor[] = "#eeeeee";
|
||||||
static char selbordercolor[] = "#eeeeee";
|
static char selbordercolor[] = "#770000";
|
||||||
static char selbgcolor[] = "#730099";
|
static char selbgcolor[] = "#005577";
|
||||||
static char *colors[][3] = {
|
static char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
|
@ -60,7 +60,7 @@ static const Rule rules[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static float mfact = 0.5; /* factor of master area size [0.05..0.95] */
|
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 nmaster = 1; /* number of clients in master area */
|
||||||
static int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
static int resizehints = 0; /* 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 */
|
||||||
|
@ -165,7 +165,7 @@ static const Key keys[] = {
|
||||||
{ MODKEY|ShiftMask, XK_q, spawn, {.v = (const char*[]){ "sysact", NULL } } },
|
{ MODKEY|ShiftMask, XK_q, spawn, {.v = (const char*[]){ "sysact", NULL } } },
|
||||||
{ MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, NULL } } },
|
{ MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, NULL } } },
|
||||||
{ MODKEY|ShiftMask, XK_w, spawn, {.v = (const char*[]){ TERMINAL, "-e", "sudo", "nmtui", NULL } } },
|
{ MODKEY|ShiftMask, XK_w, spawn, {.v = (const char*[]){ TERMINAL, "-e", "sudo", "nmtui", NULL } } },
|
||||||
{ MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook 2>/dev/null") },
|
{ MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") },
|
||||||
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL " -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") },
|
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL " -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") },
|
||||||
{ MODKEY, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "lfub", NULL } } },
|
{ MODKEY, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "lfub", NULL } } },
|
||||||
{ MODKEY|ShiftMask, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "htop", NULL } } },
|
{ MODKEY|ShiftMask, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "htop", NULL } } },
|
||||||
|
@ -261,8 +261,8 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") },
|
{ MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") },
|
||||||
|
|
||||||
{ 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44 $(pidof dwmblocks)") },
|
{ 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44 $(pidof dwmblocks)") },
|
||||||
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%- && wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; kill -44 $(pidof dwmblocks)") },
|
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; kill -44 $(pidof dwmblocks)") },
|
||||||
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%+ && wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%-; kill -44 $(pidof dwmblocks)") },
|
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%-; kill -44 $(pidof dwmblocks)") },
|
||||||
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } },
|
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } },
|
||||||
{ 0, XF86XK_AudioNext, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } },
|
{ 0, XF86XK_AudioNext, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } },
|
||||||
{ 0, XF86XK_AudioPause, spawn, {.v = (const char*[]){ "mpc", "pause", NULL } } },
|
{ 0, XF86XK_AudioPause, spawn, {.v = (const char*[]){ "mpc", "pause", NULL } } },
|
||||||
|
|
72
dwm.c
72
dwm.c
|
@ -68,6 +68,21 @@
|
||||||
#define SPTAG(i) ((1 << LENGTH(tags)) << (i))
|
#define SPTAG(i) ((1 << LENGTH(tags)) << (i))
|
||||||
#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
|
#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
|
||||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
#define XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \
|
||||||
|
if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \
|
||||||
|
int i = 1; \
|
||||||
|
for (; i <= 6; i++) { \
|
||||||
|
if (value.addr[i] < 48) break; \
|
||||||
|
if (value.addr[i] > 57 && value.addr[i] < 65) break; \
|
||||||
|
if (value.addr[i] > 70 && value.addr[i] < 97) break; \
|
||||||
|
if (value.addr[i] > 102) break; \
|
||||||
|
} \
|
||||||
|
if (i == 7) { \
|
||||||
|
strncpy(V, value.addr, 7); \
|
||||||
|
V[7] = '\0'; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
#define TRUNC(X,A,B) (MAX((A), MIN((X), (B))))
|
#define TRUNC(X,A,B) (MAX((A), MIN((X), (B))))
|
||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
|
@ -213,6 +228,7 @@ static void grabkeys(void);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void keypress(XEvent *e);
|
static void keypress(XEvent *e);
|
||||||
static void killclient(const Arg *arg);
|
static void killclient(const Arg *arg);
|
||||||
|
static void loadxrdb(void);
|
||||||
static void manage(Window w, XWindowAttributes *wa);
|
static void manage(Window w, XWindowAttributes *wa);
|
||||||
static void mappingnotify(XEvent *e);
|
static void mappingnotify(XEvent *e);
|
||||||
static void maprequest(XEvent *e);
|
static void maprequest(XEvent *e);
|
||||||
|
@ -280,8 +296,8 @@ static Monitor *wintomon(Window w);
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
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 xrdb(const Arg *arg);
|
static void xrdb(const Arg *arg);
|
||||||
|
static void zoom(const Arg *arg);
|
||||||
static void load_xresources(void);
|
static void load_xresources(void);
|
||||||
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
||||||
|
|
||||||
|
@ -1207,6 +1223,37 @@ killclient(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
loadxrdb()
|
||||||
|
{
|
||||||
|
Display *display;
|
||||||
|
char * resm;
|
||||||
|
XrmDatabase xrdb;
|
||||||
|
char *type;
|
||||||
|
XrmValue value;
|
||||||
|
|
||||||
|
display = XOpenDisplay(NULL);
|
||||||
|
|
||||||
|
if (display != NULL) {
|
||||||
|
resm = XResourceManagerString(display);
|
||||||
|
|
||||||
|
if (resm != NULL) {
|
||||||
|
xrdb = XrmGetStringDatabase(resm);
|
||||||
|
|
||||||
|
if (xrdb != NULL) {
|
||||||
|
XRDB_LOAD_COLOR("dwm.color0", normbordercolor);
|
||||||
|
XRDB_LOAD_COLOR("dwm.color0", normbgcolor);
|
||||||
|
XRDB_LOAD_COLOR("dwm.color4", normfgcolor);
|
||||||
|
XRDB_LOAD_COLOR("dwm.color8", selbordercolor);
|
||||||
|
XRDB_LOAD_COLOR("dwm.color4", selbgcolor);
|
||||||
|
XRDB_LOAD_COLOR("dwm.color0", selfgcolor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XCloseDisplay(display);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
manage(Window w, XWindowAttributes *wa)
|
manage(Window w, XWindowAttributes *wa)
|
||||||
{
|
{
|
||||||
|
@ -2576,6 +2623,17 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xrdb(const Arg *arg)
|
||||||
|
{
|
||||||
|
loadxrdb();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||||
|
focus(NULL);
|
||||||
|
arrange(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
zoom(const Arg *arg)
|
zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -2588,18 +2646,6 @@ zoom(const Arg *arg)
|
||||||
pop(c);
|
pop(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xrdb(const Arg *arg)
|
|
||||||
{
|
|
||||||
load_xresources();
|
|
||||||
|
|
||||||
for (int i = 0; i < LENGTH(colors); i++)
|
|
||||||
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
|
||||||
|
|
||||||
focus(NULL);
|
|
||||||
arrange(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue