bakkeby/patches

splitmonstatus?

apprehensions opened this issue · 5 comments

to put it simply. having a specific status for each monitor. much like splitstatus splits for center, it splits for monitors

my only usecase for this is to ONLY tell the time. (i could just launch a terminal or set a hotkey for this but why even bother?) i use a custom dwm build with holdbar to save some screen estate. but i would like to know the time as i have a second monitor.

i can use staticstatus but my current status-bar configuration is quite large and doesn't fit on my secondary display.

offtopic question:
just as a question, is it even appropriate for ask for patch requests here?
and, why aren't some of your patches on the dwm.suckless.org patches?

to put it simply. having a specific status for each monitor. much like splitstatus splits for center, it splits for monitors

At this level of personalised customisation you would kind of be expected to figure things out on your own because it is quite far into the tinkering realm. At some point

The splitstatus patch does in principle what you suggest, just that it shows all the statuses on the same monitor. All you need is to change if statements around to control which monitor what is drawn on. E.g. if (m->num == 1) { to only do something when on the second monitor.

just as a question, is it even appropriate for ask for patch requests here?

Appropriate I don't know, maybe it is :)

and, why aren't some of your patches on the dwm.suckless.org patches?

I did answer this in some other issue, but I can't find that at the moment. The gist of it is that:

  • when I first started out you could add your patches to the suckless site, but only if you had like no possibility of hosting them elsewhere - this later changed and it is more open now
  • the patches on the suckless site are sort of maintained by the community. If someone has a problem with any of the patches then they go complain about it on reddit or something rather than emailing the author (if an email is even available).
  • if there is a bug with a patch then it may take a few days before changes are reviewed and pushed to the site, which means that the round trip is quite long
  • as I am personally maintaining these patches people are more inclined to raise an issue here on github and I can push an update through much quicker
  • and I suppose most importantly I consider most of my patches to be bloat and lack the simplicity or minimalism that one might expect for patches on the suckless site

I suppose that I will contribute my patches to the public domain (suckless.org) when the time comes that I am no longer planning on maintaining them (and I go back to Windows or something).

At this level of personalised customisation you would kind of be expected to figure things out on your own because it is quite far into the tinkering realm. At some point

MY FACE WHEN I HAVE THOUSAND PATCHES ON DWM BUT I DONT KNOW HOW TO CODE IN C.

The splitstatus patch does in principle what you suggest, just that it shows all the statuses on the same monitor. All you need is to change if statements around to control which monitor what is drawn on. E.g. if (m->num == 1) { to only do something when on the second monitor.

true, but how would it even be controlled?

diff --git a/config.h b/config.h
index 4ec03fc..9352d4a 100644
--- a/config.h
+++ b/config.h
@@ -13,6 +13,8 @@ static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display
 static int showsystray        = 0;        /* 0 means no systray */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 0;        /* 0 means bottom bar */
+static const int splitstatus        = 1;        /* 1 for split status items */
+static const char *splitdelim        = ";";       /* Character used for separating status */
 static const int horizpadbar        = 4;        /* horizontal padding for statusbar */
 static const int vertpadbar         = 8;        /* vertical padding for statusbar */
 static const char *fonts[]          = { "monospace:size=10:Medium" };
diff --git a/dwm.c b/dwm.c
index 3e73cdc..3100d2e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -948,6 +948,8 @@ drawbar(Monitor *m)
 	int x, w, tw = 0, stw = 0;
 	int boxs = drw->fonts->h / 9;
 	int boxw = drw->fonts->h / 6 + 2;
+	char *mstext;
+	char *rstext;
 	unsigned int i, occ = 0, urg = 0;
 	Client *c;
 
@@ -958,8 +960,13 @@ drawbar(Monitor *m)
 		stw = getsystraywidth();
 
 	/* draw status first so it can be overdrawn by tags later */
-	if (m == selmon) { /* status is only drawn on selected monitor */
-		tw = statusw = m->ww - drawstatusbar(m, bh, stext) - stw ;
+	rstext = strdup(stext);
+	mstext = strsep(&rstext, splitdelim);
+	if (m->num == 0) { /* status is only drawn on selected monitor */
+		tw = statusw = m->ww - drawstatusbar(m, bh, mstext) - stw ;
+	}
+	if (m->num == 1) { /* status is only drawn on selected monitor */
+		tw = statusw = m->ww - drawstatusbar(m, bh, rstext) - stw ;
 	}
 
 	resizebarwin(m);

is this good?
i love this working for 2 minutes but segmentation faulted now

I don't see anything obviously wrong with it. Segmentation faults are always fun. I'd recommend trying things out in Xephyr first, it generally saves a lot of time.

keeping it closed as i did find a solution anyway.