aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2021-10-11 09:21:29 -0700
committerNicholas Noll <nnoll523@gmail.com>2021-10-11 09:21:29 -0700
commit48af0d16abdf9c0b357c39bceaa5509de3b62639 (patch)
tree63a6d5c8c4e44ae65ec479e11aca292501ea1996
parent7d7af85919bbd352bb7dc0b5751b3684f8f0a8e4 (diff)
feat(dwm): skeleton of named pipe IPCfeat/dwm-pipe
-rwxr-xr-xbin/status5
-rw-r--r--sys/cmd/dwm/config.h3
-rw-r--r--sys/cmd/dwm/dwm.c12
-rw-r--r--sys/cmd/dwm/dwm.h97
-rw-r--r--sys/cmd/rc/code.c4
-rw-r--r--sys/cmd/rc/glob.c6
6 files changed, 65 insertions, 62 deletions
diff --git a/bin/status b/bin/status
index 9dfce79..f06f7fb 100755
--- a/bin/status
+++ b/bin/status
@@ -1,6 +1,5 @@
#!/bin/bash
-# 1: last minute
cpu() {
CPULOAD=$(cut -d " " -f 1 /proc/loadavg)
printf " (%s%%)" "$CPULOAD"
@@ -70,8 +69,8 @@ ipaddr() {
}
dostatus() {
- xsetroot -name "$VOL│$MEM│$IP│$CPU│$NML│$WTR│$TIM"
- # xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM"
+ # xsetroot -name "$VOL│$MEM│$IP│$CPU│$NML│$WTR│$TIM"
+ xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM"
# echo "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM"
}
diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h
index ebf7b89..d2af108 100644
--- a/sys/cmd/dwm/config.h
+++ b/sys/cmd/dwm/config.h
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
-#define VERSION "1"
+#define VERSION "1"
+#define DWM_PIPE "DWM_PIPE"
/* appearance */
static uint borderpx = 1; /* border pixel of windows */
diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c
index 0567650..b1774e0 100644
--- a/sys/cmd/dwm/dwm.c
+++ b/sys/cmd/dwm/dwm.c
@@ -3,6 +3,7 @@
/* global variables */
char broken[] = "<broken>";
char stext[256];
+char *ipcpipe;
int scanner;
int screen;
int sw, sh; /* X display screen geometry width, height */
@@ -75,12 +76,12 @@ buttonpress(XEvent *e)
click = ClkRootWin;
/* focus monitor if necessary */
- if ((m = wintomon(ev->window)) && m != selmon) {
+ if((m = wintomon(ev->window)) && m != selmon) {
unfocus(selmon->sel, 1);
selmon = m;
focus(nil);
}
- if (ev->window == selmon->barwin) {
+ if(ev->window == selmon->barwin) {
i = x = 0;
do
x += TEXTW(tags[i]);
@@ -94,13 +95,13 @@ buttonpress(XEvent *e)
click = ClkStatusText;
else
click = ClkWinTitle;
- } else if ((c = wintoclient(ev->window))) {
+ } else if((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime);
click = ClkClientWin;
}
- for (i = 0; i < arrlen(buttons); i++)
+ for(i = 0; i < arrlen(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
@@ -806,6 +807,7 @@ setup(void)
scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */
+ ipcpipe = getenv(DWM_PIPE);
updatebars();
updatestatus();
@@ -1049,7 +1051,7 @@ updatenumlockmask(void)
void
updatestatus(void)
{
- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
+ if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
drawbar(selmon);
}
diff --git a/sys/cmd/dwm/dwm.h b/sys/cmd/dwm/dwm.h
index a934287..4fd7587 100644
--- a/sys/cmd/dwm/dwm.h
+++ b/sys/cmd/dwm/dwm.h
@@ -41,60 +41,60 @@
/* enums */
-enum
+enum
{
- MouseNormal,
- MouseResize,
- MouseMove,
+ MouseNormal,
+ MouseResize,
+ MouseMove,
MouseLast,
-}; /* mouse states */
-
-enum
-{
- SchemeNorm,
- SchemeSel
-}; /* color schemes */
-
-enum
-{
- NetSupported,
- NetWMName,
- NetWMState,
+}; /* mouse states */
+
+enum
+{
+ SchemeNorm,
+ SchemeSel
+}; /* color schemes */
+
+enum
+{
+ NetSupported,
+ NetWMName,
+ NetWMState,
NetWMCheck,
- NetWMFullscreen,
- NetActiveWindow,
+ NetWMFullscreen,
+ NetActiveWindow,
NetWMWindowType,
- NetWMWindowTypeDialog,
+ NetWMWindowTypeDialog,
NetWMWindowOpacity,
- NetClientList,
- NetLast
+ NetClientList,
+ NetLast
}; /* EWMH atoms */
-enum
-{
- WMProtocols,
- WMDelete,
- WMState,
- WMTakeFocus,
- WMLast
+enum
+{
+ WMProtocols,
+ WMDelete,
+ WMState,
+ WMTakeFocus,
+ WMLast
}; /* default atoms */
-enum
-{
- ClkTagBar,
- ClkLtSymbol,
- ClkStatusText,
+enum
+{
+ ClkTagBar,
+ ClkLtSymbol,
+ ClkStatusText,
ClkWinTitle,
- ClkClientWin,
- ClkRootWin,
- ClkLast
+ ClkClientWin,
+ ClkRootWin,
+ ClkLast
}; /* clicks */
-enum
-{
- ColFg,
- ColBg,
- ColBorder
+enum
+{
+ ColFg,
+ ColBg,
+ ColBorder
}; /* color scheme index */
typedef struct Monitor Monitor;
@@ -214,22 +214,23 @@ extern char broken[];
extern char stext[256];
extern int scanner;
extern int screen;
-extern int sw, sh;
+extern int sw, sh;
extern int bh, blw;
extern int lrpad;
extern int (*xerrorxlib)(Display *, XErrorEvent *);
extern uint numlockmask;
extern void (*handler[LASTEvent]) (XEvent *);
extern int scratchtag;
+extern char *ipcpipe;
extern xcb_connection_t *xcon;
extern Atom wmatom[WMLast], netatom[NetLast];
-extern int running;
-extern Cur *cursor[MouseLast];
-extern Clr **scheme;
-extern Display *dpy;
-extern Drw *drw;
+extern int running;
+extern Cur *cursor[MouseLast];
+extern Clr **scheme;
+extern Display *dpy;
+extern Drw *drw;
extern Monitor *mons, *selmon;
extern Window root, wmcheckwin;
diff --git a/sys/cmd/rc/code.c b/sys/cmd/rc/code.c
index edf47cf..b7eb728 100644
--- a/sys/cmd/rc/code.c
+++ b/sys/cmd/rc/code.c
@@ -34,7 +34,7 @@ stuffdot(Code *p)
int a;
a = p - code.buf;
- if (code.ip <= p || p < code.buf)
+ if(code.ip <= p || p < code.buf)
panic("bad address %d in stuffdot", a);
code.buf[a].i = code.ip-code.buf;
}
@@ -46,7 +46,7 @@ rcc(Tree *t, int eflag)
Code *p, *q;
Tree *tt;
- if (!t)
+ if(!t)
return;
switch(t->type) {
diff --git a/sys/cmd/rc/glob.c b/sys/cmd/rc/glob.c
index 95b2ef3..193652a 100644
--- a/sys/cmd/rc/glob.c
+++ b/sys/cmd/rc/glob.c
@@ -19,7 +19,7 @@ unglob(char *s)
}
/*
- * inspiration from rsc's blog post
+ * inspiration from rsc's blog post
* modified for utf8 sequences and character classes
* returns 1 if string matches pattern is found, 0 otherwise
*/
@@ -158,8 +158,8 @@ globdir(char *p, char *path, int fd)
j = 0;
while((e = readdir(d))) {
- if (e->d_name[0] == '.')
- if (e->d_name[1] == 0 || /* . */
+ if(e->d_name[0] == '.')
+ if(e->d_name[1] == 0 || /* . */
(e->d_name[1] == '.' && e->d_name[2] == 0)) /* .. */
continue;