Re: [dev] [dwm] hardcoded dmenucmd && dmenumon

2022-02-16 Thread NRK
On Wed, Feb 16, 2022 at 05:39:14PM +0100, Hiltjo Posthuma wrote:
> whats the solution/patch?

If there is a "standard" (or at least conventional) way of communicating
the active monitor between wm and other X clients then it's probably
best to follow that.

Assuming there isn't, one alternative could be just using env vars. dwm
would set an env var, say $DWM_CURRENT_MONITOR inside spawn() and
`dmenu_run` can be adjusted to utilize that `-m "$DWM_CURRENT_MONITOR"`
or fallback to some default if the env var doesn't exist.

This would remove the need to special case dmenucmd and would allow
other scripts/programs spawned via dwm to utilize this env var as well.

On Wed, Feb 16, 2022 at 05:39:14PM +0100, Hiltjo Posthuma wrote:
> Whats the issue

Wouldn't consider it an "issue", but rather a place for potential
improvement.

- NRK



[dev] [dwm] Wrong monitor positions after removing leftmost monitor

2022-02-16 Thread Santtu Lakkala

Hi,

there is an annoyance with dwm where it does not re-adjust monitor 
positions upon screen removal, and if the leftmost screen is removed 
some or all windows may be placed outside the viewable area. (The bug 
can be worked around by first moving the screen to the right side and 
remove only after that, but I always forget to do that :)


The attached patch removes some ifs to adjust monitor coordinates also 
in the removal case.


--
Santtu LakkalaFrom 2d9e420aaf8eac81b53f45970197a9c443756408 Mon Sep 17 00:00:00 2001
From: Santtu Lakkala 
Date: Wed, 16 Feb 2022 15:20:31 +0200
Subject: [PATCH] Update monitor positions when monitors removed

---
 dwm.c | 68 +--
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/dwm.c b/dwm.c
index a96f33c..85419e3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1874,42 +1874,42 @@ updategeom(void)
 memcpy([j++], [i], sizeof(XineramaScreenInfo));
 		XFree(info);
 		nn = j;
-		if (n <= nn) { /* new monitors available */
-			for (i = 0; i < (nn - n); i++) {
-for (m = mons; m && m->next; m = m->next);
-if (m)
-	m->next = createmon();
-else
-	mons = createmon();
+
+		/* new monitors if nn > n */
+		for (i = n; i < nn; i++) {
+			for (m = mons; m && m->next; m = m->next);
+			if (m)
+m->next = createmon();
+			else
+mons = createmon();
+		}
+		for (i = 0, m = mons; i < nn && m; m = m->next, i++)
+			if (i >= n
+			|| unique[i].x_org != m->mx || unique[i].y_org != m->my
+			|| unique[i].width != m->mw || unique[i].height != m->mh)
+			{
+dirty = 1;
+m->num = i;
+m->mx = m->wx = unique[i].x_org;
+m->my = m->wy = unique[i].y_org;
+m->mw = m->ww = unique[i].width;
+m->mh = m->wh = unique[i].height;
+updatebarpos(m);
 			}
-			for (i = 0, m = mons; i < nn && m; m = m->next, i++)
-if (i >= n
-|| unique[i].x_org != m->mx || unique[i].y_org != m->my
-|| unique[i].width != m->mw || unique[i].height != m->mh)
-{
-	dirty = 1;
-	m->num = i;
-	m->mx = m->wx = unique[i].x_org;
-	m->my = m->wy = unique[i].y_org;
-	m->mw = m->ww = unique[i].width;
-	m->mh = m->wh = unique[i].height;
-	updatebarpos(m);
-}
-		} else { /* less monitors available nn < n */
-			for (i = nn; i < n; i++) {
-for (m = mons; m && m->next; m = m->next);
-while ((c = m->clients)) {
-	dirty = 1;
-	m->clients = c->next;
-	detachstack(c);
-	c->mon = mons;
-	attach(c);
-	attachstack(c);
-}
-if (m == selmon)
-	selmon = mons;
-cleanupmon(m);
+		/* removed monitors if n > nn */
+		for (i = nn; i < n; i++) {
+			for (m = mons; m && m->next; m = m->next);
+			while ((c = m->clients)) {
+dirty = 1;
+m->clients = c->next;
+detachstack(c);
+c->mon = mons;
+attach(c);
+attachstack(c);
 			}
+			if (m == selmon)
+selmon = mons;
+			cleanupmon(m);
 		}
 		free(unique);
 	} else
-- 
2.32.0



Re: [dev] [dwm] hardcoded dmenucmd && dmenumon

2022-02-16 Thread Hiltjo Posthuma
On Wed, Feb 16, 2022 at 05:52:48PM +0600, NRK wrote:
> Hi,
> 
> Currently dmenumon and dmenucmd are hardcoded into spawn(), I noticed
> this after I removed `dmenumon` (as I don't use multimonitor) from
> config.h and saw that the compilation failed.
> 
>   if (arg->v == dmenucmd)
>   dmenumon[0] = '0' + selmon->num;
> 
> While this way of doing things "works", I do wonder if hardcoding things
> like this is the best way to go about solving the issue.
> 
> - NRK
> 

Hi,

Whats the issue and whats the solution/patch?

-- 
Kind regards,
Hiltjo



Re: [dev] Is there a text editor following the UNIX philosophy?

2022-02-16 Thread Greg Minshall
Ismael,

> A simple way to deal with the problem is to make an extra commit
> (outside the main branch) per release to hold these files and tag it
> as the release, that makes it trivial for websites like github to make
> proper release tarballs.

ah.  thanks!

cheers, Greg



Re: [dev] sfeed: RSS/Atom parser and reader

2022-02-16 Thread Laslo Hunhold
On Fri, 11 Feb 2022 14:54:24 +0100
Hiltjo Posthuma  wrote:

Dear Hiltjo,

> I would like to share my project I've been using and tweaking over
> the years:
> 
> sfeed is a RSS and Atom parser (and it has some format programs).

nice to see it having become so advanced over the years. I remember
when you started with it. Keep up the great work! :)

With best regards

Laslo