From 2d78daa75e90357cf9389daccbd06d75d4e96e42 Mon Sep 17 00:00:00 2001
From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz>
Date: Tue, 2 Feb 2021 10:56:38 +0100
Subject: [PATCH] Add module support by osdd_abstract -- names and module
 creators BUGFIX

---
 display.c  | 7 +++++--
 osdd-run   | 2 +-
 osdd-set.c | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/display.c b/display.c
index 0912671..6bd4f32 100644
--- a/display.c
+++ b/display.c
@@ -212,7 +212,7 @@ void display_state_new_by_outputs_help(FILE * f)
 static
 void display_state_new_by_outputs(struct osd_set *set, int argc, char ** argv,Display *dpy,int names_len, char ** names)
 {
-static const char short_opts[] = "f:s:";
+static const char short_opts[] = "f:s:n:";
 static const struct option long_opts[] = {
   { "font",		required_argument,	NULL,	'f' },
   { "line-spacing",	required_argument,	NULL,	's' },
@@ -221,7 +221,7 @@ static const struct option long_opts[] = {
 };
 	fprintf(stderr,"NEW DISPLAY:\n");
 	for(int i=0;i<argc;i++) fprintf(stderr,"\t%s\n",argv[i]);
-	char  * expanding_name = "display%d";
+	char  * expanding_name = "";
 	char *font_name = "times-64:bold";
 	double line_spacing = 0.2;
 	int opt;
@@ -237,6 +237,9 @@ static const struct option long_opts[] = {
 			case 's':
 				line_spacing = atof(optarg);
 				break;
+			case 'n':
+				expanding_name = optarg;
+				break;
 			default:
 				display_state_new_by_outputs_help(stderr);
 				exit(0);
diff --git a/osdd-run b/osdd-run
index 65bb82a..cd84ca5 100755
--- a/osdd-run
+++ b/osdd-run
@@ -6,5 +6,5 @@ pkill -f not2osd
 not2osd &
 tmp=$(mktemp)
 echo "Xft.render: False" > $tmp
-XENVIRONMENT=$tmp ./osdd -D | bash
+XENVIRONMENT=$tmp ./osdd -D DISPLAY_BY_OUTPUTS default d [ -n d%d ] | bash
 
diff --git a/osdd-set.c b/osdd-set.c
index cdf45c9..2645a06 100644
--- a/osdd-set.c
+++ b/osdd-set.c
@@ -137,7 +137,7 @@ void osd_set_add(struct osd_set *set, struct osd_abstract abs, int names_len, ch
 {
 	for(int i=0;i<names_len;i++)
 	{
-		printf("NAME |%s|\n",names[i]);
+		fprintf(stderr,"NAME |%s|\n",names[i]);
 		struct osd_set_trie *trie = osd_set_trie_find(&set->trie,names[i],1);
 		trie->vals = xrealloc(trie->vals,sizeof(trie->vals[0])*(trie->num_vals+1));
 		trie->vals[trie->num_vals++] = set->len;
-- 
GitLab