Changed $font behavior so that the font persists past the next newline. It can be...
authorBrenden Matthews <brenden1@rty.ca>
Tue, 9 May 2006 23:08:23 +0000 (23:08 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Tue, 9 May 2006 23:08:23 +0000 (23:08 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@628 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
README
doc/conky.1
doc/docs.xml
doc/variables.xml
src/conky.c

index 769def8..fa80395 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 # $Id$
 
+2006-05-09
+       * Changed $font behavior so that the font persists past the next
+       newline.  It can be set back to the default with $font with no args.
+       (closes bug 1478676 on sf.net)
+
 2006-05-08
        * Added simple POP3/IMAP mail clients
 
diff --git a/README b/README
index 6e56c20..a6f00d8 100644 (file)
--- a/README
+++ b/README
@@ -544,8 +544,11 @@ VARIABLES
              Same as execigraph, but takes an interval arg graphs values
 
 
-       font font
-             Specify a different font. Only applies to one line.
+       font (font)
+             Specify  a  different font. This new font will apply to the cur-
+             rent line and everything following. You can use a $font with  no
+             arguments  to  change  back  to the default font (much like with
+             $color)
 
 
        freq   Returns CPU frequency in MHz
@@ -555,19 +558,19 @@ VARIABLES
 
 
        freq_dyn
-             Returns  CPU  frequency in MHz, but is calculated by counting to
-             clock cycles to complete  an  instruction.  Only  available  for
+             Returns CPU frequency in MHz, but is calculated by  counting  to
+             clock  cycles  to  complete  an  instruction. Only available for
              x86/amd64.
 
 
        freq_dyn_g
-             Returns  CPU  frequency in GHz, but is calculated by counting to
-             clock cycles to complete  an  instruction.  Only  available  for
+             Returns CPU frequency in GHz, but is calculated by  counting  to
+             clock  cycles  to  complete  an  instruction. Only available for
              x86/amd64.
 
 
        fs_bar (height),(width) fs
-             Bar  that  shows how much space is used on a file system. height
+             Bar that shows how much space is used on a file  system.  height
              is the height in pixels. fs is any file on that file system.
 
 
@@ -588,8 +591,8 @@ VARIABLES
 
 
        head logfile lines (interval)
-             Displays first N lines of supplied text text file.  If  interval
-             is  not  supplied,  Conky assumes 2x Conky's interval. Max of 30
+             Displays  first  N lines of supplied text text file. If interval
+             is not supplied, Conky assumes 2x Conky's interval.  Max  of  30
              lines can be displayed, or until the text buffer is filled.
 
 
@@ -598,100 +601,100 @@ VARIABLES
 
 
        i2c (dev) type n
-             I2C sensor from sysfs (Linux 2.6). dev may  be  omitted  if  you
-             have  only  one  I2C  device. type is either in (or vol) meaning
+             I2C  sensor  from  sysfs  (Linux 2.6). dev may be omitted if you
+             have only one I2C device. type is either  in  (or  vol)  meaning
              voltage, fan meaning fan or temp/tempf (first in C, second in F)
-             meaning   temperature.   n   is   number   of  the  sensor.  See
+             meaning  temperature.  n  is   number   of   the   sensor.   See
              /sys/bus/i2c/devices/ on your local computer.
 
 
        i8k_ac_status
-             If running the i8k kernel driver for Inspiron laptops,  displays
-             whether  ac  power  is on, as listed in /proc/i8k (translated to
-             human-readable). Beware that this is by default not  enabled  by
+             If  running the i8k kernel driver for Inspiron laptops, displays
+             whether ac power is on, as listed in  /proc/i8k  (translated  to
+             human-readable).  Beware  that this is by default not enabled by
              i8k itself.
 
 
        i8k_bios
-             If  running the i8k kernel driver for Inspiron laptops, displays
+             If running the i8k kernel driver for Inspiron laptops,  displays
              the bios version as listed in /proc/i8k.
 
 
        i8k_buttons_status
-             If running the i8k kernel driver for Inspiron laptops,  displays
+             If  running the i8k kernel driver for Inspiron laptops, displays
              the volume buttons status as listed in /proc/i8k.
 
 
        i8k_cpu_temp
-             If  running the i8k kernel driver for Inspiron laptops, displays
+             If running the i8k kernel driver for Inspiron laptops,  displays
              the cpu temperature in Celsius, as reported by /proc/i8k.
 
 
        i8k_cpu_tempf
-             If running the i8k kernel driver for Inspiron laptops,  displays
+             If  running the i8k kernel driver for Inspiron laptops, displays
              the cpu temperature in Farenheit, as reported by /proc/i8k.
 
 
        i8k_left_fan_rpm
-             If  running the i8k kernel driver for Inspiron laptops, displays
-             the left fan's rate of rotation, in revolutions  per  minute  as
+             If running the i8k kernel driver for Inspiron laptops,  displays
+             the  left  fan's  rate of rotation, in revolutions per minute as
              listed in /proc/i8k. Beware, some laptops i8k reports these fans
              in reverse order.
 
 
        i8k_left_fan_status
-             If running the i8k kernel driver for Inspiron laptops,  displays
+             If  running the i8k kernel driver for Inspiron laptops, displays
              the left fan status as listed in /proc/i8k (translated to human-
-             readable). Beware,  some  laptops  i8k  reports  these  fans  in
+             readable).  Beware,  some  laptops  i8k  reports  these  fans in
              reverse order.
 
 
        i8k_right_fan_rpm
-             If  running the i8k kernel driver for Inspiron laptops, displays
-             the right fan's rate of rotation, in revolutions per  minute  as
+             If running the i8k kernel driver for Inspiron laptops,  displays
+             the  right  fan's rate of rotation, in revolutions per minute as
              listed in /proc/i8k. Beware, some laptops i8k reports these fans
              in reverse order.
 
 
        i8k_right_fan_status
-             If running the i8k kernel driver for Inspiron laptops,  displays
-             the  right  fan  status  as  listed  in /proc/i8k (translated to
-             human-readable). Beware, some laptops i8k reports these fans  in
+             If  running the i8k kernel driver for Inspiron laptops, displays
+             the right fan status  as  listed  in  /proc/i8k  (translated  to
+             human-readable).  Beware, some laptops i8k reports these fans in
              reverse order.
 
 
        i8k_serial
-             If  running the i8k kernel driver for Inspiron laptops, displays
+             If running the i8k kernel driver for Inspiron laptops,  displays
              your laptop serial number as listed in /proc/i8k.
 
 
        i8k_version
-             If running the i8k kernel driver for Inspiron laptops,  displays
+             If  running the i8k kernel driver for Inspiron laptops, displays
              the version formatting of /proc/i8k.
 
 
        if_running (process)
-             if  PROCESS  is  running,  display everything if_running and the
+             if PROCESS is running, display  everything  if_running  and  the
              matching $endif
 
 
        if_existing (file)
-             if FILE exists, display everything between if_existing  and  the
+             if  FILE  exists, display everything between if_existing and the
              matching $endif
 
 
        if_mounted (mountpoint)
-             if  MOUNTPOINT is mounted, display everything between if_mounted
+             if MOUNTPOINT is mounted, display everything between  if_mounted
              and the matching $endif
 
 
        imap_messages (args)
-             Displays the number of messages in your  global  IMAP  inbox  by
-             default.  You  can  define individual IMAP inboxes seperately by
+             Displays  the  number  of  messages in your global IMAP inbox by
+             default. You can define individual IMAP  inboxes  seperately  by
              passing arguments to this object. Arguments are: "host user pass
-             [-i  interval]  [-p  port]  [-e  command]". Default port is 110,
-             default interval is 5 minutes. If the password  is  supplied  as
-             '*',  you  will  be  prompted  to  enter the password when Conky
+             [-i interval] [-p port] [-e  command]".  Default  port  is  110,
+             default  interval  is  5 minutes. If the password is supplied as
+             '*', you will be prompted  to  enter  the  password  when  Conky
              starts.
 
 
@@ -699,9 +702,9 @@ VARIABLES
              Displays the number of unseen messages in your global IMAP inbox
              by default. You can define individual IMAP inboxes seperately by
              passing arguments to this object. Arguments are: "host user pass
-             [-i  interval]  [-p  port]  [-e  command]". Default port is 110,
-             default interval is 5 minutes. If the password  is  supplied  as
-             '*',  you  will  be  prompted  to  enter the password when Conky
+             [-i interval] [-p port] [-e  command]".  Default  port  is  110,
+             default  interval  is  5 minutes. If the password is supplied as
+             '*', you will be prompted  to  enter  the  password  when  Conky
              starts.
 
 
@@ -721,8 +724,8 @@ VARIABLES
              Machine, i686 for example
 
 
-       mails  Mail  count in mail spool. You can use program like fetchmail to
-             get mails from some server using your  favourite  protocol.  See
+       mails  Mail count in mail spool. You can use program like fetchmail  to
+             get  mails  from  some server using your favourite protocol. See
              also new_mails.
 
 
@@ -819,19 +822,19 @@ VARIABLES
 
        pb_battery item
              If running on Apple powerbook/ibook, display information on bat-
-             tery  status.  The item parameter specifies, what information to
+             tery status. The item parameter specifies, what  information  to
              display. Exactly one item must be specified. Valid items are:
 
              status: Display if battery is fully charged, charging, discharg-
              ing or absent (running on AC)
 
-             percent:  Display  charge  of battery in percent, if charging or
-             discharging. Nothing will be  displayed,  if  battery  is  fully
+             percent: Display charge of battery in percent,  if  charging  or
+             discharging.  Nothing  will  be  displayed,  if battery is fully
              charged or absent.
 
              time: Display the time remaining until the battery will be fully
-             charged or discharged at current rate. Nothing is displayed,  if
-             battery  is  absent or if it's present but fully charged and not
+             charged  or discharged at current rate. Nothing is displayed, if
+             battery is absent or if it's present but fully charged  and  not
              discharging.
 
 
@@ -839,18 +842,18 @@ VARIABLES
              Displays the number of unseen messages in your global POP3 inbox
              by default. You can define individual POP3 inboxes seperately by
              passing arguments to this object. Arguments are: "host user pass
-             [-i  interval]  [-p  port]  [-e  command]". Default port is 110,
-             default interval is 5 minutes. If the password  is  supplied  as
-             '*',  you  will  be  prompted  to  enter the password when Conky
+             [-i interval] [-p port] [-e  command]".  Default  port  is  110,
+             default  interval  is  5 minutes. If the password is supplied as
+             '*', you will be prompted  to  enter  the  password  when  Conky
              starts.
 
 
        pop3_used (args)
-             Displays the amount of space (in MiB, 2^20) used in your  global
-             POP3  inbox  by  default. You can define individual POP3 inboxes
-             seperately by passing arguments to this object.  Arguments  are:
-             "host  user  pass [-i interval] [-p port] [-e command]". Default
-             port is 110, default interval is 5 minutes. If the  password  is
+             Displays  the amount of space (in MiB, 2^20) used in your global
+             POP3 inbox by default. You can define  individual  POP3  inboxes
+             seperately  by  passing arguments to this object. Arguments are:
+             "host user pass [-i interval] [-p port] [-e  command]".  Default
+             port  is  110, default interval is 5 minutes. If the password is
              supplied as '*', you will be prompted to enter the password when
              Conky starts.
 
@@ -918,20 +921,20 @@ VARIABLES
              lservice - local service name from /etc/services
 
              The connection index provides you with access to each connection
-             in  the  port  monitor.  The monitor will return information for
-             index values from 0 to n-1 connections. Values higher  than  n-1
-             are  simply  ignored. For the "count" item, the connection index
+             in the port monitor. The monitor  will  return  information  for
+             index  values  from 0 to n-1 connections. Values higher than n-1
+             are simply ignored. For the "count" item, the  connection  index
              must be omitted. It is required for all other items.
 
              Examples:
 
-             ${tcp_portmon 6881 6999 count} - displays the number of  connec-
+             ${tcp_portmon  6881 6999 count} - displays the number of connec-
              tions in the bittorrent port range
 
-             ${tcp_portmon  22 22 rip 0} - displays the remote host ip of the
+             ${tcp_portmon 22 22 rip 0} - displays the remote host ip of  the
              first sshd connection
 
-             ${tcp_portmon 22 22 rip 9} - displays the remote host ip of  the
+             ${tcp_portmon  22 22 rip 9} - displays the remote host ip of the
              tenth sshd connection
 
              ${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
@@ -940,22 +943,22 @@ VARIABLES
              ${tcp_portmon 1 1024 rport 4} - displays the remote host port of
              the fifth connection on a privileged port
 
-             ${tcp_portmon  1 65535 lservice 14} - displays the local service
+             ${tcp_portmon 1 65535 lservice 14} - displays the local  service
              name of the fifteenth connection in the range of all ports
 
              Note that port monitor variables which share the same port range
              actually refer to the same monitor, so many references to a sin-
              gle port range for different items and different indexes all use
-             the  same monitor internally. In other words, the program avoids
+             the same monitor internally. In other words, the program  avoids
              creating redundant monitors.
 
        texeci interval command
-             Runs a command at an interval inside a thread and  displays  the
-             output.  Same  as  $execi,  except  the  command is run inside a
-             thread. Use this if you have a slow script to keep Conky  updat-
-             ing.  You should make the interval slightly longer then the time
-             it takes your script to execute. For  example,  if  you  have  a
-             script  that  take  5  seconds  to  execute, you should make the
+             Runs  a  command at an interval inside a thread and displays the
+             output. Same as $execi, except  the  command  is  run  inside  a
+             thread.  Use this if you have a slow script to keep Conky updat-
+             ing. You should make the interval slightly longer then the  time
+             it  takes  your  script  to  execute. For example, if you have a
+             script that take 5 seconds  to  execute,  you  should  make  the
              interval at least 6 seconds. See also $execi.
 
 
@@ -970,21 +973,21 @@ VARIABLES
 
 
        time (format)
-             Local time, see man strftime to get more information about  for-
+             Local  time, see man strftime to get more information about for-
              mat
 
 
        totaldown net
-             Total  download, overflows at 4 GB on Linux with 32-bit arch and
-             there doesn't seem to be a way to know how  many  times  it  has
+             Total download, overflows at 4 GB on Linux with 32-bit arch  and
+             there  doesn't  seem  to  be a way to know how many times it has
              already done that before conky has started.
 
 
        top type, num
-             This  takes arguments in the form:top (name) (number) Basically,
-             processes are ranked from highest to  lowest  in  terms  of  cpu
-             usage,  which  is  what (num) represents. The types are: "name",
-             "pid", "cpu", and mem". There can  be  a  max  of  10  processes
+             This takes arguments in the form:top (name) (number)  Basically,
+             processes  are  ranked  from  highest  to lowest in terms of cpu
+             usage, which is what (num) represents. The  types  are:  "name",
+             "pid",  "cpu",  and  mem".  There  can  be a max of 10 processes
              listed.
 
 
@@ -1008,9 +1011,9 @@ VARIABLES
              Upload speed in kilobytes with one decimal
 
 
-       upspeedgraph  net (height),(width) (gradient colour 1) (gradient colour
+       upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
        2) (scale)
-             Upload  speed  graph,  colours  defined  in hex, minus the #. If
+             Upload speed graph, colours defined in  hex,  minus  the  #.  If
              scale is non-zero, it becomes the scale for the graph.
 
 
@@ -1034,7 +1037,7 @@ VARIABLES
 
 
        voffset (pixels)
-             Change vertical offset by N pixels. Negative values  will  cause
+             Change  vertical  offset by N pixels. Negative values will cause
              text to overlap. See also $offset.
 
 
@@ -1047,12 +1050,12 @@ VARIABLES
 
 
        xmms_channels
-             xmms  /  bmp / audacious / infopipe: number of audio channels of
+             xmms / bmp / audacious / infopipe: number of audio  channels  of
              current tune
 
 
        xmms_filename
-             xmms / bmp / audacious / infopipe: full  path  and  filename  of
+             xmms  /  bmp  /  audacious / infopipe: full path and filename of
              current tune
 
 
@@ -1062,17 +1065,17 @@ VARIABLES
 
 
        xmms_length
-             xmms / bmp / audacious / infopipe: total length of current  tune
+             xmms  / bmp / audacious / infopipe: total length of current tune
              as MM:SS
 
 
        xmms_length_seconds
-             xmms  / bmp / audacious / infopipe: total length of current tune
+             xmms / bmp / audacious / infopipe: total length of current  tune
              in seconds
 
 
        xmms_playlist_position
-             xmms / bmp / audacious / infopipe: playlist position of  current
+             xmms  / bmp / audacious / infopipe: playlist position of current
              tune
 
 
@@ -1081,12 +1084,12 @@ VARIABLES
 
 
        xmms_position
-             xmms  /  bmp  /  audacious / infopipe: MM:SS position of current
+             xmms / bmp / audacious / infopipe:  MM:SS  position  of  current
              tune
 
 
        xmms_position_seconds
-             xmms / bmp / audacious / infopipe: position of current  tune  in
+             xmms  /  bmp / audacious / infopipe: position of current tune in
              seconds
 
 
@@ -1104,13 +1107,13 @@ VARIABLES
 
 
        ibm_temps N
-             If running the IBM ACPI, displays the temperatures from the  IBM
+             If  running the IBM ACPI, displays the temperatures from the IBM
              temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
              GPU.
 
 
        ibm_volume
-             If running the IBM ACPI,  displays  the  "master"  volume,  con-
+             If  running  the  IBM  ACPI,  displays the "master" volume, con-
              trolled by the volume keys (0-14).
 
 
@@ -1133,11 +1136,11 @@ FILES
 BUGS
        Drawing to root or some other desktop window directly doesn't work with
        all window managers. Especially doesn't work well with Gnome and it has
-       been  reported  that  it         doesn't work with KDE either. Nautilus can be
-       disabled from drawing to desktop         with  program  gconf-editor.  Uncheck
-       show_desktop  in         /apps/nautilus/preferences/.  There  is  -w switch in
-       Conky to set some specific window id. You  might         find  xwininfo  -tree
-       useful  to  find         the  window  to draw to. You can also use -o argument
+       been reported that it doesn't work with KDE  either.  Nautilus  can  be
+       disabled         from  drawing  to  desktop with program gconf-editor. Uncheck
+       show_desktop in /apps/nautilus/preferences/.  There  is -w  switch  in
+       Conky  to  set  some  specific window id. You might find xwininfo -tree
+       useful to find the window to draw to. You  can  also  use  -o  argument
        which makes Conky to create its own window.
 
 SEE ALSO
@@ -1153,4 +1156,4 @@ AUTHORS
 
 
 
-                                 2006-04-23                          conky(1)
+                                 2006-05-09                          conky(1)
index 33a00e0..e2eaec5 100644 (file)
@@ -1,5 +1,5 @@
 .\" -*- coding: us-ascii -*-
-.TH conky 1 2006-04-23  
+.TH conky 1 2006-05-09  
 .SH NAME
 conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.
 .SH SYNOPSIS
@@ -497,8 +497,8 @@ Same as execbar, except with an interval
 Same as execigraph, but takes an interval arg graphs values
 
 .TP 
-\fBfont\fR \fBfont\fR 
-Specify a different font. Only applies to one line.
+\fBfont\fR \fB(font)\fR 
+Specify a different font. This new font will apply to the current line and everything following. You can use a $font with no arguments to change back to the default font (much like with $color)
 
 .TP 
 \fBfreq\fR 
index 3cad693..786e7be 100644 (file)
@@ -16,7 +16,7 @@
       <firstname>Brenden</firstname>
       <surname>Matthews</surname>
     </author>
-    <date>2006-04-23</date>
+    <date>2006-05-09</date>
   </refentryinfo>
 
   <refmeta>
index e06be22..263f886 100644 (file)
 <varlistentry>
        <term>
                <command><option>font</option></command>
-       <option>font</option>
+       <option>(font)</option>
        </term>
        <listitem>
-               Specify a different font. Only applies to one line.
+               Specify a different font. This new font will apply to the current line and everything following.  You can use a $font with no arguments to change back to the default font (much like with $color)
        <para></para></listitem>
 </varlistentry>
 
index 16231e5..d7a01ab 100644 (file)
@@ -155,7 +155,7 @@ void free_fonts()
 static void load_fonts()
 {
        int i;
-       for (i=0;i<=font_count;i++) {
+       for (i=0; i <= font_count; i++) {
 #ifdef XFT
        /* load Xft font */
        if (use_xft) {
@@ -497,20 +497,30 @@ static char *scan_font(const char *args)
        if (args && sizeof(args) < 127) {
                return strdup(args);
        }
-       else {
+/*     else {
                ERR("font scan failed, lets hope it doesn't mess stuff up");
-       }
+               we'll assume this means to use the default font now, like $color
+       }*/
        return NULL;
 }
 
 #ifdef X11
 static void new_font(char *buf, char * args) {
-       struct special_t *s = new_special(buf, FONT);
-       if (!s->font_added || strcmp(args, fonts[s->font_added].name)) {
+       if (args) {
+               struct special_t *s = new_special(buf, FONT);
+               if (!s->font_added || strcmp(args, fonts[s->font_added].name)) {
+                       int tmp = selected_font;
+                       selected_font = s->font_added = addfont(args);
+                       load_fonts();
+                       //set_font();
+                       selected_font = tmp;
+               }
+       } else {
+               struct special_t *s = new_special(buf, FONT);
                int tmp = selected_font;
-               selected_font = s->font_added = addfont(args);
+               selected_font = s->font_added = 0;
                load_fonts();
-//             set_font();
+               //set_font();
                selected_font = tmp;
        }
 }
@@ -1057,15 +1067,6 @@ int register_thread(struct thread_info_s *new_thread)
        return thread_count - 1;
 }
 
-void replace_thread(struct thread_info_s *new_thread, int pos) // this isn't even used anymore; oh wells
-{
-       if (pos >= 0 && pos < MAX_THREADS) {
-               thread_list[pos] = new_thread;
-       } else {
-               ERR("thread position out of bounds");
-       }
-}
-
 #define MAXDATASIZE 1000
 #define POP3 0
 #define IMAP 1
@@ -4524,9 +4525,9 @@ static void text_size_updater(char *s)
                text_width = maximum_width;
 
        text_height += h;
-       if (fontchange) {
+/*     if (fontchange) {
                selected_font = 0;
-       }
+       }*/
 }
 #endif /* X11 */
 
@@ -5127,9 +5128,9 @@ static void draw_line(char *s)
        draw_string(s);
 
        cur_y += font_descent();
-       if (fontchange) {
+/*     if (fontchange) {
                selected_font = 0;
-       }
+       }*/
 #endif /* X11 */
 }