Change: Remove #defines for winicon patches and use integers directly

instead. Also rename sizeicon and spacingicon to iconsize and
iconspacing respectively as it makes more sense and add Xresources
entry for iconspacing as it was not there before, oops.

Finally remove status define as it is not necessary because there is
already an integer
This commit is contained in:
speediegq 2022-09-16 20:33:43 +02:00
parent b111952641
commit 3e30a624ef
5 changed files with 12 additions and 15 deletions

View file

@ -11,10 +11,6 @@
* Once you're done with your edits, run 'make clean install'. * Once you're done with your edits, run 'make clean install'.
*************************************************************/ *************************************************************/
#define STATUSBAR status
#define ICONSIZE sizeicon
#define ICONSPACING spacingicon
static const char *const autostart[] = { static const char *const autostart[] = {
/* Autostart script, if it exists */ /* Autostart script, if it exists */
@ -41,7 +37,7 @@ static const char *const autostart[] = {
shell, "-c", NOTIFICATION "&", NULL, shell, "-c", NOTIFICATION "&", NULL,
/* Run the status bar defined */ /* Run the status bar defined */
shell, "-c", STATUSBAR, NULL, shell, "-c", status, NULL,
NULL NULL
}; };

View file

@ -62,8 +62,8 @@
- speedwm.gappov: 10 - speedwm.gappov: 10
- speedwm.attachdirection: 3 - speedwm.attachdirection: 3
- speedwm.shell: /bin/sh - speedwm.shell: /bin/sh
- speedwm.sizeicon: 10 - speedwm.iconsize: 10
- speedwm.spacingicon: 5 - speedwm.iconspacing: 5
- speedwm.status: status - speedwm.status: status
- speedwm.defaultname: - speedwm.defaultname:
- speedwm.refreshrules: 1 - speedwm.refreshrules: 1

View file

@ -203,8 +203,8 @@ static int lockfullscreen = 1;
/* Window icon options */ /* Window icon options */
#if USEWINICON #if USEWINICON
static int sizeicon = 10; /* size of the icon */ static int iconsize = 10; /* size of the icon */
static int spacingicon = 5; /* spacing between the title and icon */ static int iconspacing = 5; /* spacing between the title and icon */
#endif #endif
/* Bar options */ /* Bar options */

View file

@ -1911,7 +1911,7 @@ drawbar(Monitor *m)
drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0); drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0);
} else { } else {
#if USEWINICON #if USEWINICON
drw_text(drw, x, 0, tabw, bh, lrpad / 2 + (c->icon ? c->icw + ICONSPACING : 0), c->name, 0); drw_text(drw, x, 0, tabw, bh, lrpad / 2 + (c->icon ? c->icw + iconspacing : 0), c->name, 0);
if (c->icon) drw_pic(drw, x + lrpad / 2, (bh - c->ich) / 2, c->icw, c->ich, c->icon); if (c->icon) drw_pic(drw, x + lrpad / 2, (bh - c->ich) / 2, c->icw, c->ich, c->icon);
#else #else
drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0); drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0);
@ -2178,13 +2178,13 @@ geticonprop(Window win, unsigned int *picw, unsigned int *pich)
for (i = p; i < end - 1; i += sz) { for (i = p; i < end - 1; i += sz) {
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; } if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
if ((sz = w * h) > end - i) break; if ((sz = w * h) > end - i) break;
if ((m = w > h ? w : h) >= ICONSIZE && (d = m - ICONSIZE) < bstd) { bstd = d; bstp = i; } if ((m = w > h ? w : h) >= iconsize && (d = m - iconsize) < bstd) { bstd = d; bstp = i; }
} }
if (!bstp) { if (!bstp) {
for (i = p; i < end - 1; i += sz) { for (i = p; i < end - 1; i += sz) {
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; } if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
if ((sz = w * h) > end - i) break; if ((sz = w * h) > end - i) break;
if ((d = ICONSIZE - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; } if ((d = iconsize - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; }
} }
} }
if (!bstp) { XFree(p); return None; } if (!bstp) { XFree(p); return None; }
@ -2194,11 +2194,11 @@ geticonprop(Window win, unsigned int *picw, unsigned int *pich)
uint32_t icw, ich; uint32_t icw, ich;
if (w <= h) { if (w <= h) {
ich = ICONSIZE; icw = w * ICONSIZE / h; ich = iconsize; icw = w * iconsize / h;
if (icw == 0) icw = 1; if (icw == 0) icw = 1;
} }
else { else {
icw = ICONSIZE; ich = h * ICONSIZE / w; icw = iconsize; ich = h * iconsize / w;
if (ich == 0) ich = 1; if (ich == 0) ich = 1;
} }
*picw = icw; *pich = ich; *picw = icw; *pich = ich;

View file

@ -131,7 +131,8 @@ ResourcePref resources[] = {
{ "resizehints", INTEGER, &resizehints }, { "resizehints", INTEGER, &resizehints },
{ "startontag", INTEGER, &startontag }, { "startontag", INTEGER, &startontag },
#if USEWINICON #if USEWINICON
{ "sizeicon", INTEGER, &sizeicon }, { "iconsize", INTEGER, &iconsize },
{ "iconspacing", INTEGER, &iconspacing },
#endif #endif
{ "decorhints", INTEGER, &decorhints }, { "decorhints", INTEGER, &decorhints },
{ "swallowclients", INTEGER, &swallowclients }, { "swallowclients", INTEGER, &swallowclients },