Compare commits

...

5 Commits

Author SHA1 Message Date
moonsabre
aff4ecbb82 Merge with branch "moonpatch" 2025-03-11 21:42:39 -07:00
moonsabre
c2d88beda8 Undo everything one more time. 2025-03-11 21:38:10 -07:00
moonsabre
f8d1ae37ff Squash previous 4 commits into 1 commit. 2025-03-11 19:04:34 -07:00
moonsabre
d0ee59596d Revert past 4 commits. 2025-03-11 19:02:00 -07:00
moonsabre
b50e03a136 Update bartruecenteredtitle for compatibility with DWL patch guidelines. 2025-03-11 18:35:08 -07:00
3 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,9 @@
### Description
A homegrown port of dwm's _truecenteredtitle_ patch, with the addition of a config option to toggle its effects.<br>Requires [the bar patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) to be applied beforehand.
![](centertitle.webp)
![](centeredtitle.webp)
### Download
- [v0.7](/dwl/dwl-patches/raw/branch/main/patches/centertitle/centertitle-v0.7.patch)<br>Targets latest dwl release v0.7.
- [v0.7](/dwl/dwl-patches/raw/branch/main/patches/bartruecenteredtitle/bar-truecenteredtitle-v0.7.patch)<br>Targets latest dwl release v0.7.
### Author
- [Codeberg: moonsabre](https://codeberg.org/moonsabre)<br>[Discord: moonsabre.](https://discordapp.com/users/1334621003648733274)
- [moonsabre](https://codeberg.org/moonsabre)

View File

@ -16,7 +16,7 @@ index 5d1dc2b..ecbf223 100644
static const unsigned int borderpx = 1; /* border pixel of windows */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const int centertitle = 1; /* 1 means center window title */
+static const int centeredtitle = 1; /* 1 means center window title */
static const char *fonts[] = {"monospace:size=10"};
static const float rootcolor[] = COLOR(0x000000ff);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
@ -29,7 +29,7 @@ index ece537a..d7ffce2 100644
if (c) {
drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
+ if ((centertitle == 0) || (TEXTW(selmon, client_get_title(c)) > w)) {
+ if ((centeredtitle == 0) || (TEXTW(selmon, client_get_title(c)) > w)) {
+ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
+ } else {
+ drwl_text(m->drw, x, 0, w, m->b.height, (w - TEXTW(selmon, client_get_title(c))) / 2, client_get_title(c), 0);

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB