[Lcdproc] lcdproc client titles

Eric Pooch epooch@cox.net
Sun Mar 4 00:50:02 2007


--Apple-Mail-11--758894689
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

First,

Here is a patch for mem.c to improve the appearance and alignment of  
the title, especially on large screens.


--Apple-Mail-11--758894689
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name=mem_title.patch
Content-Disposition: attachment;
	filename=mem_title.patch

--- mem.c-	2007-03-03 16:04:43.000000000 -0800
+++ mem.c	2007-03-03 16:11:38.000000000 -0800
@@ -22,7 +22,7 @@
 // Mem Screen displays info about memory and swap usage...
 //
 // +--------------------+	+--------------------+
-// |##  MEM -==- SWAP #@|	|M 758.3M [- ] 35.3%@|
+// |##  MEM #### SWAP #@|	|M 758.3M [- ] 35.3%@|
 // | 758.3M Totl 1.884G |	|S 1.884G [  ]  0.1% |
 // | 490.8M Free 1.882G |	+--------------------+
 // |E---    F  E       F|
@@ -48,7 +48,9 @@
 				    : (lcd_wid - 4) / 2;	// leave room for the  E...F pairs
 
 			sock_send_string(sock, "widget_add M title title\n");
-			sock_send_string(sock, "widget_set M title { MEM -==- SWAP}\n");
+			sock_send_string(sock, "widget_set M title { MEM}\n");
+			sock_send_string(sock, "widget_add M subtitle string\n");
+			sock_printf(sock, "widget_set M subtitle %i 1 { SWAP }\n", lcd_wid - 6);
 			sock_send_string(sock, "widget_add M totl string\n");
 			sock_send_string(sock, "widget_add M used string\n");
 			sock_printf(sock, "widget_set M totl %i 2 Totl\n", lcd_wid/2 - 1);
@@ -94,9 +96,12 @@
 
 		// flip the title back and forth... (every 4 updates)
 		if (which_title & 4) {
+			sock_printf(sock, "widget_set M subtitle %i 1 {}\n", lcd_wid - 7);
 			sock_printf(sock, "widget_set M title {%s}\n", get_hostname());
-		} else
-			sock_send_string(sock, "widget_set M title { MEM -==- SWAP}\n");
+		} else {
+			sock_send_string(sock, "widget_set M title { MEM}\n");
+			sock_printf(sock, "widget_set M subtitle %i 1 { SWAP }\n", lcd_wid - 7);
+		}
 		which_title = (which_title + 1) & 7;
 
 		// Total memory

--Apple-Mail-11--758894689
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


Next,

I have started working on some changes to the titles on the lcdproc  
client screens to make them more consistent and improve the appearance.
Having the host name in all the titles doesn't look very good and can  
take a lot of time to scroll leaving the title not visible for a  
while.  It is also very distracting when other things are moving on  
the screen.  I don't think the host name is needed on the titles,  
unless you are connecting to a remote host.  To deal with this, I  
wrote up some code to check if the server is localhost or 127.0.0.1,  
and then set up a "title extension" variable that is empty if we are  
connecting locally, and looks like ": hostname" if we are connecting  
to a remote server.  Then each screen would just include this  
variable in the title.  It would automatically show what is needed  
depending on the connection.

Anyway, I wanted some suggestions on whether this is a good idea or  
not, and if it should be automatic, a part of the config file with  
its own setting, or somehow connected with the DisplayName setting.

Thanks for any help
--eric




--Apple-Mail-11--758894689--