Compare commits

..

No commits in common. "aff4ecbb822cc432d5fade4ffd1fb239917f70c0" and "8ac4f9397d41812085aa7e3461decba4efe2f56e" have entirely different histories.

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.
![](centeredtitle.webp)
![](centertitle.webp)
### Download
- [v0.7](/dwl/dwl-patches/raw/branch/main/patches/bartruecenteredtitle/bar-truecenteredtitle-v0.7.patch)<br>Targets latest dwl release v0.7.
- [v0.7](/dwl/dwl-patches/raw/branch/main/patches/centertitle/centertitle-v0.7.patch)<br>Targets latest dwl release v0.7.
### Author
- [moonsabre](https://codeberg.org/moonsabre)
- [Codeberg: moonsabre](https://codeberg.org/moonsabre)<br>[Discord: moonsabre.](https://discordapp.com/users/1334621003648733274)

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 centeredtitle = 1; /* 1 means center window title */
+static const int centertitle = 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 ((centeredtitle == 0) || (TEXTW(selmon, client_get_title(c)) > w)) {
+ if ((centertitle == 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