Adding statuspadding patch

This commit is contained in:
bakkeby 2019-09-07 23:29:37 +02:00
parent ffe8da4273
commit c356be36b9
4 changed files with 30 additions and 4 deletions

View File

@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-09-07 - Added cyclelayouts, resizecorners, rotatestack and savefloats patches
2019-09-07 - Added cyclelayouts, resizecorners, rotatestack, savefloats and statuspadding patches
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom, autostart, fancybar, focusonnetactive and losefullscreen patches
@ -38,7 +38,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
- [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
- let's you cycle through all your layouts
- lets you cycle through all your layouts
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
- shows the titles of all visible windows in the status bar
@ -66,6 +66,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- saves size and position of every floating window before it is forced into tiled mode
- if the window is made floating again then the old dimensions will be restored
- [statuspadding](https://dwm.suckless.org/patches/statuspadding/)
- adds configuration options for horizontal and vertical padding in the status bar
- [systray](https://dwm.suckless.org/patches/systray/)
- adds system tray in the status bar

View File

@ -5,6 +5,10 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
#if STATUSPADDING_PATCH
static const int horizpadbar = 2; /* horizontal padding for statusbar */
static const int vertpadbar = 0; /* vertical padding for statusbar */
#endif // STATUSPADDING_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 systrayspacing = 2; /* systray spacing */

14
dwm.c
View File

@ -862,12 +862,21 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
#if STATUSPADDING_PATCH
sw = TEXTW(stext);
#if SYSTRAY_PATCH
drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2, stext, 0);
#else
drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2, stext, 0);
#endif // SYSTRAY_PATCH
#else
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
#if SYSTRAY_PATCH
drw_text(drw, m->ww - sw - stw, 0, sw, bh, 0, stext, 0);
#else
drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
#endif // SYSTRAY_PATCH
#endif // STATUSPADDING_PATCH
}
for (c = m->clients; c; c = c->next) {
@ -1958,8 +1967,13 @@ setup(void)
#endif // ALPHA_PATCH
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
#if STATUSPADDING_PATCH
lrpad = drw->fonts->h + horizpadbar;
bh = drw->fonts->h + vertpadbar;
#else
lrpad = drw->fonts->h;
bh = drw->fonts->h + 2;
#endif // STATUSPADDING_PATCH
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);

View File

@ -44,7 +44,7 @@
*/
#define AUTOSTART_PATCH 0
/* The cyclelayouts patch let's you cycle through all your layouts.
/* The cyclelayouts patch lets you cycle through all your layouts.
* https://dwm.suckless.org/patches/cyclelayouts/
*/
#define CYCLELAYOUTS_PATCH 0
@ -97,7 +97,12 @@
* will be restored.
* https://dwm.suckless.org/patches/save_floats/
*/
#define SAVEFLOATS_PATCH 1
#define SAVEFLOATS_PATCH 0
/* This patch adds configuration options for horizontal and vertical padding in the status bar.
* https://dwm.suckless.org/patches/statuspadding/
*/
#define STATUSPADDING_PATCH 0
/* The systray patch adds systray for the status bar.
* https://dwm.suckless.org/patches/systray/