1 Commits

Author SHA1 Message Date
Fabian Schmidt
a004cdd76d Added a distro symbol (similar to what you'll find in DEs). Not yet functional. 2020-05-30 22:13:12 +02:00
2 changed files with 20 additions and 23 deletions

View File

@@ -5,7 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const char buttonbar[] = "<O>"; static const char *distrosymbol = "";
static const char *fonts[] = { "monospace:size=10" }; static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10"; static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222"; static const char col_gray1[] = "#222222";
@@ -101,7 +101,6 @@ static Key keys[] = {
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = { static Button buttons[] = {
/* click event mask button function argument */ /* click event mask button function argument */
{ ClkButton, 0, Button1, spawn, {.v = dmenucmd } },
{ ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} }, { ClkWinTitle, 0, Button2, zoom, {0} },

40
dwm.c
View File

@@ -64,7 +64,7 @@ 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, ClkButton, ClkWinTitle, enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
typedef union { typedef union {
@@ -113,6 +113,7 @@ typedef struct {
struct Monitor { struct Monitor {
char ltsymbol[16]; char ltsymbol[16];
char distrosymbol[16];
float mfact; float mfact;
int nmaster; int nmaster;
int num; int num;
@@ -431,24 +432,20 @@ buttonpress(XEvent *e)
focus(NULL); focus(NULL);
} }
if (ev->window == selmon->barwin) { if (ev->window == selmon->barwin) {
i = x = 0; x = TEXTW(m->distrosymbol);
x += TEXTW(buttonbar); i = 0;
if(ev->x < x) { do
click = ClkButton; x += TEXTW(tags[i]);
} else { while (ev->x >= x && ++i < LENGTH(tags));
do if (i < LENGTH(tags)) {
x += TEXTW(tags[i]); click = ClkTagBar;
while (ev->x >= x && ++i < LENGTH(tags)); arg.ui = 1 << i;
if (i < LENGTH(tags)) { } else if (ev->x < x + blw)
click = ClkTagBar; click = ClkLtSymbol;
arg.ui = 1 << i; else if (ev->x > selmon->ww - TEXTW(stext))
} else if (ev->x < x + blw) click = ClkStatusText;
click = ClkLtSymbol; else
else if (ev->x > selmon->ww - TEXTW(stext)) click = ClkWinTitle;
click = ClkStatusText;
else
click = ClkWinTitle;
}
} else if ((c = wintoclient(ev->window))) { } else if ((c = wintoclient(ev->window))) {
focus(c); focus(c);
restack(selmon); restack(selmon);
@@ -647,6 +644,7 @@ createmon(void)
m->lt[0] = &layouts[0]; m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)]; m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
strncpy(m->distrosymbol, distrosymbol, sizeof m->distrosymbol);
return m; return m;
} }
@@ -720,9 +718,9 @@ drawbar(Monitor *m)
urg |= c->tags; urg |= c->tags;
} }
x = 0; x = 0;
w = blw = TEXTW(buttonbar); w = blw = TEXTW(m->distrosymbol);
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, buttonbar, 0); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->distrosymbol, 0);
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]); w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);