mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding staticstatus patch
This commit is contained in:
parent
622c4bc0d6
commit
164095db40
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2020-06-10 - Added the staticstatus patch
|
||||||
|
|
||||||
2020-05-31 - Added the keymodes patch
|
2020-05-31 - Added the keymodes patch
|
||||||
|
|
||||||
2020-05-29 - Added the color emoji patch
|
2020-05-29 - Added the color emoji patch
|
||||||
@ -359,6 +361,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
- [stacker](https://dwm.suckless.org/patches/stacker/)
|
- [stacker](https://dwm.suckless.org/patches/stacker/)
|
||||||
- provides comprehensive utilities for managing the client stack
|
- provides comprehensive utilities for managing the client stack
|
||||||
|
|
||||||
|
- [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
|
||||||
|
- allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor
|
||||||
|
|
||||||
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
|
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
|
||||||
- adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
|
- adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ static const int focusonwheel = 0;
|
|||||||
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||||
static const int vertpadbar = 0; /* vertical padding for statusbar */
|
static const int vertpadbar = 0; /* vertical padding for statusbar */
|
||||||
#endif // STATUSPADDING_PATCH
|
#endif // STATUSPADDING_PATCH
|
||||||
|
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
|
||||||
|
static const int statmonval = 0;
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||||
static const unsigned int systrayspacing = 2; /* systray spacing */
|
static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||||
|
51
dwm.c
51
dwm.c
@ -248,6 +248,7 @@ struct Monitor {
|
|||||||
int nmaster;
|
int nmaster;
|
||||||
int num;
|
int num;
|
||||||
int by; /* bar geometry */
|
int by; /* bar geometry */
|
||||||
|
int tw; /* bar text width */
|
||||||
#if EXTRABAR_PATCH
|
#if EXTRABAR_PATCH
|
||||||
int eby; /* extra bar geometry */
|
int eby; /* extra bar geometry */
|
||||||
#endif // EXTRABAR_PATCH
|
#endif // EXTRABAR_PATCH
|
||||||
@ -458,7 +459,6 @@ static char estext[256];
|
|||||||
static int screen;
|
static int screen;
|
||||||
static int sw, sh; /* X display screen geometry width, height */
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
static int bh, blw = 0; /* bar geometry */
|
static int bh, blw = 0; /* bar geometry */
|
||||||
static int tw = 0; /* bar text width */
|
|
||||||
static int lrpad; /* sum of left and right padding for text */
|
static int lrpad; /* sum of left and right padding for text */
|
||||||
#if BARPADDING_PATCH
|
#if BARPADDING_PATCH
|
||||||
static int vp; /* vertical padding for bar */
|
static int vp; /* vertical padding for bar */
|
||||||
@ -506,6 +506,9 @@ static Clr **scheme;
|
|||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
static Drw *drw;
|
static Drw *drw;
|
||||||
static Monitor *mons, *selmon;
|
static Monitor *mons, *selmon;
|
||||||
|
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
|
||||||
|
static Monitor *statmon;
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
static Window root, wmcheckwin;
|
static Window root, wmcheckwin;
|
||||||
|
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
@ -820,13 +823,13 @@ buttonpress(XEvent *e)
|
|||||||
} else if (ev->x < x + blw)
|
} else if (ev->x < x + blw)
|
||||||
click = ClkLtSymbol;
|
click = ClkLtSymbol;
|
||||||
#endif // TAGGRID_PATCH
|
#endif // TAGGRID_PATCH
|
||||||
else if (ev->x > selmon->ww - tw + padding)
|
else if (ev->x > selmon->ww - selmon->tw + padding)
|
||||||
#if !STATUSCMD_PATCH
|
#if !STATUSCMD_PATCH
|
||||||
click = ClkStatusText;
|
click = ClkStatusText;
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
click = ClkStatusText;
|
click = ClkStatusText;
|
||||||
xc = selmon->ww - tw + padding;
|
xc = selmon->ww - selmon->tw + padding;
|
||||||
#if STATUSPADDING_PATCH
|
#if STATUSPADDING_PATCH
|
||||||
xc += lrpad / 2;
|
xc += lrpad / 2;
|
||||||
#endif // STATUSPADDING_PATCH
|
#endif // STATUSPADDING_PATCH
|
||||||
@ -1446,7 +1449,12 @@ drawbar(Monitor *m)
|
|||||||
|
|
||||||
/* draw status first so it can be overdrawn by tags later */
|
/* draw status first so it can be overdrawn by tags later */
|
||||||
#if !STATUSALLMONS_PATCH
|
#if !STATUSALLMONS_PATCH
|
||||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
#if STATICSTATUS_PATCH
|
||||||
|
if (m == statmon)
|
||||||
|
#else
|
||||||
|
if (m == selmon)
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
|
{ /* status is only drawn on selected monitor */
|
||||||
#endif // STATUSALLMONS_PATCH
|
#endif // STATUSALLMONS_PATCH
|
||||||
#if VTCOLORS_PATCH
|
#if VTCOLORS_PATCH
|
||||||
drw_setscheme(drw, scheme[SchemeStatus]);
|
drw_setscheme(drw, scheme[SchemeStatus]);
|
||||||
@ -1455,9 +1463,9 @@ drawbar(Monitor *m)
|
|||||||
#endif // VTCOLORS_PATCH
|
#endif // VTCOLORS_PATCH
|
||||||
#if STATUSCOLORS_PATCH
|
#if STATUSCOLORS_PATCH
|
||||||
#if STATUSPADDING_PATCH
|
#if STATUSPADDING_PATCH
|
||||||
tw = textw_wosc(stext) + lrpad + 2;
|
m->tw = textw_wosc(stext) + lrpad + 2;
|
||||||
#else
|
#else
|
||||||
tw = textw_wosc(stext) + 2;
|
m->tw = textw_wosc(stext) + 2;
|
||||||
#endif // STATUSPADDING_PATCH
|
#endif // STATUSPADDING_PATCH
|
||||||
while (1) {
|
while (1) {
|
||||||
if ((unsigned int)*ts > LENGTH(colors)) {
|
if ((unsigned int)*ts > LENGTH(colors)) {
|
||||||
@ -1466,7 +1474,7 @@ drawbar(Monitor *m)
|
|||||||
}
|
}
|
||||||
ctmp = *ts;
|
ctmp = *ts;
|
||||||
*ts = '\0';
|
*ts = '\0';
|
||||||
drw_text(drw, m->ww - tw - stw + tx, 0, tw - tx, bh, stp, tp, 0);
|
drw_text(drw, m->ww - m->tw - stw + tx, 0, m->tw - tx, bh, stp, tp, 0);
|
||||||
tx += TEXTW(tp) - lrpad;
|
tx += TEXTW(tp) - lrpad;
|
||||||
if (ctmp == '\0')
|
if (ctmp == '\0')
|
||||||
break;
|
break;
|
||||||
@ -1475,14 +1483,14 @@ drawbar(Monitor *m)
|
|||||||
tp = ++ts;
|
tp = ++ts;
|
||||||
}
|
}
|
||||||
#elif STATUS2D_PATCH
|
#elif STATUS2D_PATCH
|
||||||
tw = m->ww - drawstatusbar(m, bh, stext, stw, stp);
|
m->tw = m->ww - drawstatusbar(m, bh, stext, stw, stp);
|
||||||
#else // STATUSCOLORS_PATCH
|
#else // STATUSCOLORS_PATCH
|
||||||
#if STATUSPADDING_PATCH
|
#if STATUSPADDING_PATCH
|
||||||
tw = TEXTW(stext);
|
m->tw = TEXTW(stext);
|
||||||
#else
|
#else
|
||||||
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
m->tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
#endif // STATUSPADDING_PATCH
|
#endif // STATUSPADDING_PATCH
|
||||||
drw_text(drw, m->ww - tw - stw, 0, tw, bh, stp, stext, 0);
|
drw_text(drw, m->ww - m->tw - stw, 0, m->tw, bh, stp, stext, 0);
|
||||||
#endif // STATUSCOLORS_PATCH
|
#endif // STATUSCOLORS_PATCH
|
||||||
#if !STATUSALLMONS_PATCH
|
#if !STATUSALLMONS_PATCH
|
||||||
}
|
}
|
||||||
@ -1578,7 +1586,7 @@ drawbar(Monitor *m)
|
|||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
#endif // LEFTLAYOUT_PATCH
|
#endif // LEFTLAYOUT_PATCH
|
||||||
|
|
||||||
if ((w = m->ww - tw - stw - x) > bh)
|
if ((w = m->ww - m->tw - stw - x) > bh)
|
||||||
{
|
{
|
||||||
#if AWESOMEBAR_PATCH
|
#if AWESOMEBAR_PATCH
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
@ -3760,7 +3768,7 @@ updategeom(void)
|
|||||||
else
|
else
|
||||||
mons = createmon();
|
mons = createmon();
|
||||||
}
|
}
|
||||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
for (i = 0, m = mons; i < nn && m; m = m->next, i++) {
|
||||||
if (i >= n
|
if (i >= n
|
||||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||||
@ -3773,6 +3781,11 @@ updategeom(void)
|
|||||||
m->mh = m->wh = unique[i].height;
|
m->mh = m->wh = unique[i].height;
|
||||||
updatebarpos(m);
|
updatebarpos(m);
|
||||||
}
|
}
|
||||||
|
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
|
||||||
|
if (i == statmonval)
|
||||||
|
statmon = m;
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
|
}
|
||||||
} else { /* less monitors available nn < n */
|
} else { /* less monitors available nn < n */
|
||||||
for (i = nn; i < n; i++) {
|
for (i = nn; i < n; i++) {
|
||||||
for (m = mons; m && m->next; m = m->next);
|
for (m = mons; m && m->next; m = m->next);
|
||||||
@ -3786,6 +3799,10 @@ updategeom(void)
|
|||||||
}
|
}
|
||||||
if (m == selmon)
|
if (m == selmon)
|
||||||
selmon = mons;
|
selmon = mons;
|
||||||
|
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
|
||||||
|
if (m == statmon)
|
||||||
|
statmon = mons;
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
cleanupmon(m);
|
cleanupmon(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3802,6 +3819,10 @@ updategeom(void)
|
|||||||
updatebarpos(mons);
|
updatebarpos(mons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
|
||||||
|
if (!statmon)
|
||||||
|
statmon = mons;
|
||||||
|
#endif // STATICSTATUS_PATCH
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
selmon = mons;
|
selmon = mons;
|
||||||
selmon = wintomon(root);
|
selmon = wintomon(root);
|
||||||
@ -3909,9 +3930,11 @@ updatestatus(void)
|
|||||||
#if STATUSALLMONS_PATCH
|
#if STATUSALLMONS_PATCH
|
||||||
for (m = mons; m; m = m->next)
|
for (m = mons; m; m = m->next)
|
||||||
drawbar(m);
|
drawbar(m);
|
||||||
|
#elif STATICSTATUS_PATCH
|
||||||
|
drawbar(statmon);
|
||||||
#else
|
#else
|
||||||
drawbar(selmon);
|
drawbar(selmon);
|
||||||
#endif // STATUSALLMONS_PATCH
|
#endif // STATUSALLMONS_PATCH | STATICSTATUS_PATCH
|
||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
if (showsystray)
|
if (showsystray)
|
||||||
updatesystray();
|
updatesystray();
|
||||||
|
@ -509,6 +509,13 @@
|
|||||||
*/
|
*/
|
||||||
#define STACKER_PATCH 0
|
#define STACKER_PATCH 0
|
||||||
|
|
||||||
|
/* This patch allows the status text to be fixed to the bar on a specific
|
||||||
|
* monitor rather than being drawn on the focused monitor.
|
||||||
|
* The statusallmons patch takes precedence over this patch.
|
||||||
|
* https://dwm.suckless.org/patches/staticstatus/
|
||||||
|
*/
|
||||||
|
#define STATICSTATUS_PATCH 0
|
||||||
|
|
||||||
/* Status2d allows colors and rectangle drawing in the dwm status bar.
|
/* Status2d allows colors and rectangle drawing in the dwm status bar.
|
||||||
* This patch is incompatible with the statuscolors patch which takes precedence.
|
* This patch is incompatible with the statuscolors patch which takes precedence.
|
||||||
* This patch is incompatible with the extrabar patch.
|
* This patch is incompatible with the extrabar patch.
|
||||||
|
Loading…
Reference in New Issue
Block a user