aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Noelke <cjn075@sheriffmediocre.xyz>2023-11-08 12:37:42 -0500
committerCaleb Noelke <cjn075@sheriffmediocre.xyz>2023-11-08 12:37:42 -0500
commit8e0be8e8639399ba30de487027c9cb6b3640dd77 (patch)
treea959e16f067cf25c500dbf1454b748a4756d6aea
parente71802f50697ae8948f133a6dde967a918029064 (diff)
parent499d9e523a156e55511cee24ac30da9c0c9919fb (diff)
-rw-r--r--Makefile10
-rw-r--r--config.h6
-rw-r--r--dwm.c72
3 files changed, 18 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index db5beb0..452385c 100644
--- a/Makefile
+++ b/Makefile
@@ -35,18 +35,12 @@ dist: clean
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
- cp -f dwm ${DESTDIR}${PREFIX}/bin
- chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
+ install -Dm755 ./dwm ${DESTDIR}${PREFIX}/bin
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
mkdir -p ${DESTDIR}${PREFIX}/share/dwm
- cp -f larbs.mom ${DESTDIR}${PREFIX}/share/dwm
- chmod 644 ${DESTDIR}${PREFIX}/share/dwm/larbs.mom
- mkdir -p /usr/share/xsessions
- cp -f dwm.desktop /usr/share/xsessions
- chmod 644 /usr/share/xsessions/dwm.desktop
-
+ install -Dm644 ./larbs.mom ${DESTDIR}${PREFIX}/share/dwm
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
diff --git a/config.h b/config.h
index d71a57a..610097e 100644
--- a/config.h
+++ b/config.h
@@ -168,7 +168,7 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_q, spawn, {.v = (const char*[]){ "sysact", NULL } } },
{ MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, 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") },
+ { MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook 2>/dev/null") },
{ 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|ShiftMask, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "htop", NULL } } },
@@ -264,8 +264,8 @@ static const Key keys[] = {
{ 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_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@ 3%-; 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_AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%+ && wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%-; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } },
{ 0, XF86XK_AudioNext, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } },
{ 0, XF86XK_AudioPause, spawn, {.v = (const char*[]){ "mpc", "pause", NULL } } },
diff --git a/dwm.c b/dwm.c
index 3c0afbf..1ce854c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -68,21 +68,6 @@
#define SPTAG(i) ((1 << LENGTH(tags)) << (i))
#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
#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))))
/* enums */
@@ -228,7 +213,6 @@ static void grabkeys(void);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
-static void loadxrdb(void);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
@@ -296,8 +280,8 @@ static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
-static void xrdb(const Arg *arg);
static void zoom(const Arg *arg);
+static void xrdb(const Arg *arg);
static void load_xresources(void);
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
@@ -1224,37 +1208,6 @@ 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
manage(Window w, XWindowAttributes *wa)
{
Client *c, *t = NULL, *term = NULL;
@@ -2624,17 +2577,6 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
}
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
zoom(const Arg *arg)
{
Client *c = selmon->sel;
@@ -2647,6 +2589,18 @@ zoom(const Arg *arg)
}
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
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
{
char *sdst = NULL;