This commit is contained in:
DarthMooMancer committed 2025-09-13 16:57:19 -04:00
1 parent 6fe12bd384
commit 81a2a206be
5 files changed
+42 -88

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
/* See LICENSE file for copyright and license details. */
#include <ctype.h> #include <ctype.h>
#include <locale.h> #include <locale.h>
#include <stdio.h> #include <stdio.h>
+1 -1
View File
@@ -13,7 +13,7 @@ static const unsigned int gappx = 5;
static const int showbar = 1; static const int showbar = 1;
static const int topbar = 1; static const int topbar = 1;
static const char *fonts[] = { "Cascadia Mono:style:Medium:size=10:antialias=true:autohint=true" }; static const char *fonts[] = { "Cascadia Mono:style:Bold:size=10:antialias=true:autohint=true" };
static const char *colors[][3] = { static const char *colors[][3] = {
[SchemeNorm] = { "#D3C6AA", "#272E33", "#83C092" }, [SchemeNorm] = { "#D3C6AA", "#272E33", "#83C092" },
[SchemeSel] = { "#374145", "#DBBC7F", "#A7C080" }, [SchemeSel] = { "#374145", "#DBBC7F", "#A7C080" },
+40 -70
View File
@@ -33,8 +33,6 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
typedef union { typedef union {
int i; int i;
@@ -43,14 +41,6 @@ typedef union {
const void *v; const void *v;
} Arg; } Arg;
typedef struct {
unsigned int click;
unsigned int mask;
unsigned int button;
void (*func)(const Arg *arg);
const Arg arg;
} Button;
typedef struct Monitor Monitor; typedef struct Monitor Monitor;
typedef struct Client Client; typedef struct Client Client;
struct Client { struct Client {
@@ -169,7 +159,6 @@ static void unmapnotify(XEvent *e);
static void updatebars(void); static void updatebars(void);
static int updategeom(void); static int updategeom(void);
static void updatesizehints(Client *c); static void updatesizehints(Client *c);
static void updatestatus(void);
static void updatetitle(Client *c); static void updatetitle(Client *c);
static void updatewindowtype(Client *c); static void updatewindowtype(Client *c);
static void updatewmhints(Client *c); static void updatewmhints(Client *c);
@@ -889,9 +878,7 @@ void propertynotify(XEvent *e) {
Window trans; Window trans;
XPropertyEvent *ev = &e->xproperty; XPropertyEvent *ev = &e->xproperty;
if ((ev->window == root) && (ev->atom == XA_WM_NAME)) if (ev->state == PropertyDelete)
updatestatus();
else if (ev->state == PropertyDelete)
return; /* ignore */ return; /* ignore */
else if ((c = wintoclient(ev->window))) { else if ((c = wintoclient(ev->window))) {
switch(ev->atom) { switch(ev->atom) {
@@ -1136,7 +1123,6 @@ void setup(void) {
scheme[i] = drw_scm_create(drw, colors[i], 3); scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */ /* init bars */
updatebars(); updatebars();
updatestatus();
/* supporting window for NetWMCheck */ /* supporting window for NetWMCheck */
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
@@ -1152,7 +1138,7 @@ void setup(void) {
/* select events */ /* select events */
wa.cursor = cursor[CurNormal]->cursor; wa.cursor = cursor[CurNormal]->cursor;
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|ButtonPressMask|PointerMotionMask|EnterWindowMask |PointerMotionMask|EnterWindowMask
|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; |LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask); XSelectInput(dpy, root, wa.event_mask);
@@ -1214,32 +1200,34 @@ void tag(const Arg *arg) {
} }
void tile(Monitor *m) { void tile(Monitor *m) {
unsigned int i, n, h, g = 0, mw, my, ty; unsigned int i, n, h, g = 0, mw, ty;
Client *c; Client *client;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); for (n = 0, client = nexttiled(m->clients); client; client = nexttiled(client->next), n++);
if (n == 0) if (n == 0)
return; return;
if (n > m->nmaster) if (n > m->nmaster) {
mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0; mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0;
else
mw = m->ww - m->gappx;
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
if (my + HEIGHT(c) + m->gappx < m->wh)
my += HEIGHT(c) + m->gappx;
} else { mw = m->ww - m->gappx; }
for (i = 0, ty = m->gappx, client = nexttiled(m->clients); client; client = nexttiled(client->next), i++) {
if (i == 0) {
// Master window
h = m->wh - 2 * m->gappx;
resize(client, m->wx + m->gappx, m->wy + m->gappx, mw - (2 * client->bw) - m->gappx, h - (2 * client->bw), 0);
} else { } else {
// Stack windows
h = (m->wh - ty) / (n - i) - m->gappx; h = (m->wh - ty) / (n - i) - m->gappx;
resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); resize(client, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2 * client->bw) - 2 * m->gappx, h - (2 * client->bw), 0);
if (ty + HEIGHT(c) + m->gappx < m->wh) if (ty + HEIGHT(client) + m->gappx < m->wh) {
ty += HEIGHT(c) + m->gappx; ty += HEIGHT(client) + m->gappx;
}
}
}
}
}
}
void toggleview(const Arg *arg) { void toggleview(const Arg *arg) {
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
if (newtagset) { if (newtagset) {
@@ -1271,7 +1259,6 @@ void unmanage(Client *c, int destroyed) {
XSetErrorHandler(xerrordummy); XSetErrorHandler(xerrordummy);
XSelectInput(dpy, c->win, NoEventMask); XSelectInput(dpy, c->win, NoEventMask);
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setclientstate(c, WithdrawnState); setclientstate(c, WithdrawnState);
XSync(dpy, False); XSync(dpy, False);
XSetErrorHandler(xerror); XSetErrorHandler(xerror);
@@ -1306,7 +1293,7 @@ void updatebars(void) {
XSetWindowAttributes wa = { XSetWindowAttributes wa = {
.override_redirect = True, .override_redirect = True,
.background_pixmap = ParentRelative, .background_pixmap = ParentRelative,
.event_mask = ButtonPressMask|ExposureMask .event_mask = ExposureMask
}; };
XClassHint ch = {"dwm", "dwm"}; XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
@@ -1397,12 +1384,6 @@ void updatesizehints(Client *c) {
} }
} }
void updatestatus(void) {
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, " dwm ");
drawbar(selmon);
}
void updatetitle(Client *c) { void updatetitle(Client *c) {
if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
@@ -1414,10 +1395,8 @@ void updatewindowtype(Client *c) {
Atom state = getatomprop(c, netatom[NetWMState]); Atom state = getatomprop(c, netatom[NetWMState]);
Atom wtype = getatomprop(c, netatom[NetWMWindowType]); Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
if (state == netatom[NetWMFullscreen]) if (state == netatom[NetWMFullscreen]) setfullscreen(c, 1);
setfullscreen(c, 1); if (wtype == netatom[NetWMWindowTypeDialog]) c->isfloating = 1;
if (wtype == netatom[NetWMWindowTypeDialog])
c->isfloating = 1;
} }
void updatewmhints(Client *c) { void updatewmhints(Client *c) {
@@ -1437,11 +1416,9 @@ void updatewmhints(Client *c) {
} }
void view(const Arg *arg) { void view(const Arg *arg) {
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return;
return;
selmon->seltags ^= 1; /* toggle sel tagset */ selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK) if (arg->ui & TAGMASK) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }
@@ -1450,10 +1427,11 @@ Client * wintoclient(Window w) {
Client *c; Client *c;
Monitor *m; Monitor *m;
for (m = mons; m; m = m->next) for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next) for (c = m->clients; c; c = c->next) {
if (c->win == w) if (c->win == w) return c;
return c; }
}
return NULL; return NULL;
} }
@@ -1462,13 +1440,11 @@ Monitor * wintomon(Window w) {
Client *c; Client *c;
Monitor *m; Monitor *m;
if (w == root && getrootptr(&x, &y)) if (w == root && getrootptr(&x, &y)) return recttomon(x, y, 1, 1);
return recttomon(x, y, 1, 1); for (m = mons; m; m = m->next) {
for (m = mons; m; m = m->next) if (w == m->barwin) return m;
if (w == m->barwin) }
return m; if ((c = wintoclient(w))) return c->mon;
if ((c = wintoclient(w)))
return c->mon;
return selmon; return selmon;
} }
@@ -1482,7 +1458,6 @@ int xerror(Display *dpy, XErrorEvent *ee) {
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
|| (ee->request_code == X_GrabButton && ee->error_code == BadAccess)
|| (ee->request_code == X_GrabKey && ee->error_code == BadAccess) || (ee->request_code == X_GrabKey && ee->error_code == BadAccess)
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
return 0; return 0;
@@ -1491,23 +1466,18 @@ int xerror(Display *dpy, XErrorEvent *ee) {
return xerrorxlib(dpy, ee); /* may call exit */ return xerrorxlib(dpy, ee); /* may call exit */
} }
int xerrordummy(Display *dpy, XErrorEvent *ee) { int xerrordummy(Display *dpy, XErrorEvent *ee) { return 0; }
return 0;
}
void zoom(const Arg *arg) { void zoom(const Arg *arg) {
Client *c = selmon->sel; Client *c = selmon->sel;
if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating) if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating) return;
return; if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next))) return;
if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
return;
pop(c); pop(c);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (!(dpy = XOpenDisplay(NULL))) if (!(dpy = XOpenDisplay(NULL))) die("dwm: cannot open display");
die("dwm: cannot open display");
setup(); setup();
scan(); scan();
run(); run();
+1 -1
View File
@@ -1,4 +1,4 @@
static char *font = "CaskaydiaCove Nerd Font Mono:weight=180:size=11.5:antialias=true:autohint=true"; static char *font = "Cascadia Mono:style=Bold:size=11:antialias=true:autohint=true";
static int borderpx = 10; static int borderpx = 10;
/* /*
-15
View File
@@ -22,10 +22,6 @@
#if defined(__linux) #if defined(__linux)
#include <pty.h> #include <pty.h>
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
#include <util.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#include <libutil.h>
#endif #endif
/* Arbitrary sizes */ /* Arbitrary sizes */
@@ -802,17 +798,6 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
die("ioctl TIOCSCTTY failed: %s\n", strerror(errno)); die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
if (s > 2) if (s > 2)
close(s); close(s);
#ifdef __OpenBSD__
if (pledge("stdio getpw proc exec", NULL) == -1)
die("pledge\n");
#endif
execsh(cmd, args);
break;
default:
#ifdef __OpenBSD__
if (pledge("stdio rpath tty proc", NULL) == -1)
die("pledge\n");
#endif
close(s); close(s);
cmdfd = m; cmdfd = m;
signal(SIGCHLD, sigchld); signal(SIGCHLD, sigchld);