You are not logged in.

#1 2014-03-07 03:27:20

feboss
Member
Registered: 2013-04-11
Posts: 11

conky maximum height

I need to set a maximum height in conky. i'm just wonder why i can set the maximum width but not the maximum height? I just trying to put a little box next to my tint2 panel but it is so hard when i can't set the height of the box.


I’m working on improving my English so please excuse any mistakes

Offline

#2 2014-03-07 13:27:00

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: conky maximum height

I'm curious, what is changing size vertically that causes you to need to set a maximum height?

The font size is fixed, number of lines of text is fixed, new lines, graph heights... all fixed (I think).

Offline

#3 2014-03-07 14:42:29

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: conky maximum height

Yes. Maximum height is dictated by the number of lines. You need to use \ to control number of lines, and be extra cautious while using $if .... $endif constructs, as they tend to bring in newlines which are easy to overlook.
If you're trying to put it next to tint2, as a sysinfo bar, go for a one liner conky.

Offline

#4 2014-03-07 14:54:47

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: conky maximum height

And as long as we're talking about newlines... You DO need an empty newline at the end of the conkyrc file or else strange sizing things happen. hmm

Offline

#5 2014-03-07 16:15:39

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: conky maximum height

A couple things:

As far as I know there is no maximum height conky parameter. There is however 'minimum_size width (height) - Minimum size of window' that helps to prevent the window from auto resizing and otherwise jumping around to accommodate additional info when the output changes and it cannot fit in the existing window.

As easysid alluded to, look here for how I compressed my config file by putting as many things as possible on the same line and used \ to control number of lines. It reduced the vertical size of my conky window considerably.

Last edited by KairiTech (2014-03-08 03:08:25)

Offline

#6 2014-03-07 16:25:41

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: conky maximum height

Cases like this one is why open source is so awesome. This patch is for 1.8.1, but I'm sure patching a later version is just as simple:

diff -Nur conky-1.8.1.orig/src/conky.c conky-1.8.1/src/conky.c
--- conky-1.8.1.orig/src/conky.c	2010-10-05 23:29:36.000000000 +0200
+++ conky-1.8.1/src/conky.c	2011-12-13 17:02:53.823025938 +0100
@@ -397,7 +397,7 @@
 #endif
 
 static int minimum_width, minimum_height;
-static int maximum_width;
+static int maximum_width, maximum_height;
 
 #endif /* X11 */
 
@@ -2556,6 +2556,9 @@
 		if (text_height < minimum_height) {
 			text_height = minimum_height;
 		}
+		if (text_height > maximum_height && maximum_height > 0) {
+			text_height = maximum_height;
+		}
 		if (text_width > maximum_width && maximum_width > 0) {
 			text_width = maximum_width;
 		}
@@ -2708,6 +2711,9 @@
 	if (w > text_width) {
 		text_width = w;
 	}
+	if (text_height > maximum_height && maximum_height) {
+		text_height = maximum_height;
+	}
 	if (text_width > maximum_width && maximum_width) {
 		text_width = maximum_width;
 	}
@@ -3737,6 +3743,10 @@
 
 								text_width = window.width - window.border_inner_margin * 2 - window.border_outer_margin * 2 - window.border_width * 2;
 								text_height = window.height - window.border_inner_margin * 2 - window.border_outer_margin * 2 - window.border_width * 2;
+								if (text_height > maximum_height
+										&& maximum_height > 0) {
+									text_height = maximum_height;
+								}
 								if (text_width > maximum_width
 										&& maximum_width > 0) {
 									text_width = maximum_width;
@@ -4303,6 +4313,7 @@
 	minimum_width = 5;
 	minimum_height = 5;
 	maximum_width = 0;
+	maximum_height = 0;
 #ifdef OWN_WINDOW
 	own_window = 0;
 	window.type = TYPE_NORMAL;
@@ -4991,6 +5002,15 @@
 					CONF_ERR;
 				}
 			} else {
+				CONF_ERR;
+			}
+		}
+		CONF("maximum_height") {
+			if (value) {
+				if (sscanf(value, "%d", &maximum_height) != 1) {
+					CONF_ERR;
+				}
+			} else {
 				CONF_ERR;
 			}
 		}

Offline

Board footer

Powered by FluxBB