You are not logged in.
Pages: 1
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
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
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.
Desktop screenshots :: Origami :: github
Offline
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. ![]()
Offline
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
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
Pages: 1