diff --git a/ChangeLog b/ChangeLog
index 34290b8b..1aa47545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
# $Id$
+2005-08-23
+ * Added maximum_width
+
2005-08-22
* Added $execibar and $execigraph
diff --git a/Conky.kdevelop b/Conky.kdevelop
index 48c9787b..983a7046 100644
--- a/Conky.kdevelop
+++ b/Conky.kdevelop
@@ -21,7 +21,7 @@
conkybuild/
-
+ falsetrue
@@ -55,14 +55,14 @@
kdevpgf77options-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -ggdb
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/README b/README
index 00ec525a..f04b6899 100644
--- a/README
+++ b/README
@@ -197,7 +197,11 @@ CONFIGURATION SETTINGS
Mail spool for mail checking
- minimum_size
+ maximum_width pixels
+ Maximum width of window
+
+
+ minimum_size width (height)
Minimum size of window
diff --git a/doc/config_settings.xml b/doc/config_settings.xml
index 275ded7e..448d84b0 100644
--- a/doc/config_settings.xml
+++ b/doc/config_settings.xml
@@ -126,7 +126,18 @@
-
+
+
+
+
+ Maximum width of window
+
+
+
+
+
+
+
Minimum size of window
diff --git a/src/config.h.in b/src/config.h.in
deleted file mode 100644
index 1b64a4c2..00000000
--- a/src/config.h.in
+++ /dev/null
@@ -1,136 +0,0 @@
-/* src/config.h.in. Generated from configure.in by autoheader. */
-
-/* Define if you are using Cairo */
-#undef CAIRO
-
-/* Define if you want support for the DBE extension */
-#undef DOUBLE_BUFFER
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_CAIRO_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_CAIRO_XLIB_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_DLFCN_H
-
-/* Define if you have getloadavg */
-#undef HAVE_GETLOADAVG
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if you have kstat (Solaris) */
-#undef HAVE_KSTAT
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_LINUX_SOUNDCARD_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MCHECK_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `popen' function. */
-#undef HAVE_POPEN
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SIGNAL_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have sysinfo (Linux) */
-#undef HAVE_SYSINFO
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_MOUNT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_STATFS_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_UTSNAME_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have X11 */
-#undef HAVE_X11
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_X11_XLIB_H
-
-/* Xdbe */
-#undef HAVE_XDBE
-
-/* Define if you want MLDonkey support */
-#undef MLDONKEY
-
-/* Define if you want MPD support */
-#undef MPD
-
-/* Define if you want support for window creating */
-#undef OWN_WINDOW
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define if you want to use /proc/uptime for uptime */
-#undef PROC_UPTIME
-
-/* Define if you want SETI at Home stats */
-#undef SETI
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define if you want to use X11 */
-#undef X11
-
-/* Define if you are using Xft */
-#undef XFT
-
-/* Define to 1 if the X Window System is missing or not being used. */
-#undef X_DISPLAY_MISSING
diff --git a/src/conky.c b/src/conky.c
index 7ee1366a..ef83bdbd 100644
--- a/src/conky.c
+++ b/src/conky.c
@@ -239,6 +239,7 @@ static int fixed_size = 0, fixed_pos = 0;
#endif
static int minimum_width, minimum_height;
+static int maximum_width;
/* UTF-8 */
int utf8_mode = 0;
@@ -2658,6 +2659,8 @@ static void text_size_updater(char *s)
w += get_string_width(s);
if (w > text_width)
text_width = w;
+ if (text_width > maximum_width && maximum_width)
+ text_width = maximum_width;
text_height += h;
if (fontchange) {
@@ -2684,6 +2687,8 @@ static void update_text_area()
text_width += 1;
if (text_height < minimum_height)
text_height = minimum_height;
+ if (text_width > maximum_width && maximum_width > 0)
+ text_width = maximum_width;
}
/* get text position on workarea */
@@ -2804,6 +2809,12 @@ static void draw_string(const char *s)
}
}
}
+ if (text_width == maximum_width) {
+ /* this means the text is probably pushing the limit, so we'll chop it */
+ while (cur_x + get_string_width(tmpstring2) - text_start_x > maximum_width && strlen(tmpstring2) > 0) {
+ tmpstring2[strlen(tmpstring2)-1] = '\0';
+ }
+ }
s = tmpstring2;
#ifdef X11
#ifdef XFT
@@ -3021,6 +3032,9 @@ static void draw_line(char *s)
case BAR:
{
+ if (cur_x > maximum_width - text_start_x) {
+ break;
+ }
int h =
specials[special_index].height;
int bar_usage =
@@ -3064,6 +3078,9 @@ static void draw_line(char *s)
case GRAPH:
{
+ if (cur_x > maximum_width - text_start_x && maximum_width > 0) {
+ break;
+ }
int h =
specials[special_index].height;
int by;
@@ -3508,6 +3525,8 @@ static void main_loop()
text_height =
window.height -
border_margin * 2 - 1;
+ if (text_width > maximum_width && maximum_width > 0)
+ text_width = maximum_width;
}
/* if position isn't what expected, set fixed pos, total_updates
@@ -3701,6 +3720,7 @@ static void set_default_configurations(void)
gap_y = 5;
minimum_width = 5;
minimum_height = 5;
+ maximum_width = 0;
#ifdef OWN_WINDOW
own_window = 0;
#endif
@@ -3995,14 +4015,21 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
}
#ifdef X11
CONF("minimum_size") {
+ if (value) {
+ if (sscanf
+ (value, "%d %d", &minimum_width,
+ &minimum_height) != 2)
+ if (sscanf
+ (value, "%d",
+ &minimum_width) != 1)
+ CONF_ERR;
+ } else
+ CONF_ERR;
+ }
+ CONF("maximum_width") {
if (value) {
- if (sscanf
- (value, "%d %d", &minimum_width,
- &minimum_height) != 2)
- if (sscanf
- (value, "%d",
- &minimum_width) != 1)
- CONF_ERR;
+ if (sscanf(value, "%d", &maximum_width) != 1)
+ CONF_ERR;
} else
CONF_ERR;
}