mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
Merge with conky1-extra, Changelog contains the changes
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1193 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
25ef59dc09
commit
312d3d6de8
12
ChangeLog
12
ChangeLog
@ -7,6 +7,7 @@
|
||||
* Removed redundancy in various parts
|
||||
|
||||
2008-06-20
|
||||
* Use output_methods instead of out_to_console
|
||||
* Made some functions non-inline to compile with gcc 4.2 and higher
|
||||
|
||||
2008-06-19
|
||||
@ -23,18 +24,29 @@
|
||||
* Moved audacious defs into header
|
||||
* Fixed 3 bufferoverflows in a struct utmp in users.c
|
||||
|
||||
2008-06-09
|
||||
* Graphs can now be logarithmic (except execigraph)
|
||||
|
||||
2008-06-08
|
||||
* Bugfix, $memgraph wasn't working and needed docs
|
||||
* Code for $lines and $words
|
||||
* Bugfix, $execgraph showed 0-0 instead of 0-100 values
|
||||
|
||||
2008-06-07
|
||||
* Case-insensitive values for if_up_strictness
|
||||
* Fix bug where DEV_NAME can read uninitialised memory
|
||||
* Fix bug where ${if_mounted /}foo$endif prints foo on 1 line for
|
||||
each update instead of just 1 line
|
||||
|
||||
2008-06-06
|
||||
* Code for $scroll
|
||||
* Code for $memfree and $memeasyfree
|
||||
|
||||
2008-06-05
|
||||
* Fix bug where conky prints everything twice to STDOUT when
|
||||
out_to_console is enabled
|
||||
* Code for show_graph_range
|
||||
* Code for $monitor and $monitor_number
|
||||
|
||||
2008-06-04
|
||||
* Fix bug where conky tries to free a already freed pointer when you
|
||||
|
95
README
95
README
@ -286,6 +286,14 @@ CONFIGURATION SETTINGS
|
||||
Minimum size of window
|
||||
|
||||
|
||||
monitor
|
||||
Number of the monitor on which conky is running
|
||||
|
||||
|
||||
monitor_number
|
||||
Number of monitors
|
||||
|
||||
|
||||
mpd_host
|
||||
Host of MPD server
|
||||
|
||||
@ -612,10 +620,11 @@ VARIABLES
|
||||
$cpu for more info on SMP.
|
||||
|
||||
|
||||
cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
|
||||
colour 2)
|
||||
cpugraph normal|log (cpu number) (height),(width) (gradient colour 1)
|
||||
(gradient colour 2)
|
||||
CPU usage graph, with optional colours in hex, minus the #. See
|
||||
$cpu for more info on SMP.
|
||||
$cpu for more info on SMP. Uses a logarithmic scale (to see small
|
||||
numbers) when you use "log" instead of "normal".
|
||||
|
||||
|
||||
diskio (device)
|
||||
@ -623,32 +632,35 @@ VARIABLES
|
||||
of sda for /dev/sda. Individual partitions are allowed.
|
||||
|
||||
|
||||
diskiograph (device) (height),(width) (gradient colour 1) (gradient
|
||||
colour 2) (scale)
|
||||
diskiograph normal|log (device) (height),(width) (gradient colour 1)
|
||||
(gradient colour 2) (scale)
|
||||
Disk IO graph, colours defined in hex, minus the #. If scale is
|
||||
non-zero, it becomes the scale for the graph.
|
||||
non-zero, it becomes the scale for the graph. Uses a logarithmic
|
||||
scale (to see small numbers) when you use "log".
|
||||
|
||||
|
||||
diskio_read (device)
|
||||
Displays current disk IO for reads. Device as in diskio.
|
||||
|
||||
|
||||
diskiograph_read (device) (height),(width) (gradient colour 1) (gradi-
|
||||
ent colour 2) (scale)
|
||||
diskiograph_read normal|log (device) (height),(width) (gradient colour
|
||||
1) (gradient colour 2) (scale)
|
||||
Disk IO graph for reads, colours defined in hex, minus the #. If
|
||||
scale is non-zero, it becomes the scale for the graph. Device as
|
||||
in diskio.
|
||||
in diskio. Uses a logarithmic scale (to see small numbers) when
|
||||
you use "log" instead of "normal".
|
||||
|
||||
|
||||
diskio_write (device)
|
||||
Displays current disk IO for writes. Device as in diskio.
|
||||
|
||||
|
||||
diskiograph_write (device) (height),(width) (gradient colour 1) (gradi-
|
||||
ent colour 2) (scale)
|
||||
diskiograph_write normal|log (device) (height),(width) (gradient colour
|
||||
1) (gradient colour 2) (scale)
|
||||
Disk IO graph for writes, colours defined in hex, minus the #.
|
||||
If scale is non-zero, it becomes the scale for the graph. Device
|
||||
as in diskio.
|
||||
as in diskio. Uses a logarithmic scale (to see small numbers)
|
||||
when you use "log" instead of "normal".
|
||||
|
||||
|
||||
disk_protect device
|
||||
@ -664,10 +676,11 @@ VARIABLES
|
||||
Download speed in KiB with one decimal
|
||||
|
||||
|
||||
downspeedgraph net (height),(width) (gradient colour 1) (gradient
|
||||
colour 2) (scale)
|
||||
downspeedgraph normal|log net (height),(width) (gradient colour 1)
|
||||
(gradient colour 2) (scale)
|
||||
Download speed graph, colours defined in hex, minus the #. If
|
||||
scale is non-zero, it becomes the scale for the graph.
|
||||
scale is non-zero, it becomes the scale for the graph. Uses a
|
||||
logarithmic scale (to see small numbers) when you use "log".
|
||||
|
||||
|
||||
else Text to show if any of the above are not true
|
||||
@ -697,8 +710,10 @@ VARIABLES
|
||||
bar is currently fixed, but that may change in the future.
|
||||
|
||||
|
||||
execgraph command
|
||||
Same as execbar, but graphs values.
|
||||
execgraph (normal|log) command
|
||||
Same as execbar, but graphs values. Uses a logaritmic scale when
|
||||
the log option is given (to see small numbers). Values still have
|
||||
to be between 0 and 100.
|
||||
|
||||
|
||||
execi interval command
|
||||
@ -995,14 +1010,20 @@ VARIABLES
|
||||
The value of /proc/sys/vm/laptop_mode
|
||||
|
||||
|
||||
lines textfile
|
||||
Displays the number of lines in the given file
|
||||
|
||||
|
||||
loadavg
|
||||
(1,2,3)> System load average, 1 is for past 1 minute, 2 for past
|
||||
5 minutes and 3 for past 15 minutes.
|
||||
|
||||
|
||||
loadgraph (height),(width) (gradient colour 1) (gradient colour 2)
|
||||
loadgraph normal|log (height),(width) (gradient colour 1) (gradient
|
||||
colour 2)
|
||||
Load1 average graph, similar to xload, with optional colours in
|
||||
hex, minus the #.
|
||||
hex, minus the #. Uses a logarithmic scale (to see small numbers)
|
||||
when you use "log" instead of "normal".
|
||||
|
||||
|
||||
machine
|
||||
@ -1030,8 +1051,19 @@ VARIABLES
|
||||
Bar that shows amount of memory in use
|
||||
|
||||
|
||||
memgraph (height),(width) (gradient colour 1) (gradient colour 2)
|
||||
memeasyfree
|
||||
Amount of free memory including the memory that is very easily freed (buffers/cache)
|
||||
|
||||
|
||||
memfree
|
||||
Amount of free memory
|
||||
|
||||
|
||||
memgraph normal|log (height),(width) (gradient colour 1) (gradient
|
||||
colour 2)
|
||||
Memory usage graph, with optional colours in hex, minus the #
|
||||
Uses a logarithmic scale (to see small numbers) when you use
|
||||
"log" instead of "normal".
|
||||
|
||||
|
||||
memmax Total amount of memory
|
||||
@ -1190,6 +1222,18 @@ VARIABLES
|
||||
Running processes (not sleeping), requires Linux 2.6
|
||||
|
||||
|
||||
scroll length text
|
||||
Scroll 'text' showing 'length' number of characters at the same
|
||||
time. The text may also contain variables. If a var creates out-
|
||||
put on multiple lines then the lines are placed behind each oth-
|
||||
er separated with a '|'-sign. Do NOT use vars that change colors
|
||||
or otherwise affect the design inside a scrolling text. If you
|
||||
want spaces between the start and the end of 'text', place them
|
||||
at the end of 'text' not at the front ("foobar" and " foobar"
|
||||
can both generate "barfoo" but "foobar " will keep the spaces
|
||||
like this "bar foo").
|
||||
|
||||
|
||||
shadecolor (color)
|
||||
Change shading color
|
||||
|
||||
@ -1356,10 +1400,11 @@ VARIABLES
|
||||
Upload speed in KiB with one decimal
|
||||
|
||||
|
||||
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
|
||||
2) (scale)
|
||||
upspeedgraph normal|log net (height),(width) (gradient colour 1)
|
||||
(gradient colour 2) (scale)
|
||||
Upload speed graph, colours defined in hex, minus the #. If
|
||||
scale is non-zero, it becomes the scale for the graph.
|
||||
scale is non-zero, it becomes the scale for the graph. Uses a
|
||||
logarithmic scale (to see small numbers) when you use "log".
|
||||
|
||||
|
||||
uptime Uptime
|
||||
@ -1432,6 +1477,10 @@ VARIABLES
|
||||
Wireless link quality bar (Linux only)
|
||||
|
||||
|
||||
words textfile
|
||||
Displays the number of words in the given file
|
||||
|
||||
|
||||
xmms2_artist
|
||||
Artist in current XMMS2 song
|
||||
|
||||
|
@ -50,9 +50,10 @@ update_interval 3.0
|
||||
uppercase no
|
||||
use_spacer no
|
||||
show_graph_scale no
|
||||
show_graph_range no
|
||||
|
||||
TEXT
|
||||
$nodename - $sysname $kernel on $machine
|
||||
${scroll 16 $nodename - $sysname $kernel on $machine | }
|
||||
$hr
|
||||
${color grey}Uptime:$color $uptime
|
||||
${color grey}Frequency (in MHz):$color $freq
|
||||
|
@ -343,6 +343,13 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>show_graph_range</option></command></term>
|
||||
<listitem>
|
||||
Shows the time range covered by a graph.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>stippled_borders</option></command></term>
|
||||
<listitem>
|
||||
|
78
doc/conky.1
78
doc/conky.1
@ -1,4 +1,4 @@
|
||||
'\" -*- coding: us-ascii -*-
|
||||
.\" -*- coding: us-ascii -*-
|
||||
.if \n(.g .ds T< \\FC
|
||||
.if \n(.g .ds T> \\F[\n[.fam]]
|
||||
.de URL
|
||||
@ -30,7 +30,7 @@ using scripts and other external programs.
|
||||
Conky has more than 250 built in objects, including support for
|
||||
a plethora of OS stats (uname, uptime, CPU usage, mem usage, disk
|
||||
usage, "top" like process stats, and network monitoring, just to name a few),
|
||||
built in IMAP and POP3 support, built in support for many popular
|
||||
built in IMAP and POP3 support, built in support for many popular
|
||||
music players (MPD, XMMS2, BMPx, Audacious), and much much more.
|
||||
Conky can display this info either as text, or using simple progress
|
||||
bars and graph widgets, with different fonts and colours.
|
||||
@ -42,11 +42,11 @@ or stop by #conky on irc.freenode.net if you have questions or want to contribut
|
||||
Thanks for your interest in Conky.
|
||||
.SH COMPILING
|
||||
For users compiling from source on a binary distro, make sure you have the X development
|
||||
libraries installed. This should be a package along the lines of "libx11-dev" or
|
||||
libraries installed. This should be a package along the lines of "libx11-dev" or
|
||||
"xorg-x11-dev" for X11 libs, and similar "-dev" format for the other libs required (depending
|
||||
on your configure options).
|
||||
.PP
|
||||
Conky has (for some time) been available in the repositories of most popular distributions.
|
||||
Conky has (for some time) been available in the repositories of most popular distributions.
|
||||
Here are some installation instructions for a few:
|
||||
.PP
|
||||
Gentoo users -- Conky is in Gentoo's Portage... simply use "emerge app-admin/conky" for installation.
|
||||
@ -139,7 +139,7 @@ Y position
|
||||
Number of times to update Conky (and quit)
|
||||
|
||||
.SH "CONFIGURATION SETTINGS"
|
||||
Default configuration file location is $HOME/.conkyrc or
|
||||
Default configuration file location is $HOME/.conkyrc or
|
||||
${sysconfdir}/conky/conky.conf. On most systems, sysconfdir is /etc,
|
||||
and you can find the sample config file there (/etc/conky/conky.conf).
|
||||
.PP
|
||||
@ -338,6 +338,10 @@ Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
|
||||
\fB\*(T<\fBshow_graph_scale\fR\*(T>\fR
|
||||
Shows the maximum value in scaled graphs.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBshow_graph_range\fR\*(T>\fR
|
||||
Shows the time range covered by a graph.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBstippled_borders\fR\*(T>\fR
|
||||
Border stippling (dashing) in pixels
|
||||
@ -560,32 +564,32 @@ CPU usage in percents. For SMP machines, the CPU number can be provided as an ar
|
||||
Bar that shows CPU usage, height is bar's height in pixels. See $cpu for more info on SMP.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBcpugraph\fR\*(T>\fR \*(T<\fB(cpu number) (height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
CPU usage graph, with optional colours in hex, minus the #. See $cpu for more info on SMP.
|
||||
\fB\*(T<\fBcpugraph\fR\*(T>\fR \*(T<\fBnormal|log (cpu number) (height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
CPU usage graph, with optional colours in hex, minus the #. See $cpu for more info on SMP. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskio\fR\*(T>\fR \*(T<\fB(device)\fR\*(T>
|
||||
Displays current disk IO. Device is optional, and takes the form of sda for /dev/sda. Individual partitions are allowed.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskiograph\fR\*(T>\fR \*(T<\fB(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
\fB\*(T<\fBdiskiograph\fR\*(T>\fR \*(T<\fBnormal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskio_read\fR\*(T>\fR \*(T<\fB(device)\fR\*(T>
|
||||
Displays current disk IO for reads. Device as in diskio.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskiograph_read\fR\*(T>\fR \*(T<\fB(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph for reads, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio.
|
||||
\fB\*(T<\fBdiskiograph_read\fR\*(T>\fR \*(T<\fBnormal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph for reads, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskio_write\fR\*(T>\fR \*(T<\fB(device)\fR\*(T>
|
||||
Displays current disk IO for writes. Device as in diskio.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskiograph_write\fR\*(T>\fR \*(T<\fB(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph for writes, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio.
|
||||
\fB\*(T<\fBdiskiograph_write\fR\*(T>\fR \*(T<\fBnormal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Disk IO graph for writes, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdisk_protect\fR\*(T>\fR \*(T<\fBdevice\fR\*(T>
|
||||
@ -600,8 +604,8 @@ Download speed in KiB
|
||||
Download speed in KiB with one decimal
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdownspeedgraph\fR\*(T>\fR \*(T<\fBnet (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Download speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
\fB\*(T<\fBdownspeedgraph\fR\*(T>\fR \*(T<\fBnormal|log net (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Download speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBelse\fR\*(T>\fR
|
||||
@ -628,8 +632,8 @@ Executes a shell command and displays the output in conky. warning: this takes a
|
||||
Same as exec, except if the first value return is a value between 0-100, it will use that number for a bar. The size for the bar is currently fixed, but that may change in the future.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBexecgraph\fR\*(T>\fR \*(T<\fBcommand\fR\*(T>
|
||||
Same as execbar, but graphs values.
|
||||
\fB\*(T<\fBexecgraph\fR\*(T>\fR \*(T<\fB(normal|log) command\fR\*(T>
|
||||
Same as execbar, but graphs values. Uses a logaritmic scale when the log option is given (to see small numbers). Values still have to be between 0 and 100.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBexeci\fR\*(T>\fR \*(T<\fBinterval command\fR\*(T>
|
||||
@ -853,13 +857,17 @@ Kernel version
|
||||
\fB\*(T<\fBlaptop_mode\fR\*(T>\fR
|
||||
The value of /proc/sys/vm/laptop_mode
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBlines\fR\*(T>\fR \*(T<\fBtextfile\fR\*(T>
|
||||
Displays the number of lines in the given file
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBloadavg\fR\*(T>\fR
|
||||
(1,2,3)> System load average, 1 is for past 1 minute, 2 for past 5 minutes and 3 for past 15 minutes.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBloadgraph\fR\*(T>\fR \*(T<\fB(height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
Load1 average graph, similar to xload, with optional colours in hex, minus the #.
|
||||
\fB\*(T<\fBloadgraph\fR\*(T>\fR \*(T<\fBnormal|log (height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
Load1 average graph, similar to xload, with optional colours in hex, minus the #. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmachine\fR\*(T>\fR
|
||||
@ -885,8 +893,16 @@ Amount of memory in use
|
||||
Bar that shows amount of memory in use
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmemgraph\fR\*(T>\fR \*(T<\fB(height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
Memory usage graph
|
||||
\fB\*(T<\fBmemeasyfree\fR\*(T>\fR
|
||||
Amount of free memory including the memory that is very easily freed (buffers/cache)
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmemfree\fR\*(T>\fR
|
||||
Amount of free memory
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmemgraph\fR\*(T>\fR \*(T<\fBnormal|log (height),(width) (gradient colour 1) (gradient colour 2)\fR\*(T>
|
||||
Memory usage graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmemmax\fR\*(T>\fR
|
||||
@ -896,6 +912,14 @@ Total amount of memory
|
||||
\fB\*(T<\fBmemperc\fR\*(T>\fR
|
||||
Percentage of memory in use
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmonitor\fR\*(T>\fR
|
||||
Number of the monitor on which conky is running
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmonitor_number\fR\*(T>\fR
|
||||
Number of monitors
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmpd_artist\fR\*(T>\fR
|
||||
Artist in current MPD song must be enabled at compile
|
||||
@ -1132,6 +1156,10 @@ Move text over by N pixels. See also $voffset.
|
||||
\fB\*(T<\fBrss\fR\*(T>\fR \*(T<\fBurl delay_in_minutes action item_num\fR\*(T>
|
||||
Download and parse RSS feeds. Action may be one of the following: feed_title, item_title (with num par), item_desc (with num par) and item_titles.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBscroll\fR\*(T>\fR \*(T<\fBlength text\fR\*(T>
|
||||
Scroll 'text' showing 'length' number of characters at the same time. The text may also contain variables. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T>
|
||||
Puts a tab of the specified width, starting from column 'start'.
|
||||
@ -1181,8 +1209,8 @@ Upload speed in KiB
|
||||
Upload speed in KiB with one decimal
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBupspeedgraph\fR\*(T>\fR \*(T<\fBnet (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Upload speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
\fB\*(T<\fBupspeedgraph\fR\*(T>\fR \*(T<\fBnormal|log net (height),(width) (gradient colour 1) (gradient colour 2) (scale)\fR\*(T>
|
||||
Upload speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBuptime\fR\*(T>\fR
|
||||
@ -1256,6 +1284,10 @@ Wireless link quality in percents (Linux only)
|
||||
\fB\*(T<\fBwireless_link_bar\fR\*(T>\fR \*(T<\fB(height), (width) net\fR\*(T>
|
||||
Wireless link quality bar (Linux only)
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBwords\fR\*(T>\fR \*(T<\fBtextfile\fR\*(T>
|
||||
Displays the number of words in the given file
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBxmms2_artist\fR\*(T>\fR
|
||||
Artist in current XMMS2 song
|
||||
|
@ -128,6 +128,9 @@ use_spacer none
|
||||
# Shows the maximum value in scaled graphs.
|
||||
show_graph_scale no
|
||||
|
||||
# Shows the time range covered by a graph.
|
||||
show_graph_range no
|
||||
|
||||
# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
|
||||
#max_port_monitor_connections 256
|
||||
|
||||
|
@ -420,10 +420,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>cpugraph</option></command>
|
||||
<option>(cpu number) (height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
<option>normal|log (cpu number) (height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
CPU usage graph, with optional colours in hex, minus the #. See $cpu for more info on SMP.
|
||||
CPU usage graph, with optional colours in hex, minus the #. See $cpu for more info on SMP. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -440,10 +440,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>diskiograph</option></command>
|
||||
<option>(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
<option>normal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Disk IO graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
Disk IO graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -460,10 +460,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>diskiograph_read</option></command>
|
||||
<option>(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
<option>normal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Disk IO graph for reads, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio.
|
||||
Disk IO graph for reads, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -480,10 +480,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>diskiograph_write</option></command>
|
||||
<option>(device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
<option>normal|log (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Disk IO graph for writes, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio.
|
||||
Disk IO graph for writes, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -520,10 +520,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>downspeedgraph</option></command>
|
||||
<option>net (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
<option>normal|log net (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Download speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
Download speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -587,10 +587,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>execgraph</option></command>
|
||||
<option>command</option>
|
||||
<option>(normal|log) command</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Same as execbar, but graphs values.
|
||||
Same as execbar, but graphs values. Uses a logaritmic scale when the log option is given (to see small numbers). Values still have to be between 0 and 100.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -1135,10 +1135,20 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>loadgraph</option></command>
|
||||
<option>(height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
<option>normal|log (height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Load1 average graph, similar to xload, with optional colours in hex, minus the #.
|
||||
Load1 average graph, similar to xload, with optional colours in hex, minus the #. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>lines</option></command>
|
||||
<option>textfile</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Displays the number of lines in the given file
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -1197,10 +1207,28 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>memgraph</option></command>
|
||||
<option>(height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
<option>normal|log (height),(width) (gradient colour 1) (gradient colour 2)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Memory usage graph
|
||||
Memory usage graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>memeasyfree</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Amount of free memory including the memory that is very easily freed (buffers/cache)
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>memfree</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Amount of free memory
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -1222,6 +1250,24 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>monitor</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Number of the monitor on which conky is running
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>monitor_number</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Number of monitors
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>mpd_artist</option></command>
|
||||
@ -1522,6 +1568,16 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>scroll</option></command>
|
||||
<option>length text</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Scroll 'text' showing 'length' number of characters at the same time. The text may also contain variables. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>shadecolor</option></command>
|
||||
@ -1817,10 +1873,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>upspeedgraph</option></command>
|
||||
<option>net (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
<option>normal|log net (height),(width) (gradient colour 1) (gradient colour 2) (scale)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Upload speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph.
|
||||
Upload speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal".
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -1992,6 +2048,16 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>words</option></command>
|
||||
<option>textfile</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Displays the number of words in the given file
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>xmms2_artist</option></command>
|
||||
|
@ -6,13 +6,13 @@
|
||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||
|
||||
## Configuration items
|
||||
color green "\<(alignment|background|show_graph_scale|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|default_color|default_shade_color|default_shadecolor|default_outline_color|default_outlinecolor|imap|pop3|mpd_host|mpd_port|mpd_password|music_player_interval|sensor_device|cpu_avg_samples|net_avg_samples|double_buffer|override_utf8_locale|draw_borders|draw_graph_borders|draw_shades|draw_outline|out_to_console|use_spacer|use_xft|font|xftalpha|xftfont|use_xft|gap_x|gap_y|mail_spool|minimum_size|maximum_width|no_buffers|top_cpu_separate|short_units|pad_percents|own_window|own_window_class|own_window_title|own_window_transparent|own_window_colour|own_window_hints|own_window_type|stippled_borders|temp1|temp2|update_interval|total_run_times|uppercase|max_specials|max_user_text|text_buffer_size|max_port_monitor_connections)\>"
|
||||
color green "\<(alignment|background|show_graph_range|show_graph_scale|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|default_color|default_shade_color|default_shadecolor|default_outline_color|default_outlinecolor|imap|pop3|mpd_host|mpd_port|mpd_password|music_player_interval|sensor_device|cpu_avg_samples|net_avg_samples|double_buffer|override_utf8_locale|draw_borders|draw_graph_borders|draw_shades|draw_outline|out_to_console|use_spacer|use_xft|font|xftalpha|xftfont|use_xft|gap_x|gap_y|mail_spool|minimum_size|maximum_width|no_buffers|top_cpu_separate|short_units|pad_percents|own_window|own_window_class|own_window_title|own_window_transparent|own_window_colour|own_window_hints|own_window_type|stippled_borders|temp1|temp2|update_interval|total_run_times|uppercase|max_specials|max_user_text|text_buffer_size|max_port_monitor_connections)\>"
|
||||
|
||||
## Configuration item constants
|
||||
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>"
|
||||
|
||||
## Variables
|
||||
color brightblue "\<(acpitemp|acpitempf|freq|freq_g|voltage_mv|voltage_v|wireless_essid|wireless_mode|wireless_bitrate|wireless_ap|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_link_bar|freq_dyn|freq_dyn_g|adt746xcpu|adt746xfan|acpifan|acpiacadapter|battery|battery_time|battery_percent|battery_bar|buffers|cached|cpu|cpubar|cpugraph|loadgraph|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|conky_version|conky_build_date|conky_build_arch|disk_protect|i8k_version|i8k_bios|i8k_serial|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_status|i8k_right_fan_status|i8k_left_fan_rpm|i8k_right_fan_rpm|i8k_ac_status|i8k_buttons_status|ibm_fan|ibm_temps|ibm_volume|ibm_brightness|if_up|if_gw|gw_iface|gw_ip|laptop_mode|pb_battery|obsd_sensors_temp|obsd_sensors_fan|obsd_sensors_volt|obsd_vendor|obsd_product|font|diskio|diskio_write|diskio_read|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|else|endif|addr|addrs|image|exec|execp|execbar|execgraph|execibar|execigraph|execi|execpi|texeci|imap_unseen|imap_messages|pop3_unseen|pop3_used|fs_bar|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_bar_free|fs_used_perc|loadavg|goto|tab|hr|nameserver|rss|hddtemp|offset|voffset|i2c|platform|hwmon|alignr|alignc|if_empty|if_existing|if_mounted|if_running|ioscheduler|kernel|machine|mem|memmax|memperc|membar|memgraph|mixer|mixerl|mixerr|mixerbar|mixerlbar|mixerrbar|mails|mboxscan|new_mails|nodename|outlinecolor|processes|running_processes|shadecolor|stippled_hr|swap|swapmax|swapperc|swapbar|sysname|time|utime|tztime|totaldown|totalup|updates|upspeed|upspeedf|upspeedgraph|uptime_short|uptime|user_names|user_terms|user_times|user_number|apm_adapter|apm_battery_life|apm_battery_time|mpd_title|mpd_artist|mpd_album|mpd_random|mpd_repeat|mpd_track|mpd_name|mpd_file|mpd_vol|mpd_bitrate|mpd_status|mpd_elapsed|mpd_length|mpd_percent|mpd_bar|mpd_smart|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_status|xmms2_date|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_size|xmms2_elapsed|xmms2_duration|xmms2_percent|xmms2_bar|xmms2_playlist|xmms2_timesplayed|xmms2_smart|audacious_status|audacious_title|audacious_length|audacious_length_seconds|audacious_position|audacious_position_seconds|audacious_bitrate|audacious_frequency|audacious_channels|audacious_filename|audacious_playlist_length|audacious_playlist_position|audacious_bar|bmpx_title|bmpx_artist|bmpx_album|bmpx_uri|bmpx_track|bmpx_bitrate|top|top_mem|tail|head|tcp_portmon|iconv_start|iconv_stop|entropy_avail|entropy_poolsize|entropy_bar|smapi|if_smapi_bat_installed|smapi_bat_perc|smapi_bat_bar)\>"
|
||||
color brightblue "\<(acpitemp|acpitempf|freq|freq_g|voltage_mv|voltage_v|wireless_essid|wireless_mode|wireless_bitrate|wireless_ap|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_link_bar|freq_dyn|freq_dyn_g|adt746xcpu|adt746xfan|acpifan|acpiacadapter|battery|battery_time|battery_percent|battery_bar|buffers|cached|cpu|cpubar|cpugraph|loadgraph|lines|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|conky_version|conky_build_date|conky_build_arch|disk_protect|i8k_version|i8k_bios|i8k_serial|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_status|i8k_right_fan_status|i8k_left_fan_rpm|i8k_right_fan_rpm|i8k_ac_status|i8k_buttons_status|ibm_fan|ibm_temps|ibm_volume|ibm_brightness|if_up|if_gw|gw_iface|gw_ip|laptop_mode|pb_battery|obsd_sensors_temp|obsd_sensors_fan|obsd_sensors_volt|obsd_vendor|obsd_product|font|diskio|diskio_write|diskio_read|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|else|endif|addr|addrs|image|exec|execp|execbar|execgraph|execibar|execigraph|execi|execpi|texeci|imap_unseen|imap_messages|pop3_unseen|pop3_used|fs_bar|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_bar_free|fs_used_perc|loadavg|goto|tab|hr|nameserver|rss|hddtemp|offset|voffset|i2c|platform|hwmon|alignr|alignc|if_empty|if_existing|if_mounted|if_running|ioscheduler|kernel|machine|mem|memeasyfree|memfree|memmax|memperc|membar|memgraph|mixer|mixerl|mixerr|mixerbar|mixerlbar|mixerrbar|mails|mboxscan|new_mails|nodename|outlinecolor|processes|running_processes|scroll|shadecolor|stippled_hr|swap|swapmax|swapperc|swapbar|sysname|time|utime|tztime|totaldown|totalup|updates|upspeed|upspeedf|upspeedgraph|uptime_short|uptime|user_names|user_terms|user_times|user_number|apm_adapter|apm_battery_life|apm_battery_time|monitor|monitor_number|mpd_title|mpd_artist|mpd_album|mpd_random|mpd_repeat|mpd_track|mpd_name|mpd_file|mpd_vol|mpd_bitrate|mpd_status|mpd_elapsed|mpd_length|mpd_percent|mpd_bar|mpd_smart|words|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_status|xmms2_date|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_size|xmms2_elapsed|xmms2_duration|xmms2_percent|xmms2_bar|xmms2_playlist|xmms2_timesplayed|xmms2_smart|audacious_status|audacious_title|audacious_length|audacious_length_seconds|audacious_position|audacious_position_seconds|audacious_bitrate|audacious_frequency|audacious_channels|audacious_filename|audacious_playlist_length|audacious_playlist_position|audacious_bar|bmpx_title|bmpx_artist|bmpx_album|bmpx_uri|bmpx_track|bmpx_bitrate|top|top_mem|tail|head|tcp_portmon|iconv_start|iconv_stop|entropy_avail|entropy_poolsize|entropy_bar|smapi|if_smapi_bat_installed|smapi_bat_perc|smapi_bat_bar)\>"
|
||||
|
||||
|
||||
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
|
@ -17,6 +17,7 @@ syn keyword ConkyrcSetting
|
||||
\ alignment
|
||||
\ background
|
||||
\ show_graph_scale
|
||||
\ show_graph_range
|
||||
\ border_margin
|
||||
\ border_width
|
||||
\ color0
|
||||
@ -248,6 +249,8 @@ syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipw
|
||||
\ kernel
|
||||
\ machine
|
||||
\ mem
|
||||
\ memeasyfree
|
||||
\ memfree
|
||||
\ memmax
|
||||
\ memperc
|
||||
\ membar
|
||||
@ -265,6 +268,9 @@ syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipw
|
||||
\ outlinecolor
|
||||
\ processes
|
||||
\ running_processes
|
||||
\ scroll
|
||||
\ lines
|
||||
\ words
|
||||
\ shadecolor
|
||||
\ stippled_hr
|
||||
\ swap
|
||||
@ -290,6 +296,8 @@ syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipw
|
||||
\ apm_adapter
|
||||
\ apm_battery_life
|
||||
\ apm_battery_time
|
||||
\ monitor
|
||||
\ monitor_number
|
||||
\ mpd_title
|
||||
\ mpd_artist
|
||||
\ mpd_album
|
||||
|
@ -357,9 +357,16 @@ void update_stuff(void)
|
||||
update_meminfo();
|
||||
if (no_buffers) {
|
||||
info.mem -= info.bufmem;
|
||||
info.memeasyfree += info.bufmem;
|
||||
}
|
||||
last_meminfo_update = current_update_time;
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
if (NEED(INFO_X11)) {
|
||||
update_x11info();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NEED(INFO_TOP)) {
|
||||
update_top();
|
||||
|
467
src/conky.c
467
src/conky.c
@ -337,6 +337,7 @@ static int cpu_avg_samples, net_avg_samples;
|
||||
#ifdef X11
|
||||
|
||||
static int show_graph_scale;
|
||||
static int show_graph_range;
|
||||
|
||||
/* Position on the screen */
|
||||
static int text_alignment;
|
||||
@ -591,7 +592,6 @@ long fwd_fcharfind(FILE *fp, char val, unsigned int step)
|
||||
}
|
||||
fseek(fp, orig_pos, SEEK_SET);
|
||||
return ret;
|
||||
#undef BUFSZ
|
||||
}
|
||||
|
||||
#ifndef HAVE_MEMRCHR
|
||||
@ -647,7 +647,6 @@ long rev_fcharfind(FILE *fp, char val, unsigned int step)
|
||||
ret = file_pos + buf_pos;
|
||||
}
|
||||
return ret;
|
||||
#undef BUFSZ
|
||||
}
|
||||
|
||||
static void new_bar(char *buf, int w, int h, int usage)
|
||||
@ -692,7 +691,7 @@ static void new_font(char *buf, char *args)
|
||||
if (args) {
|
||||
struct special_t *s = new_special(buf, FONT);
|
||||
|
||||
if (s->font_added > font_count || !s->font_added || strncmp(args, fonts[s->font_added].name, DEFAULT_TEXT_BUFFER_SIZE)) {
|
||||
if (s->font_added > font_count || !s->font_added || (strncmp(args, fonts[s->font_added].name, DEFAULT_TEXT_BUFFER_SIZE) != EQUAL) ) {
|
||||
int tmp = selected_font;
|
||||
|
||||
selected_font = s->font_added = addfont(args);
|
||||
@ -708,17 +707,23 @@ static void new_font(char *buf, char *args)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void graph_append(struct special_t *graph, double f)
|
||||
void graph_append(struct special_t *graph, double f, char showaslog)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (showaslog) {
|
||||
f = log10(f + 1);
|
||||
}
|
||||
|
||||
if (!graph->scaled && f > graph->graph_scale) {
|
||||
f = graph->graph_scale;
|
||||
}
|
||||
|
||||
/* Already happens in new_graph
|
||||
if (graph->scaled) {
|
||||
graph->graph_scale = 1;
|
||||
}
|
||||
*/
|
||||
graph->graph[0] = f; /* add new data */
|
||||
/* shift all the data by 1 */
|
||||
for (i = graph->graph_width - 1; i > 0; i--) {
|
||||
@ -757,7 +762,7 @@ static unsigned int adjust_colors(unsigned int color)
|
||||
}
|
||||
|
||||
static void new_graph(char *buf, int w, int h, unsigned int first_colour,
|
||||
unsigned int second_colour, double i, int scale, int append)
|
||||
unsigned int second_colour, double i, int scale, int append, char showaslog)
|
||||
{
|
||||
struct special_t *s = new_special(buf, GRAPH);
|
||||
|
||||
@ -788,18 +793,26 @@ static void new_graph(char *buf, int w, int h, unsigned int first_colour,
|
||||
/* if (s->width) {
|
||||
s->graph_width = s->width - 2; // subtract 2 for rectangle around
|
||||
} */
|
||||
if (showaslog) {
|
||||
s->graph_scale = log10(s->graph_scale + 1);
|
||||
}
|
||||
if (append) {
|
||||
graph_append(s, i);
|
||||
graph_append(s, i, showaslog);
|
||||
}
|
||||
}
|
||||
|
||||
#define LOGGRAPH "log"
|
||||
#define NORMGRAPH "normal"
|
||||
|
||||
static char *scan_graph(const char *args, int *w, int *h,
|
||||
unsigned int *first_colour, unsigned int *last_colour,
|
||||
unsigned int *scale)
|
||||
unsigned int *scale, char *showaslog)
|
||||
{
|
||||
char buf[64];
|
||||
char showaslogbuf[strlen(NORMGRAPH)+1];
|
||||
buf[0] = 0;
|
||||
|
||||
*showaslog = FALSE;
|
||||
/* zero width means all space that is available */
|
||||
*w = 0;
|
||||
*h = 25;
|
||||
@ -808,57 +821,69 @@ static char *scan_graph(const char *args, int *w, int *h,
|
||||
*scale = 0;
|
||||
/* graph's argument is either height or height,width */
|
||||
if (args) {
|
||||
if (sscanf(args, "%d,%d %x %x %u", h, w, first_colour, last_colour,
|
||||
scale) == 5) {
|
||||
if (sscanf(args, "%6s %d,%d %x %x %u", showaslogbuf, h, w, first_colour, last_colour,
|
||||
scale) == 6) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
*scale = 0;
|
||||
if (sscanf(args, "%d,%d %x %x", h, w, first_colour, last_colour) == 4) {
|
||||
if (sscanf(args, "%6s %d,%d %x %x", showaslogbuf, h, w, first_colour, last_colour) == 5) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
if (sscanf(args, "%63s %d,%d %x %x %u", buf, h, w, first_colour,
|
||||
last_colour, scale) == 6) {
|
||||
if (sscanf(args, "%6s %63s %d,%d %x %x %u", showaslogbuf, buf, h, w, first_colour,
|
||||
last_colour, scale) == 7) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
*scale = 0;
|
||||
if (sscanf(args, "%63s %d,%d %x %x", buf, h, w, first_colour,
|
||||
last_colour) == 5) {
|
||||
if (sscanf(args, "%6s %63s %d,%d %x %x", showaslogbuf, buf, h, w, first_colour,
|
||||
last_colour) == 6) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
buf[0] = '\0';
|
||||
*h = 25;
|
||||
*w = 0;
|
||||
if (sscanf(args, "%x %x %u", first_colour, last_colour, scale) == 3) {
|
||||
if (sscanf(args, "%6s %x %x %u", showaslogbuf, first_colour, last_colour, scale) == 4) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
*scale = 0;
|
||||
if (sscanf(args, "%x %x", first_colour, last_colour) == 2) {
|
||||
if (sscanf(args, "%6s %x %x", showaslogbuf, first_colour, last_colour) == 3) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
if (sscanf(args, "%63s %x %x %u", buf, first_colour, last_colour,
|
||||
scale) == 4) {
|
||||
if (sscanf(args, "%6s %63s %x %x %u", showaslogbuf, buf, first_colour, last_colour,
|
||||
scale) == 5) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
*scale = 0;
|
||||
if (sscanf(args, "%63s %x %x", buf, first_colour, last_colour) == 3) {
|
||||
if (sscanf(args, "%6s %63s %x %x", showaslogbuf, buf, first_colour, last_colour) == 4) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
buf[0] = '\0';
|
||||
*first_colour = 0;
|
||||
*last_colour = 0;
|
||||
if (sscanf(args, "%d,%d %u", h, w, scale) == 3) {
|
||||
if (sscanf(args, "%6s %d,%d %u", showaslogbuf, h, w, scale) == 4) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
*scale = 0;
|
||||
if (sscanf(args, "%d,%d", h, w) == 2) {
|
||||
if (sscanf(args, "%6s %d,%d", showaslogbuf, h, w) == 3) {
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return NULL;
|
||||
}
|
||||
if (sscanf(args, "%63s %d,%d %u", buf, h, w, scale) < 4) {
|
||||
if (sscanf(args, "%6s %63s %d,%d %u", showaslogbuf, buf, h, w, scale) < 5) {
|
||||
*scale = 0;
|
||||
//TODO: check the return value and throw an error?
|
||||
sscanf(args, "%63s %d,%d", buf, h, w);
|
||||
sscanf(args, "%6s %63s %d,%d", showaslogbuf, buf, h, w);
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
}
|
||||
|
||||
*showaslog = ( strncasecmp(showaslogbuf, LOGGRAPH, strlen(showaslogbuf)) == EQUAL ) ? TRUE : FALSE ;
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
|
||||
@ -1181,12 +1206,16 @@ enum text_object_type {
|
||||
OBJ_top_mem,
|
||||
OBJ_tail,
|
||||
OBJ_head,
|
||||
OBJ_lines,
|
||||
OBJ_words,
|
||||
OBJ_kernel,
|
||||
OBJ_loadavg,
|
||||
OBJ_machine,
|
||||
OBJ_mails,
|
||||
OBJ_mboxscan,
|
||||
OBJ_mem,
|
||||
OBJ_memeasyfree,
|
||||
OBJ_memfree,
|
||||
OBJ_membar,
|
||||
OBJ_memgraph,
|
||||
OBJ_memmax,
|
||||
@ -1199,6 +1228,10 @@ enum text_object_type {
|
||||
OBJ_mixerbar,
|
||||
OBJ_mixerlbar,
|
||||
OBJ_mixerrbar,
|
||||
#ifdef X11
|
||||
OBJ_monitor,
|
||||
OBJ_monitor_number,
|
||||
#endif
|
||||
OBJ_nameserver,
|
||||
OBJ_new_mails,
|
||||
OBJ_nodename,
|
||||
@ -1336,6 +1369,7 @@ enum text_object_type {
|
||||
OBJ_smapi_bat_perc,
|
||||
OBJ_if_smapi_bat_installed,
|
||||
#endif
|
||||
OBJ_scroll,
|
||||
OBJ_entropy_avail,
|
||||
OBJ_entropy_poolsize,
|
||||
OBJ_entropy_bar
|
||||
@ -1453,6 +1487,12 @@ struct text_object {
|
||||
int delay;
|
||||
} rss;
|
||||
#endif
|
||||
struct {
|
||||
char *text;
|
||||
unsigned int show;
|
||||
unsigned int start;
|
||||
} scroll;
|
||||
|
||||
struct local_mail_s local_mail;
|
||||
#ifdef NVIDIA
|
||||
struct nvidia_s nvidia;
|
||||
@ -1464,6 +1504,7 @@ struct text_object {
|
||||
long line;
|
||||
unsigned int c, d, e;
|
||||
float f;
|
||||
char showaslog;
|
||||
char global_mode;
|
||||
};
|
||||
|
||||
@ -2312,6 +2353,9 @@ static void free_text_objects(struct text_object_list *text_object_list)
|
||||
free_mpd_vars(&info.mpd);
|
||||
break;
|
||||
#endif
|
||||
case OBJ_scroll:
|
||||
free(obj->data.scroll.text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(text_object_list->text_objects);
|
||||
@ -2566,11 +2610,11 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.s = strndup(DEV_NAME(arg), text_buffer_size);
|
||||
END OBJ(laptop_mode, 0)
|
||||
END OBJ(pb_battery, 0)
|
||||
if (arg && strcmp(arg, "status") == 0) {
|
||||
if (arg && strcmp(arg, "status") == EQUAL) {
|
||||
obj->data.i = PB_BATT_STATUS;
|
||||
} else if (arg && strcmp(arg, "percent") == 0) {
|
||||
} else if (arg && strcmp(arg, "percent") == EQUAL) {
|
||||
obj->data.i = PB_BATT_PERCENT;
|
||||
} else if (arg && strcmp(arg, "time") == 0) {
|
||||
} else if (arg && strcmp(arg, "time") == EQUAL) {
|
||||
obj->data.i = PB_BATT_TIME;
|
||||
} else {
|
||||
ERR("pb_battery: needs one argument: status, percent or time");
|
||||
@ -2619,7 +2663,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(cached, INFO_BUFFERS)
|
||||
END OBJ(cpu, INFO_CPU)
|
||||
if (arg) {
|
||||
if (strncmp(arg, "cpu", 3) == 0 && isdigit(arg[3])) {
|
||||
if (strncmp(arg, "cpu", 3) == EQUAL && isdigit(arg[3])) {
|
||||
obj->data.cpu_index = atoi(&arg[3]);
|
||||
arg += 4;
|
||||
} else {
|
||||
@ -2630,7 +2674,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(cpubar, INFO_CPU)
|
||||
if (arg) {
|
||||
if (strncmp(arg, "cpu", 3) == 0 && isdigit(arg[3])) {
|
||||
if (strncmp(arg, "cpu", 3) == EQUAL && isdigit(arg[3])) {
|
||||
obj->data.cpu_index = atoi(&arg[3]);
|
||||
arg += 4;
|
||||
} else {
|
||||
@ -2643,10 +2687,10 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(cpugraph, INFO_CPU)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) {
|
||||
if (strncmp(buf, "cpu", 3) == EQUAL && isdigit(buf[3])) {
|
||||
obj->data.cpu_index = atoi(&buf[3]);
|
||||
} else {
|
||||
obj->data.cpu_index = 0;
|
||||
@ -2655,7 +2699,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(loadgraph, INFO_LOADAVG)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
if (buf) {
|
||||
int a = 1, r = 3;
|
||||
if (arg) {
|
||||
@ -2685,7 +2729,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(diskiograph, INFO_DISKIO)
|
||||
char *buf = scan_graph(DEV_NAME(arg), &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
obj->data.diskio = prepare_diskio_stat(buf);
|
||||
@ -2695,7 +2739,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(diskiograph_read, INFO_DISKIO)
|
||||
char *buf = scan_graph(DEV_NAME(arg), &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
obj->data.diskio = prepare_diskio_stat(buf);
|
||||
@ -2705,7 +2749,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(diskiograph_write, INFO_DISKIO)
|
||||
char *buf = scan_graph(DEV_NAME(arg), &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
obj->data.diskio = prepare_diskio_stat(buf);
|
||||
@ -2757,7 +2801,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(downspeedgraph, INFO_NET)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
obj->data.net = get_net_stat(buf);
|
||||
@ -3044,19 +3088,19 @@ static struct text_object *construct_text_object(const char *s,
|
||||
return NULL;
|
||||
}
|
||||
if (sscanf(arg, "%63s %i", buf, &n) == 2) {
|
||||
if (strcmp(buf, "name") == 0) {
|
||||
if (strcmp(buf, "name") == EQUAL) {
|
||||
obj->data.top.type = TOP_NAME;
|
||||
} else if (strcmp(buf, "cpu") == 0) {
|
||||
} else if (strcmp(buf, "cpu") == EQUAL) {
|
||||
obj->data.top.type = TOP_CPU;
|
||||
} else if (strcmp(buf, "pid") == 0) {
|
||||
} else if (strcmp(buf, "pid") == EQUAL) {
|
||||
obj->data.top.type = TOP_PID;
|
||||
} else if (strcmp(buf, "mem") == 0) {
|
||||
} else if (strcmp(buf, "mem") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM;
|
||||
} else if (strcmp(buf, "time") == 0) {
|
||||
} else if (strcmp(buf, "time") == EQUAL) {
|
||||
obj->data.top.type = TOP_TIME;
|
||||
} else if (strcmp(buf, "mem_res") == 0) {
|
||||
} else if (strcmp(buf, "mem_res") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM_RES;
|
||||
} else if (strcmp(buf, "mem_vsize") == 0) {
|
||||
} else if (strcmp(buf, "mem_vsize") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM_VSIZE;
|
||||
} else {
|
||||
ERR("invalid arg for top");
|
||||
@ -3084,19 +3128,19 @@ static struct text_object *construct_text_object(const char *s,
|
||||
return NULL;
|
||||
}
|
||||
if (sscanf(arg, "%63s %i", buf, &n) == 2) {
|
||||
if (strcmp(buf, "name") == 0) {
|
||||
if (strcmp(buf, "name") == EQUAL) {
|
||||
obj->data.top.type = TOP_NAME;
|
||||
} else if (strcmp(buf, "cpu") == 0) {
|
||||
} else if (strcmp(buf, "cpu") == EQUAL) {
|
||||
obj->data.top.type = TOP_CPU;
|
||||
} else if (strcmp(buf, "pid") == 0) {
|
||||
} else if (strcmp(buf, "pid") == EQUAL) {
|
||||
obj->data.top.type = TOP_PID;
|
||||
} else if (strcmp(buf, "mem") == 0) {
|
||||
} else if (strcmp(buf, "mem") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM;
|
||||
} else if (strcmp(buf, "time") == 0) {
|
||||
} else if (strcmp(buf, "time") == EQUAL) {
|
||||
obj->data.top.type = TOP_TIME;
|
||||
} else if (strcmp(buf, "mem_res") == 0) {
|
||||
} else if (strcmp(buf, "mem_res") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM_RES;
|
||||
} else if (strcmp(buf, "mem_vsize") == 0) {
|
||||
} else if (strcmp(buf, "mem_vsize") == EQUAL) {
|
||||
obj->data.top.type = TOP_MEM_VSIZE;
|
||||
} else {
|
||||
ERR("invalid arg for top");
|
||||
@ -3292,6 +3336,18 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
/* asumming all else worked */
|
||||
obj->data.tail.buffer = malloc(text_buffer_size * 20);
|
||||
END OBJ(lines, 0)
|
||||
if (arg) {
|
||||
obj->data.s = strdup(arg);
|
||||
}else{
|
||||
CRIT_ERR("lines needs a argument");
|
||||
}
|
||||
END OBJ(words, 0)
|
||||
if (arg) {
|
||||
obj->data.s = strdup(arg);
|
||||
}else{
|
||||
CRIT_ERR("words needs a argument");
|
||||
}
|
||||
END OBJ(loadavg, INFO_LOADAVG)
|
||||
int a = 1, b = 2, c = 3, r = 3;
|
||||
|
||||
@ -3406,13 +3462,15 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.mboxscan.output[0] = 1;
|
||||
strncpy(obj->data.mboxscan.args, arg, text_buffer_size);
|
||||
END OBJ(mem, INFO_MEM)
|
||||
END OBJ(memeasyfree, INFO_MEM)
|
||||
END OBJ(memfree, INFO_MEM)
|
||||
END OBJ(memmax, INFO_MEM)
|
||||
END OBJ(memperc, INFO_MEM)
|
||||
END OBJ(membar, INFO_MEM)
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(memgraph, INFO_MEM)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
free(buf);
|
||||
@ -3432,6 +3490,10 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(mixerrbar, INFO_MIXER)
|
||||
scan_mixer_bar(arg, &obj->data.mixerbar.l, &obj->data.mixerbar.w,
|
||||
&obj->data.mixerbar.h);
|
||||
#ifdef X11
|
||||
END OBJ(monitor, INFO_X11)
|
||||
END OBJ(monitor_number, INFO_X11)
|
||||
#endif
|
||||
END OBJ(new_mails, 0)
|
||||
float n1;
|
||||
char box[256], dst[256];
|
||||
@ -3580,7 +3642,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
|
||||
END OBJ(upspeedgraph, INFO_NET)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e);
|
||||
&obj->e, &obj->showaslog);
|
||||
|
||||
if (buf) {
|
||||
obj->data.net = get_net_stat(buf);
|
||||
@ -3818,23 +3880,23 @@ static struct text_object *construct_text_object(const char *s,
|
||||
if (port_begin > port_end) {
|
||||
CRIT_ERR("tcp_portmon: starting port must be <= ending port");
|
||||
}
|
||||
if (strncmp(itembuf, "count", 31) == 0) {
|
||||
if (strncmp(itembuf, "count", 31) == EQUAL) {
|
||||
item = COUNT;
|
||||
} else if (strncmp(itembuf, "rip", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "rip", 31) == EQUAL) {
|
||||
item = REMOTEIP;
|
||||
} else if (strncmp(itembuf, "rhost", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "rhost", 31) == EQUAL) {
|
||||
item = REMOTEHOST;
|
||||
} else if (strncmp(itembuf, "rport", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "rport", 31) == EQUAL) {
|
||||
item = REMOTEPORT;
|
||||
} else if (strncmp(itembuf, "rservice", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "rservice", 31) == EQUAL) {
|
||||
item = REMOTESERVICE;
|
||||
} else if (strncmp(itembuf, "lip", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "lip", 31) == EQUAL) {
|
||||
item = LOCALIP;
|
||||
} else if (strncmp(itembuf, "lhost", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "lhost", 31) == EQUAL) {
|
||||
item = LOCALHOST;
|
||||
} else if (strncmp(itembuf, "lport", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "lport", 31) == EQUAL) {
|
||||
item = LOCALPORT;
|
||||
} else if (strncmp(itembuf, "lservice", 31) == 0) {
|
||||
} else if (strncmp(itembuf, "lservice", 31) == EQUAL) {
|
||||
item = LOCALSERVICE;
|
||||
} else {
|
||||
CRIT_ERR("tcp_portmon: invalid item specified");
|
||||
@ -3885,6 +3947,14 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(entropy_poolsize, INFO_ENTROPY)
|
||||
END OBJ(entropy_bar, INFO_ENTROPY)
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
END OBJ(scroll, 0)
|
||||
int n;
|
||||
if (arg && sscanf(arg, "%u %n", &obj->data.scroll.show, &n) > 0) {
|
||||
obj->data.scroll.text = strndup(arg + n, text_buffer_size);
|
||||
obj->data.scroll.start = 0;
|
||||
} else {
|
||||
CRIT_ERR("scroll needs arguments: <length> <text>");
|
||||
}
|
||||
#ifdef NVIDIA
|
||||
END OBJ(nvidia, 0)
|
||||
if (!arg){
|
||||
@ -4523,11 +4593,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(cpugraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d, (unsigned int)
|
||||
round_to_int(cur->cpu_usage[obj->data.cpu_index] * 100),
|
||||
100, 1);
|
||||
100, 1, obj->showaslog);
|
||||
}
|
||||
OBJ(loadgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d, cur->loadavg[0],
|
||||
obj->e, 1);
|
||||
obj->e, 1, obj->showaslog);
|
||||
}
|
||||
OBJ(color) {
|
||||
new_fg(p, obj->data.l);
|
||||
@ -4754,28 +4824,28 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(diskiograph) {
|
||||
if (obj->data.diskio) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.diskio->current, obj->e, 1);
|
||||
obj->data.diskio->current, obj->e, 1, obj->showaslog);
|
||||
} else {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d, info.diskio_value,
|
||||
obj->e, 1);
|
||||
obj->e, 1, obj->showaslog);
|
||||
}
|
||||
}
|
||||
OBJ(diskiograph_read) {
|
||||
if (obj->data.diskio) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.diskio->current_read, obj->e, 1);
|
||||
obj->data.diskio->current_read, obj->e, 1, obj->showaslog);
|
||||
} else {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
info.diskio_read_value, obj->e, 1);
|
||||
info.diskio_read_value, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
}
|
||||
OBJ(diskiograph_write) {
|
||||
if (obj->data.diskio) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.diskio->current_write, obj->e, 1);
|
||||
obj->data.diskio->current_write, obj->e, 1, obj->showaslog);
|
||||
} else {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
info.diskio_write_value, obj->e, 1);
|
||||
info.diskio_write_value, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
}
|
||||
OBJ(downspeed) {
|
||||
@ -4788,7 +4858,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
OBJ(downspeedgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.net->recv_speed / 1024.0, obj->e, 1);
|
||||
obj->data.net->recv_speed / 1024.0, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
OBJ(else) {
|
||||
if (!if_jumped) {
|
||||
@ -4890,14 +4960,22 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
}
|
||||
OBJ(execgraph) {
|
||||
char showaslog = FALSE;
|
||||
double barnum;
|
||||
|
||||
read_exec(obj->data.s, p, p_max_size);
|
||||
if(strncasecmp(obj->data.s, LOGGRAPH" ", strlen(LOGGRAPH" ")) == EQUAL) {
|
||||
showaslog = TRUE;
|
||||
read_exec(obj->data.s + strlen(LOGGRAPH" ") * sizeof(char), p, p_max_size);
|
||||
} else if(strncasecmp(obj->data.s, NORMGRAPH" ", strlen(NORMGRAPH" ")) == EQUAL) {
|
||||
read_exec(obj->data.s + strlen(NORMGRAPH" ") * sizeof(char), p, p_max_size);
|
||||
} else {
|
||||
read_exec(obj->data.s, p, p_max_size);
|
||||
}
|
||||
barnum = get_barnum(p);
|
||||
|
||||
if (barnum >= 0.0) {
|
||||
new_graph(p, 0, 25, obj->c, obj->d, round_to_int(barnum),
|
||||
100, 1);
|
||||
100, 1, showaslog);
|
||||
}
|
||||
}
|
||||
OBJ(execibar) {
|
||||
@ -4928,7 +5006,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
obj->data.execi.last_update = current_update_time;
|
||||
}
|
||||
new_graph(p, 0, 25, obj->c, obj->d, round_to_int(obj->f), 100, 0);
|
||||
new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f), 100, 1, FALSE);
|
||||
}
|
||||
OBJ(execi) {
|
||||
if (current_update_time - obj->data.execi.last_update
|
||||
@ -5130,14 +5208,14 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
if (data == NULL) {
|
||||
snprintf(p, p_max_size, "prss: Error reading RSS data\n");
|
||||
} else {
|
||||
if (!strcmp(obj->data.rss.action, "feed_title")) {
|
||||
if (strcmp(obj->data.rss.action, "feed_title") == EQUAL) {
|
||||
str = data->title;
|
||||
// remove trailing new line if one exists
|
||||
if (str[strlen(str) - 1] == '\n') {
|
||||
str[strlen(str) - 1] = 0;
|
||||
}
|
||||
snprintf(p, p_max_size, "%s", str);
|
||||
} else if (!strcmp(obj->data.rss.action, "item_title")) {
|
||||
} else if (strcmp(obj->data.rss.action, "item_title") == EQUAL) {
|
||||
if (obj->data.rss.act_par < data->item_count) {
|
||||
str = data->items[obj->data.rss.act_par].title;
|
||||
// remove trailing new line if one exists
|
||||
@ -5146,7 +5224,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
snprintf(p, p_max_size, "%s", str);
|
||||
}
|
||||
} else if (!strcmp(obj->data.rss.action, "item_desc")) {
|
||||
} else if (strcmp(obj->data.rss.action, "item_desc") == EQUAL) {
|
||||
if (obj->data.rss.act_par < data->item_count) {
|
||||
str =
|
||||
data->items[obj->data.rss.act_par].description;
|
||||
@ -5156,7 +5234,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
snprintf(p, p_max_size, "%s", str);
|
||||
}
|
||||
} else if (!strcmp(obj->data.rss.action, "item_titles")) {
|
||||
} else if (strcmp(obj->data.rss.action, "item_titles") == EQUAL) {
|
||||
if (data->item_count > 0) {
|
||||
int itmp;
|
||||
int show;
|
||||
@ -5333,6 +5411,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(mem) {
|
||||
human_readable(cur->mem * 1024, p, 255, "mem");
|
||||
}
|
||||
OBJ(memeasyfree) {
|
||||
human_readable(cur->memeasyfree * 1024, p, 255, "memeasyfree");
|
||||
}
|
||||
OBJ(memfree) {
|
||||
human_readable(cur->memfree * 1024, p, 255, "memfree");
|
||||
}
|
||||
OBJ(memmax) {
|
||||
human_readable(cur->memmax * 1024, p, 255, "memmax");
|
||||
}
|
||||
@ -5349,7 +5433,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(memgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
cur->memmax ? (cur->mem * 100.0) / (cur->memmax) : 0.0,
|
||||
100, 1);
|
||||
100, 1, obj->showaslog);
|
||||
}
|
||||
|
||||
/* mixer stuff */
|
||||
@ -5374,6 +5458,14 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_bar(p, obj->data.mixerbar.w, obj->data.mixerbar.h,
|
||||
mixer_get_right(obj->data.mixerbar.l) * 255 / 100);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(monitor) {
|
||||
snprintf(p, p_max_size, "%d", cur->x11.monitor.current);
|
||||
}
|
||||
OBJ(monitor_number) {
|
||||
snprintf(p, p_max_size, "%d", cur->x11.monitor.number);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* mail stuff */
|
||||
OBJ(mails) {
|
||||
@ -5487,7 +5579,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
OBJ(upspeedgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.net->trans_speed / 1024.0, obj->e, 1);
|
||||
obj->data.net->trans_speed / 1024.0, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
OBJ(uptime_short) {
|
||||
format_seconds_short(p, p_max_size, (int) cur->uptime);
|
||||
@ -5971,6 +6063,55 @@ head:
|
||||
// parse_conky_vars(obj->data.tail.buffer, p, cur);
|
||||
}
|
||||
|
||||
OBJ(lines) {
|
||||
FILE *fp = fopen(obj->data.s,"r");
|
||||
|
||||
if(fp != NULL) {
|
||||
char buf[BUFSZ];
|
||||
int j, lines;
|
||||
|
||||
lines = 0;
|
||||
while(fgets(buf, BUFSZ, fp) != NULL){
|
||||
for(j = 0; buf[j] != 0; j++) {
|
||||
if(buf[j] == '\n') {
|
||||
lines++;
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(p, "%d", lines);
|
||||
fclose(fp);
|
||||
} else {
|
||||
sprintf(p, "File Unreadable");
|
||||
}
|
||||
}
|
||||
|
||||
OBJ(words) {
|
||||
FILE *fp = fopen(obj->data.s,"r");
|
||||
|
||||
if(fp != NULL) {
|
||||
char buf[BUFSZ];
|
||||
int j, words;
|
||||
char inword = FALSE;
|
||||
|
||||
words = 0;
|
||||
while(fgets(buf, BUFSZ, fp) != NULL){
|
||||
for(j = 0; buf[j] != 0; j++) {
|
||||
if(!isspace(buf[j])) {
|
||||
if(inword == FALSE) {
|
||||
words++;
|
||||
inword = TRUE;
|
||||
}
|
||||
} else {
|
||||
inword = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(p, "%d", words);
|
||||
fclose(fp);
|
||||
} else {
|
||||
sprintf(p, "File Unreadable");
|
||||
}
|
||||
}
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
OBJ(tcp_portmon) {
|
||||
/* grab a pointer to this port monitor */
|
||||
@ -6056,6 +6197,37 @@ head:
|
||||
new_bar(p, obj->a, obj->b, 0);
|
||||
}
|
||||
#endif /* SMAPI */
|
||||
OBJ(scroll) {
|
||||
unsigned int j;
|
||||
char *tmp;
|
||||
parse_conky_vars(obj->data.scroll.text, p, cur);
|
||||
#define LINESEPARATOR '|'
|
||||
//place all the lines behind each other with LINESEPARATOR between them
|
||||
for(j = 0; p[j] != 0; j++) {
|
||||
if(p[j]=='\n') {
|
||||
p[j]=LINESEPARATOR;
|
||||
}
|
||||
}
|
||||
//scroll the output obj->data.scroll.start places by copying that many chars from
|
||||
//the front of the string to tmp, scrolling the rest to the front and placing tmp
|
||||
//at the back of the string
|
||||
tmp = calloc(obj->data.scroll.start + 1, sizeof(char));
|
||||
strncpy(tmp, p, obj->data.scroll.start); tmp[obj->data.scroll.start] = 0;
|
||||
for(j = obj->data.scroll.start; p[j] != 0; j++){
|
||||
p[j - obj->data.scroll.start] = p[j];
|
||||
}
|
||||
strcpy(&p[j - obj->data.scroll.start], tmp);
|
||||
free(tmp);
|
||||
//only show the requested number of chars
|
||||
if(obj->data.scroll.show < j) {
|
||||
p[obj->data.scroll.show] = 0;
|
||||
}
|
||||
//next time, scroll a place more or reset scrolling if we are at the end
|
||||
obj->data.scroll.start++;
|
||||
if(obj->data.scroll.start == j){
|
||||
obj->data.scroll.start = 0;
|
||||
}
|
||||
}
|
||||
#ifdef NVIDIA
|
||||
OBJ(nvidia) {
|
||||
int hol = (strcmp((char*)&obj->data.nvidia.arg, "gpufreq")) ? 1 : 0;
|
||||
@ -6414,7 +6586,7 @@ static void draw_string(const char *s)
|
||||
}
|
||||
|
||||
width_of_s = get_string_width(s);
|
||||
if (out_to_console && draw_mode == FG) {
|
||||
if ((output_methods & TO_STDOUT) && draw_mode == FG) {
|
||||
printf("%s\n", s);
|
||||
fflush(stdout); /* output immediately, don't buffer */
|
||||
}
|
||||
@ -6714,8 +6886,6 @@ static void draw_line(char *s)
|
||||
float gradient_update = 0;
|
||||
unsigned long last_colour = current_color;
|
||||
unsigned long tmpcolour = current_color;
|
||||
int show_scale_x = cur_x + font_ascent() / 2;
|
||||
int show_scale_y = cur_y + font_height() / 2;
|
||||
if (cur_x - text_start_x > maximum_width
|
||||
&& maximum_width > 0) {
|
||||
break;
|
||||
@ -6783,11 +6953,56 @@ static void draw_line(char *s)
|
||||
} else {
|
||||
set_foreground_color(default_fg_color);
|
||||
} */
|
||||
if (show_graph_range) {
|
||||
int tmp_x = cur_x;
|
||||
int tmp_y = cur_y;
|
||||
unsigned short int seconds = update_interval * w;
|
||||
char *tmp_day_str;
|
||||
char *tmp_hour_str;
|
||||
char *tmp_min_str;
|
||||
char *tmp_sec_str;
|
||||
unsigned short int timeunits;
|
||||
if(seconds!=0){
|
||||
timeunits = seconds / 86400; seconds %= 86400;
|
||||
if( timeunits > 0 ) {
|
||||
asprintf(&tmp_day_str, "%dd", timeunits);
|
||||
}else{
|
||||
tmp_day_str = strdup("");
|
||||
}
|
||||
timeunits = seconds / 3600; seconds %= 3600;
|
||||
if( timeunits > 0 ) {
|
||||
asprintf(&tmp_hour_str, "%dh", timeunits);
|
||||
}else{
|
||||
tmp_hour_str = strdup("");
|
||||
}
|
||||
timeunits = seconds / 60; seconds %= 60;
|
||||
if(timeunits > 0) {
|
||||
asprintf(&tmp_min_str, "%dm", timeunits);
|
||||
}else{
|
||||
tmp_min_str = strdup("");
|
||||
}
|
||||
if(seconds > 0) {
|
||||
asprintf(&tmp_sec_str, "%ds", seconds);
|
||||
}else{
|
||||
tmp_sec_str = strdup("");
|
||||
}
|
||||
asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, tmp_hour_str, tmp_min_str, tmp_sec_str);
|
||||
free(tmp_day_str); free(tmp_hour_str); free(tmp_min_str); free(tmp_sec_str);
|
||||
}else{
|
||||
asprintf(&tmp_str, "Range not possible"); //should never happen, but better safe then sorry
|
||||
}
|
||||
cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2));
|
||||
cur_y += font_height() / 2;
|
||||
draw_string(tmp_str);
|
||||
free(tmp_str);
|
||||
cur_x = tmp_x;
|
||||
cur_y = tmp_y;
|
||||
}
|
||||
if (show_graph_scale && (specials[special_index].show_scale == 1)) {
|
||||
int tmp_x = cur_x;
|
||||
int tmp_y = cur_y;
|
||||
cur_x = show_scale_x;
|
||||
cur_y = show_scale_y;
|
||||
cur_x += font_ascent() / 2;
|
||||
cur_y += font_height() / 2;
|
||||
tmp_str = (char *)
|
||||
calloc(log10(floor(specials[special_index].graph_scale)) + 4,
|
||||
sizeof(char));
|
||||
@ -7556,11 +7771,11 @@ static int string_to_bool(const char *s)
|
||||
if (!s) {
|
||||
// Assumes an option without a true/false means true
|
||||
return 1;
|
||||
} else if (strcasecmp(s, "yes") == 0) {
|
||||
} else if (strcasecmp(s, "yes") == EQUAL) {
|
||||
return 1;
|
||||
} else if (strcasecmp(s, "true") == 0) {
|
||||
} else if (strcasecmp(s, "true") == EQUAL) {
|
||||
return 1;
|
||||
} else if (strcasecmp(s, "1") == 0) {
|
||||
} else if (strcasecmp(s, "1") == EQUAL) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -7569,39 +7784,39 @@ static int string_to_bool(const char *s)
|
||||
#ifdef X11
|
||||
static enum alignment string_to_alignment(const char *s)
|
||||
{
|
||||
if (strcasecmp(s, "top_left") == 0) {
|
||||
if (strcasecmp(s, "top_left") == EQUAL) {
|
||||
return TOP_LEFT;
|
||||
} else if (strcasecmp(s, "top_right") == 0) {
|
||||
} else if (strcasecmp(s, "top_right") == EQUAL) {
|
||||
return TOP_RIGHT;
|
||||
} else if (strcasecmp(s, "top_middle") == 0) {
|
||||
} else if (strcasecmp(s, "top_middle") == EQUAL) {
|
||||
return TOP_MIDDLE;
|
||||
} else if (strcasecmp(s, "bottom_left") == 0) {
|
||||
} else if (strcasecmp(s, "bottom_left") == EQUAL) {
|
||||
return BOTTOM_LEFT;
|
||||
} else if (strcasecmp(s, "bottom_right") == 0) {
|
||||
} else if (strcasecmp(s, "bottom_right") == EQUAL) {
|
||||
return BOTTOM_RIGHT;
|
||||
} else if (strcasecmp(s, "bottom_middle") == 0) {
|
||||
} else if (strcasecmp(s, "bottom_middle") == EQUAL) {
|
||||
return BOTTOM_MIDDLE;
|
||||
} else if (strcasecmp(s, "middle_left") == 0) {
|
||||
} else if (strcasecmp(s, "middle_left") == EQUAL) {
|
||||
return MIDDLE_LEFT;
|
||||
} else if (strcasecmp(s, "middle_right") == 0) {
|
||||
} else if (strcasecmp(s, "middle_right") == EQUAL) {
|
||||
return MIDDLE_RIGHT;
|
||||
} else if (strcasecmp(s, "tl") == 0) {
|
||||
} else if (strcasecmp(s, "tl") == EQUAL) {
|
||||
return TOP_LEFT;
|
||||
} else if (strcasecmp(s, "tr") == 0) {
|
||||
} else if (strcasecmp(s, "tr") == EQUAL) {
|
||||
return TOP_RIGHT;
|
||||
} else if (strcasecmp(s, "tm") == 0) {
|
||||
} else if (strcasecmp(s, "tm") == EQUAL) {
|
||||
return TOP_MIDDLE;
|
||||
} else if (strcasecmp(s, "bl") == 0) {
|
||||
} else if (strcasecmp(s, "bl") == EQUAL) {
|
||||
return BOTTOM_LEFT;
|
||||
} else if (strcasecmp(s, "br") == 0) {
|
||||
} else if (strcasecmp(s, "br") == EQUAL) {
|
||||
return BOTTOM_RIGHT;
|
||||
} else if (strcasecmp(s, "bm") == 0) {
|
||||
} else if (strcasecmp(s, "bm") == EQUAL) {
|
||||
return BOTTOM_MIDDLE;
|
||||
} else if (strcasecmp(s, "ml") == 0) {
|
||||
} else if (strcasecmp(s, "ml") == EQUAL) {
|
||||
return MIDDLE_LEFT;
|
||||
} else if (strcasecmp(s, "mr") == 0) {
|
||||
} else if (strcasecmp(s, "mr") == EQUAL) {
|
||||
return MIDDLE_RIGHT;
|
||||
} else if (strcasecmp(s, "none") == 0) {
|
||||
} else if (strcasecmp(s, "none") == EQUAL) {
|
||||
return NONE;
|
||||
}
|
||||
return TOP_LEFT;
|
||||
@ -7643,12 +7858,13 @@ static void set_default_configurations(void)
|
||||
#endif
|
||||
use_spacer = NO_SPACER;
|
||||
#ifdef X11
|
||||
out_to_console = 0;
|
||||
output_methods = TO_X;
|
||||
#else
|
||||
out_to_console = 1;
|
||||
output_methods = TO_STDOUT;
|
||||
#endif
|
||||
#ifdef X11
|
||||
show_graph_scale = 0;
|
||||
show_graph_range = 0;
|
||||
default_fg_color = WhitePixel(display, screen);
|
||||
default_bg_color = BlackPixel(display, screen);
|
||||
default_out_color = BlackPixel(display, screen);
|
||||
@ -7684,6 +7900,8 @@ static void set_default_configurations(void)
|
||||
border_margin = 3;
|
||||
border_width = 1;
|
||||
text_alignment = BOTTOM_LEFT;
|
||||
info.x11.monitor.number = 1;
|
||||
info.x11.monitor.current = 0;
|
||||
#endif /* X11 */
|
||||
|
||||
free(current_mail_spool);
|
||||
@ -7804,6 +8022,9 @@ static void load_config_file(const char *f)
|
||||
CONF("show_graph_scale") {
|
||||
show_graph_scale = string_to_bool(value);
|
||||
}
|
||||
CONF("show_graph_range") {
|
||||
show_graph_range = string_to_bool(value);
|
||||
}
|
||||
CONF("border_margin") {
|
||||
if (value) {
|
||||
border_margin = strtol(value, 0, 0);
|
||||
@ -8012,15 +8233,15 @@ static void load_config_file(const char *f)
|
||||
}
|
||||
#endif /* X11 */
|
||||
CONF("out_to_console") {
|
||||
out_to_console = string_to_bool(value);
|
||||
if(string_to_bool(value)) output_methods |= TO_STDOUT;
|
||||
}
|
||||
CONF("use_spacer") {
|
||||
if (value) {
|
||||
if (strcasecmp(value, "left") == 0) {
|
||||
if (strcasecmp(value, "left") == EQUAL) {
|
||||
use_spacer = LEFT_SPACER;
|
||||
} else if (strcasecmp(value, "right") == 0) {
|
||||
} else if (strcasecmp(value, "right") == EQUAL) {
|
||||
use_spacer = RIGHT_SPACER;
|
||||
} else if (strcasecmp(value, "none") == 0) {
|
||||
} else if (strcasecmp(value, "none") == EQUAL) {
|
||||
use_spacer = NO_SPACER;
|
||||
} else {
|
||||
use_spacer = string_to_bool(value);
|
||||
@ -8200,17 +8421,17 @@ static void load_config_file(const char *f)
|
||||
if ((p_hint = strtok_r(value, delim, &p_save)) != NULL) {
|
||||
do {
|
||||
/* fprintf(stderr, "hint [%s] parsed\n", p_hint); */
|
||||
if (strncmp(p_hint, "undecorate", 10) == 0) {
|
||||
if (strncmp(p_hint, "undecorate", 10) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_UNDECORATED);
|
||||
} else if (strncmp(p_hint, "below", 5) == 0) {
|
||||
} else if (strncmp(p_hint, "below", 5) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_BELOW);
|
||||
} else if (strncmp(p_hint, "above", 5) == 0) {
|
||||
} else if (strncmp(p_hint, "above", 5) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_ABOVE);
|
||||
} else if (strncmp(p_hint, "sticky", 6) == 0) {
|
||||
} else if (strncmp(p_hint, "sticky", 6) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_STICKY);
|
||||
} else if (strncmp(p_hint, "skip_taskbar", 12) == 0) {
|
||||
} else if (strncmp(p_hint, "skip_taskbar", 12) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_SKIP_TASKBAR);
|
||||
} else if (strncmp(p_hint, "skip_pager", 10) == 0) {
|
||||
} else if (strncmp(p_hint, "skip_pager", 10) == EQUAL) {
|
||||
SET_HINT(window.hints, HINT_SKIP_PAGER);
|
||||
} else {
|
||||
CONF_ERR;
|
||||
@ -8225,13 +8446,13 @@ static void load_config_file(const char *f)
|
||||
}
|
||||
CONF("own_window_type") {
|
||||
if (value) {
|
||||
if (strncmp(value, "normal", 6) == 0) {
|
||||
if (strncmp(value, "normal", 6) == EQUAL) {
|
||||
window.type = TYPE_NORMAL;
|
||||
} else if (strncmp(value, "desktop", 7) == 0) {
|
||||
} else if (strncmp(value, "desktop", 7) == EQUAL) {
|
||||
window.type = TYPE_DESKTOP;
|
||||
} else if (strncmp(value, "dock", 7) == 0) {
|
||||
} else if (strncmp(value, "dock", 7) == EQUAL) {
|
||||
window.type = TYPE_DOCK;
|
||||
} else if (strncmp(value, "override", 8) == 0) {
|
||||
} else if (strncmp(value, "override", 8) == EQUAL) {
|
||||
window.type = TYPE_OVERRIDE;
|
||||
} else {
|
||||
CONF_ERR;
|
||||
@ -8355,11 +8576,11 @@ static void load_config_file(const char *f)
|
||||
if (!value) {
|
||||
ERR("incorrect if_up_strictness value, defaulting to 'up'");
|
||||
ifup_strictness = IFUP_UP;
|
||||
} else if (!strcmp(value, "up")) {
|
||||
} else if (strcasecmp(value, "up") == EQUAL) {
|
||||
ifup_strictness = IFUP_UP;
|
||||
} else if (!strcmp(value, "link")) {
|
||||
} else if (strcasecmp(value, "link") == EQUAL) {
|
||||
ifup_strictness = IFUP_LINK;
|
||||
} else if (!strcmp(value, "address")) {
|
||||
} else if (strcasecmp(value, "address") == EQUAL) {
|
||||
ifup_strictness = IFUP_ADDR;
|
||||
} else {
|
||||
ERR("incorrect if_up_strictness value, defaulting to 'up'");
|
||||
@ -8727,9 +8948,7 @@ int main(int argc, char **argv)
|
||||
|
||||
selected_font = 0;
|
||||
update_text_area(); /* to position text/window on screen */
|
||||
#endif /* X11 */
|
||||
|
||||
#ifdef X11
|
||||
#ifdef OWN_WINDOW
|
||||
if (own_window && !fixed_pos) {
|
||||
XMoveWindow(display, window.window, window.x, window.y);
|
||||
|
34
src/conky.h
34
src/conky.h
@ -34,6 +34,8 @@
|
||||
#include <mcheck.h>
|
||||
#endif /* HAS_MCHECK_H */
|
||||
|
||||
#define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
|
||||
|
||||
#include "config.h"
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
@ -197,6 +199,17 @@ struct gateway_info {
|
||||
int count;
|
||||
};
|
||||
|
||||
#ifdef X11
|
||||
struct monitor_info {
|
||||
int number;
|
||||
int current;
|
||||
};
|
||||
|
||||
struct x11_info {
|
||||
struct monitor_info monitor;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "libtcp-portmon.h"
|
||||
#endif
|
||||
@ -244,10 +257,13 @@ enum {
|
||||
#endif
|
||||
INFO_USERS = 26,
|
||||
INFO_GW = 27,
|
||||
INFO_DNS = 28
|
||||
#ifdef NVIDIA
|
||||
, INFO_NVIDIA = 29
|
||||
INFO_NVIDIA = 28,
|
||||
#endif
|
||||
#ifdef X11
|
||||
INFO_X11 = 29,
|
||||
#endif
|
||||
INFO_DNS = 30
|
||||
|
||||
};
|
||||
|
||||
@ -279,7 +295,7 @@ struct information {
|
||||
double uptime;
|
||||
|
||||
/* memory information in kilobytes */
|
||||
unsigned long long mem, memmax, swap, swapmax;
|
||||
unsigned long long mem, memeasyfree, memfree, memmax, swap, swapmax;
|
||||
unsigned long long bufmem, buffers, cached;
|
||||
|
||||
unsigned short procs;
|
||||
@ -325,6 +341,10 @@ struct information {
|
||||
struct entropy_s entropy;
|
||||
double music_player_interval;
|
||||
|
||||
#ifdef X11
|
||||
struct x11_info x11;
|
||||
#endif
|
||||
|
||||
short kflags; /* kernel settings, see enum KFLAG */
|
||||
|
||||
unsigned int diskio_value;
|
||||
@ -347,7 +367,9 @@ enum {
|
||||
#define KFLAG_FLIP(a) info.kflags ^= a
|
||||
#define KFLAG_ISSET(a) info.kflags & a
|
||||
|
||||
int out_to_console;
|
||||
#define TO_X 1
|
||||
#define TO_STDOUT 2
|
||||
int output_methods;
|
||||
|
||||
int top_cpu;
|
||||
int top_mem;
|
||||
@ -385,6 +407,10 @@ void free_dns_data(void);
|
||||
void update_dns_data(void);
|
||||
void update_users(void);
|
||||
|
||||
#ifdef X11
|
||||
void update_x11info(void);
|
||||
#endif
|
||||
|
||||
void update_stuff(void);
|
||||
|
||||
int round_to_int(float f);
|
||||
|
@ -165,6 +165,7 @@ void update_meminfo()
|
||||
|
||||
info.memmax = total_pages * (pagesize >> 10);
|
||||
info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10);
|
||||
info.memeasyfree = info.memfree = info.memmax - info.mem;
|
||||
|
||||
if ((swapmode(&swap_avail, &swap_free)) >= 0) {
|
||||
info.swapmax = swap_avail;
|
||||
|
@ -132,7 +132,7 @@ void update_meminfo(void)
|
||||
char buf[256];
|
||||
|
||||
info.mem = info.memmax = info.swap = info.swapmax = info.bufmem =
|
||||
info.buffers = info.cached = 0;
|
||||
info.buffers = info.cached = info.memfree = info.memeasyfree = 0;
|
||||
|
||||
if (!(meminfo_fp = open_file("/proc/meminfo", &rep))) {
|
||||
return;
|
||||
@ -146,7 +146,7 @@ void update_meminfo(void)
|
||||
if (strncmp(buf, "MemTotal:", 9) == 0) {
|
||||
sscanf(buf, "%*s %llu", &info.memmax);
|
||||
} else if (strncmp(buf, "MemFree:", 8) == 0) {
|
||||
sscanf(buf, "%*s %llu", &info.mem);
|
||||
sscanf(buf, "%*s %llu", &info.memfree);
|
||||
} else if (strncmp(buf, "SwapTotal:", 10) == 0) {
|
||||
sscanf(buf, "%*s %llu", &info.swapmax);
|
||||
} else if (strncmp(buf, "SwapFree:", 9) == 0) {
|
||||
@ -158,7 +158,8 @@ void update_meminfo(void)
|
||||
}
|
||||
}
|
||||
|
||||
info.mem = info.memmax - info.mem;
|
||||
info.mem = info.memmax - info.memfree;
|
||||
info.memeasyfree = info.memfree;
|
||||
info.swap = info.swapmax - info.swap;
|
||||
|
||||
info.bufmem = info.cached + info.buffers;
|
||||
|
@ -119,9 +119,6 @@ void update_meminfo()
|
||||
struct uvmexp_sysctl uvmexp;
|
||||
size_t size = sizeof(uvmexp);
|
||||
|
||||
info.memmax = info.mem = 0;
|
||||
info.swapmax = info.swap = 0;
|
||||
|
||||
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) {
|
||||
warn("could not get memory info");
|
||||
return;
|
||||
@ -133,6 +130,7 @@ void update_meminfo()
|
||||
|
||||
info.memmax = (total_pages * pagesize) >> 10;
|
||||
info.mem = ((total_pages - free_pages - inactive_pages) * pagesize) >> 10;
|
||||
info.memeasyfree = info.memfree = info.memmax - info.mem;
|
||||
|
||||
if (swapmode(&swap_avail, &swap_free) >= 0) {
|
||||
info.swapmax = swap_avail;
|
||||
|
@ -175,6 +175,7 @@ void update_meminfo()
|
||||
|
||||
info.memmax = pagetok(vmtotal.t_rm) + pagetok(vmtotal.t_free);
|
||||
info.mem = pagetok(vmtotal.t_rm);
|
||||
info.memeasyfree = info.memfree = info.memmax - info.mem;
|
||||
|
||||
if ((swapmode(&swap_used, &swap_avail)) >= 0) {
|
||||
info.swapmax = swap_avail;
|
||||
|
@ -550,4 +550,10 @@ void create_gc(void)
|
||||
GCFunction | GCGraphicsExposures, &values);
|
||||
}
|
||||
|
||||
void update_x11info(void)
|
||||
{
|
||||
struct information *current_info = &info;
|
||||
current_info->x11.monitor.number = XScreenCount(display);
|
||||
current_info->x11.monitor.current = XDefaultScreen(display);
|
||||
}
|
||||
#endif /* X11 */
|
||||
|
Loading…
Reference in New Issue
Block a user