SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#6576 2013-11-07 16:25:37

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

I am currently playing with dzen and Conky and I have a few questions.

Is it possible to put conky behind tint? Everything I do, I either break Conky or it's always on top.

If the answer to the above question is no, is it possible to display .xbm icons in pure Conky? Or can I convert .xbm icons to a font I can use in Conky?

Cheers, mf.

Offline

Be excellent to each other!

#6577 2013-11-07 20:02:19

general_failure
New Member
Registered: 2013-11-06
Posts: 7

Re: Conky v1.9 Thread

Here is a conky I have been working on for my netbook. Mostly just stuff gathered from the forums over the years.


# conky configuration
# Settings
##############################################
background yes
use_xft yes
xftfont Liberation Sans:size=14
xftalpha 1
update_interval 2.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 360 1000
maximum_width 360
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color black
default_shade_color 000000
default_outline_color 828282
alignment top_right
gap_x 12
gap_y 56
no_buffers yes
text_buffer_size 1024
uppercase no
cpu_avg_samples 2
override_utf8_locale no
temperature_unit fahrenheit
##############################################
#  Output
##############################################
TEXT
$nodename has been up for $uptime
Kernel:${alignr}$kernel
Updates: ${execi 28800 ~/bin/numupdates.sh}
CPU Temp: ${hwmon 0 temp 1}F ${alignr}HDD Temp: ${execi 240 hddtemp --unit=F -n /dev/sda}F
CPU Utilization %: ${alignr}${cpu cpu0}%
${cpubar 4 cpu0}
Ram: ${alignr}$mem / $memmax ($memperc%)
${membar 4}
Swap: ${alignr}$swap / $swapmax ($swapperc%)
${swapbar 4}
Root: ${alignr}${fs_free /} / ${fs_size /} (${fs_free_perc /}%)
${fs_bar 4 /}
Home: ${alignr}${fs_free /home} / ${fs_size /home} (${fs_free_perc /home}%)
${fs_bar 4 /home}
Highest CPU $alignr CPU%    PID    MEM%
${top name 1}$alignr${top cpu 1}    ${top pid 1}     ${top mem 1}
${top name 2}$alignr${top cpu 2}    ${top pid 2}     ${top mem 2}
${top name 3}$alignr${top cpu 3}    ${top pid 3}     ${top mem 3}
${hr}
Highest MEM $alignr CPU%    MEM%
${top_mem name 1}$alignr${top_mem cpu 1}       ${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}       ${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}       ${top_mem mem 3}
${hr}
${if_existing /sys/class/net/eth0/operstate up}Eth0: ${addr eth0} ${alignr}U:${upspeed eth0} D:${downspeed eth0}${endif}
${if_existing /sys/class/net/wlan0/operstate up}Wlan0: ${addr wlan0} ${alignr}U:${upspeed wlan0} D:${downspeed wlan0}
SSID: ${wireless_essid wlan0} ${alignr}Quality: ${wireless_link_qual_perc wlan0}%
Public IP: ${alignr}${execi 10800 curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'}
Speedtest:
${texeci 3600 /home/james/speedtest_cli/speedtest-cli --simple}${endif}

                               \#!

The speedtest-cli python script is by Sivel from github
https://github.com/sivel/speedtest-cli

Last edited by general_failure (2013-11-16 00:24:39)


Abort, Retry, Fail?

Offline

#6578 2013-11-07 20:21:06

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mf wrote:

I am currently playing with dzen and Conky and I have a few questions.

Yes, you can put conky behind tint2 but then you don't see the conky:
2013_11_07_17_01_12_90x87_Sector11.jpg

.xbm icons ... are a no show, but GIMP can export them to .png or .jpg which you can use.  big_smile


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6579 2013-11-07 20:26:48

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

@mf

It should be possible to place the dzen2 bar with conky behind tint, or just place conky behind tint2. And yes, xbm icons can be placed in conky.

I assume you're using openbox - to get dzen2 behind tint, you will probably have to edit the rc.xml file and make a per app setting for dzen2 - more about that here.. You will need something like:

<application class="dzen2">
    <desktop>all</desktop>
    <layer>below</layer>
  </application>

in the appropriate section (near the end) of the rc.xml - make a backup of your rc.xml before editing it. You may also have to edit the strut policy for the tint2 bar in the tint2rc file to get it to work the way you want.

if you're using the conky window, in your conkyrc, above TEXT you should have a line like:

own_window_hints sticky,undecorated,below,skip_taskbar,skip_pager

make sure it is set "below" not "above"

You can use ${image <image info>} in your conkyrc to place the bitmap images. You specify the x,y coordinate in the conky window - read more about image in the conky documentation

Edit - sector11, xbm isn't supported? could have sworn I've used them; You're most likely correct; so mf will have to come up with the right image format.

Last edited by PackRat (2013-11-07 20:29:48)


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#6580 2013-11-07 20:32:43

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

New one on the right ----->>> 2013_11_07_17_25_15_1920x1080_Sector11.jpg

conky:

## killall conky && conky -c /media/5/Conky/S11_Vert.conky &

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_class Conky
own_window_title S11

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0 #255

minimum_size 120 0  ##820 260   ## width, height
maximum_width 120     ##820       ## width, usually a good idea to equal minimum width

#gap_x 0 # left-right
#gap_y 0 # up-down
gap_x 10 # left-right
gap_y 10 # up-down


alignment tr
##################################left#################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Liberation Sans:size=15
xftfont monofur:bold:size=11

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

### WARNING ### These do NOT play well with /media/5/Conky/LUA/draw-bg.lua ###
draw_shades yes #### <<<--- yes --- To see it easier on light screens.
default_shade_color 000000
draw_outline no #### <<<--- yes --- Amplifies text if yes OJO with changing fonts
default_outline_color 000000
uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
#default_shade_color black
#default_outline_color black

#default_color DCDCDC #220 220 220	Gainsboro
#default_color C0C0C0 #192 192 192 Silver
default_color B0E0E6 #176 224 230 PowderBlue
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 778899 #119 136 153	LightSlateGray
color2 D8BFD8 #216 191 216	Thistle
color3 9ACD32 #154 205  50	YellowGreen
color4 48D1CC # 72 209 204 MediumTurquoise
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 5F9EA0 # 95 158 160	CadetBlue
color8 BDB76B #189 183 107	DarkKhaki
color9 CD5C5C #205  92  92	IndianRed  #FF0000 #255   0   0	Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes
#default_graph_size 15 40

#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
 text_buffer_size 1536

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit

## Imlib2 image cache size, in bytes. Defaults to 4MiB. Increase this value
## if you use $image lots.		Set to 0 to disable the image cache.
imlib_cache_size 0

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or it blinks.
##
# lua_load ~/wea_conky/draw_bg.lua
## TEXT
## ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
##
## OR Both above TEXT (No composite manager required - no blinking!)
##
 lua_load /media/5/Conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 10 0 0 0 0 0xffffff 0.3
# TEXT

update_interval 1
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.3}${goto 45}${font monofur:bold:size=16}${color5}${time %b}${color}${font}
${execpi 7200 ncal -h | /media/5/Conky/scripts/ncal.awk}
${goto 40}${font monofur:bold:size=16}${color5}${time %Y}${color}${font}
${voffset -170}${color5}${goto 90}${font LED_mono:size=20}${time %H}

${goto 90}${time %M}

${goto 90}${time %S}${font}${color}${voffset 70}
${alignc}${uptime_short}
${alignc}${membar 0,110}
${alignc}${execi 86400 lsb_release -is} ${execi 86400 lsb_release -rs}
${alignc}${color5}${kernel}${color}

${alignc}CPU Info
${color5}${alignc}${membar 0,60}${color}
${alignc}CPU μm ${color5}${freq_g}${color}
${alignc}Avg ${if_match ${cpu cpu0}<10}${color1}00${color5}${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}${color5}0${color7}${cpu cpu0}\
${else}${color9}${cpu cpu0}${endif}${endif}${color5} %${color}
${alignc}${color5}1  ${color}|  ${color5}2  ${color}|  ${color5}3${color}
${alignc}${if_match ${cpu cpu1}<10}${color1}00${color5}${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}${color1}0${color7}${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}${color}\
 | ${if_match ${cpu cpu2}<10}${color1}00${color5}${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}${color1}0${color7}${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}${color}\
 | ${if_match ${cpu cpu3}<10}${color1}00${color5}${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}${color1}0${color7}${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}${color}

${alignc}Sensors
${color5}${alignc}${membar 0,50}${color}
CPU ${color5}${platform f71882fg.2560 temp 1}${color}°\
${alignr}MB ${color5}${platform f71882fg.2560 temp 2}${color}°
GPU ${color5}${nvidia temp}${color}°\
${alignr}HD ${color5}${hddtemp /dev/sda}${color}°
${alignc}Fan ${color5}${platform f71882fg.2560 fan 1} ${color}RPM

${alignc}NVIDIA Freq
${alignc}GPU ${color5}${nvidia gpufreq} ${color}MHz
${alignc}MEM ${color5}${nvidia memfreq} ${color}MHz

${alignc}Disk Activity
${color5}${alignc}${membar 0,90}${color}
Read   ${color5}${diskio_read /dev/sda}${color}
Write  ${color5}${diskio_write /dev/sda}${color}

/Root ${color5}${fs_size /}${color}
   Free  ${color5}${fs_free /}${color}
   Used  ${color5}${fs_used_perc /} %${color}
/Home ${color5}${fs_size /home}${color}
   Free  ${color5}${fs_free /home}${color}
   Used  ${color5}${fs_used_perc /home} %${color}
/M/5  ${color5}${fs_size /media/5}${color}
   Free  ${color5}${fs_free /media/5}${color}
   Used  ${color5}${fs_used_perc /media/5} %${color}

${alignc}Network Totals
${alignc}${color5}${membar 0,100}${color}
tx ↑ ${upspeed eth0}
${color0}rx ↓ ${downspeed eth0}${color}
${color5}${exec date --date="0 day" | awk '{print $3" "$2}'}${alignr}${execpi 300 vnstat | grep "today" | awk '{print $8" "$9}'}${color}
tx ↑${alignr}${execpi 300 vnstat | grep "today" | awk '{print $5" "$6}'}
${color0}rx ↓${alignr}${execpi 300 vnstat | grep "today" | awk '{print $2" "$3}'}${color}
${color5}${execpi 3600 date --date="-1 day" | awk '{print $3" "$2}'}${alignr}${execpi 300 vnstat | grep "yesterday" | awk '{print $8" "$9}'}${color}
tx ↑${alignr}${execpi 300 vnstat | grep "yesterday" | awk '{print $5" "$6}'}
${color0}rx ↓${alignr}${execpi 300 vnstat | grep "yesterday" | awk '{print $2" "$3}'}${color}
${color5}Curr Wk${alignr}${execpi 300 vnstat -w | grep "current week" | awk '{print $9" "$10}'}${color}
tx ↑${alignr}${execpi 300 vnstat -w | grep "current week" | awk '{print $6" "$7}'}
${color0}rx ↓${alignr}${execpi 300 vnstat -w | grep "current week" | awk '{print $3" "$4}'}${color}
${color5}${time %b %Y}${alignr}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'}${color}
tx ↑${alignr}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $6" "$7}'}
${color0}rx ↓${alignr}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $3" "$4}'}${voffset -170}

ncal.awk

#!/usr/bin/gawk -f
# based on: cal.C512.sh
# a bash script by Crinos512
#####################################################################
#                                                                   #
# ncal.awk script by dk75                                           #
#                                                                   #
# usage:                                                            #
# ncal -h | ncal.awk             - if Sunday is a first day of      #
#                                  the week                         #
# ncal -h | ncal.awk monday=TRUE - if Monday is a first day of      #
#                                  the week                         #
#                                                                   #
#####################################################################

BEGIN	\
{
	weekend[1]=7
	weekend[2]=1

	if ( ARGV[1]=="monday=TRUE" )
	{
		weekend[1]=6
		weekend[2]=7
	}

	today=strftime("%02d")
}

NR==1	\
{
	month=$1
	year=$2
}

NR>1	\
{
	gsub(/ {4}/," 0 ", $0)
	days[NR-1,1]=$1
	days[NR-1,2]=$2
	days[NR-1,3]=$3
	days[NR-1,4]=$4
	days[NR-1,5]=$5
	days[NR-1,6]=$6
	days[NR-1,7]=$7
}

END	\
{
	#############################################################
	# preparing and formatting data                              #
	#############################################################
	for ( i=1; i<=7; i++ )
	{
		for ( j=2; j<=7; j++ )
		{
			days[i,j]=sprintf("%02d", days[i,j])

			if ( days[i,j]=="00" )
				days[i,j]="··"

			if ( days[i,j]==today )
				days[i,j]="${color5}"days[i,j]"${color}"
			else
				days[i,j]="${color}"days[i,j]"${color}"
		}

		if ( i==weekend[1] )
			days[i,1]="${color5}"days[i,1]"${color}"
		else if ( i==weekend[2] )
			days[i,1]="${color5}"days[i,1]"${color}"
		else
			days[i,1]="${color1}"days[i,1]"${color}"
	}
	# ###########################################################

	#############################################################
	# displaying data                                           #
	#############################################################
	#print "${alignc}${color6}"month"${color}"

	for ( j=0; j<=1; j++ )
	{
		for ( i=1; i<=7; i++ )
		{
			printf "%s %s %s %s\n", days[i,1], days[i,2+j], days[i,4+j], days[i,6+j]
		}
	}

	#print "${alignc}${color6}"year"${color}"
}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6581 2013-11-07 20:38:05

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

PackRat wrote:

Edit - sector11, xbm isn't supported? could have sworn I've used them; You're most likely correct; so mf will have to come up with the right image format.

I tried it a few minutes before posting with: /usr/share/doc/openbox/xbm/desk_toggled.xbm

${image /usr/share/doc/openbox/xbm/desk_toggled.xbm -p 10,10 -s 25x25}

... it didn't show ... GIMPED it to a jpg - no problem.:

Last edited by Sector11 (2013-11-07 20:42:17)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6582 2013-11-08 00:09:42

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

Sector11 wrote:
PackRat wrote:

Edit - sector11, xbm isn't supported? could have sworn I've used them; You're most likely correct; so mf will have to come up with the right image format.

I tried it a few minutes before posting with: /usr/share/doc/openbox/xbm/desk_toggled.xbm

${image /usr/share/doc/openbox/xbm/desk_toggled.xbm -p 10,10 -s 25x25}

... it didn't show ... GIMPED it to a jpg - no problem.:

I think you two misunderstood each other. big_smile
Yes you can use xbm in Conky, but only WITH dzen2.

Thanks though, to both of you. I'm currently riding on dwm, will try to put dzen'ed Conky behind tint tomorrow. smile

Offline

#6583 2013-11-08 01:27:49

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

@ mf

Oh ... that's good news then ... well, we tried.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6584 2013-11-08 01:42:05

rstrcogburn
CrunchRanger
From: NM - The Land of Enchantment
Registered: 2010-06-12
Posts: 1,950
Website

Re: Conky v1.9 Thread

Not that it matters but I predict the conky thread will have more post than the what are you listening to thread at some point.  Interesting concept.

[Edit]  This is purely speculative, and based on its growth ratio from inception.

Last edited by rstrcogburn (2013-11-08 01:43:03)


Pack em in snow!

Offline

#6585 2013-11-08 02:14:27

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Hey rstrcogburn ...

Well, that cuz what I'm listening to is the rain and wind.  I don't think people are all that interested.  tongue

Where's your conky?


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6586 2013-11-08 02:20:28

rstrcogburn
CrunchRanger
From: NM - The Land of Enchantment
Registered: 2010-06-12
Posts: 1,950
Website

Re: Conky v1.9 Thread

Sector11 wrote:

Hey rstrcogburn ...

Well, that cuz what I'm listening to is the rain and wind.  I don't think people are all that interested.  tongue

Where's your conky?

LOL, I dunno man.  Been buying oil and gas leases out in the desert for 6 months.  It's about time I get down with the big bad conky config voodoo again..  It probably wasn't appropriate for me to compare threads above.  Better yet would have been to create a thread analyzing the nature of "monster" threads. lol  I was just in that train of thought of monster threads etc etc.  That might be a big part of it too.  Conky artist are grinding on a cause and listening to music comes and goes with the feeling or urge to do so.  Anyways, with winter coming on.  The config bug is starting to bite.  Here we go....


Pack em in snow!

Offline

#6587 2013-11-08 12:48:21

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

@ rstrcogburn

I thought it was a good comparison.  Except one is outside Linux one a part of Linux.  As long as you don't compare it to my bank account ... it shrinks not grows.  I play with conky because I can, I get horribly lost in other areas of Linux ...  it's the noob in me.

Good idea a thread to discuss monster threads Pros | Cons

Last edited by Sector11 (2013-11-08 12:49:06)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6588 2013-11-08 13:50:43

easysid
#! CrunchBanger
From: India
Registered: 2013-01-25
Posts: 150

Re: Conky v1.9 Thread

mf wrote:

Is it possible to put conky behind tint?

Do you mean something like this?
http://farm6.staticflickr.com/5535/10666145003_81f4bafb65_m.jpg

Offline

#6589 2013-11-08 15:47:09

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

mf wrote:

I think you two misunderstood each other. big_smile

Oh please, like that ever happens in an internet forum  8o

Good luck with it; remember to post the results.


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#6590 2013-11-08 18:18:16

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

Progress. I ended up converting the xbm icons to png's, adding transparency and coloring them, since I already had a totally functional top Conky with tint2. Might change it a litte bit, but I am already satisfied with it, Here's the screenshot.

abuWTkOr.jpg

The bottom Conky still needs a lot of work.

Last edited by mf (2013-11-08 18:20:16)

Offline

#6591 2013-11-08 21:15:29

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

Basically almost complete except for a few tweaks.  I probably won't submit another one and just update this post unless I figure out and add something really cool like I did with this one.

I've added a word clock (not mine, see lua comments) --updated to read hour oh minute instead of hour minute from one after to nine after and o'clock for when it's dead on the hour for boringTime
I've added am and pm functionality for when the word clock is showing and if you didn't know it was day or night.
I've added a function to add st, nd, rd, and th after the date number (i.e. 1st, 2nd, 3rd, 4th etc.)
I've added a function that grabs the number of your desktop and shows it in the middle of the clock as a number (can be moved, enlarged or turned off if you'd like and doesn't matter how many desktops you have).

Everything can be turned on and off as desired and most things are easy enough to configure by looking at the code.

superclock_by_liquibyte-d6thxdt.png

--[[Some functions shamelessly lifted from 'abstract conky by mrpeachy 2010' @ this
thread: http://crunchbang.org/forums/viewtopic.php?pid=78796, clock_rings.lua
by londonali1010 @ http://mylittledesktop.blogspot.com, the Swiss railway clock
for conky @ https://github.com/jrk-/conky_clock and the pretty_time script @ http://askubuntu.com/questions/239838/is-it-possible-for-conky-to-display-time-in-words-and-not-in-numbers
which is based on the code from http://rosettacode.org/wiki/Number_names#Lua.
Updated, fixed and abused for our purposes.  I think enough of the math and functions
have changed that I could actually call this fairly original though the ideas came
from elsewhere. liquibyte - http://www.liquibyte.com & http://www.liquibyte.org]]--
require 'cairo'
words = {"one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine "}
levels = {"thousand ", "million ", "billion ", "trillion ", "quadrillion ", "quintillion ", "sextillion ", "septillion ", "octillion ", [0] = ""}
iwords = {"ten ", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety "}
twords = {"eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "}
function digits(n)
  local i, ret = -1
  return function()
    i, ret = i + 1, n % 10
    if n > 0 then
      n = math.floor(n / 10)
      return i, ret
    end
  end
end
level = false
function getname(pos, dig)
  level = level or pos % 3 == 0
  if(dig == 0) then return "" end
  local name = (pos % 3 == 1 and iwords[dig] or words[dig]) .. (pos % 3 == 2 and "hundred " or "")
  if(level) then name, level = name .. levels[math.floor(pos / 3)], false end
  return name
end
function numberToWord(number)
    if(number == 0) then return "zero" end
    local vword = ""
    for i, v in digits(number) do
      vword = getname(i, v) .. vword
    end
    for i, v in ipairs(words) do
      vword = vword:gsub("ty " .. v, "ty-" .. v)
      vword = vword:gsub("ten " .. v, twords[i])
    end
    return vword
end
function boringTime()
	hours = hours + 0
	mins = mins + 0
	hours = hours % 12
	if(hours == 0) then 
		hours, nextHourWord = 12, "one "
	else
		nextHourWord = numberToWord(hours+1)
	end
	local hourWord = numberToWord(hours)
	if(mins == 0) then 
		return hourWord .. "o'clock "
	elseif(mins < 10) then
		return numberToWord(hours) .. "oh " .. numberToWord(mins)
	else
		return numberToWord(hours) .. numberToWord(mins)
	end
end
function awesomeTime()
    if(hours == 0) then 
        hours, nextHourWord = 12, "one " 
    else
        nextHourWord = numberToWord(hours+1)
    end
    local hourWord = numberToWord(hours)
    if(mins == 0 ) then 
        return hourWord .. "o'clock"
    elseif(mins == 30) then
        return "half past " .. hourWord
    elseif(mins == 15) then
        return "a quarter past " .. hourWord 
    elseif(mins == 45) then
        return "a quarter to " .. nextHourWord 
    else
        if(mins < 30) then
            return numberToWord(mins) .. "past " .. hourWord
        else
            return numberToWord(60-mins) .. "to " .. nextHourWord
        end
    end
end
function getHourWord()
    return numberToWord(hours + 0)
end
function getMinuteWord()
    return numberToWord(mins + 0)
end
function draw_wordTime(co, across, down, font, slant, weight, text, size, wr, wg, wb, wa)
	local bt = boringTime(tostring)
	local at = awesomeTime(tostring)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, wr, wg, wb, wa)
	cairo_select_font_face (cr, font, slant, weight);
	if text == boringTime then
		cairo_show_text (cr, bt)
	elseif text == awesomeTime then
		cairo_show_text (cr, at)
	end
	cairo_stroke (cr)
end
function draw_ring(co, across, down, circrad, rlw, rstart, rend, rr, rg, rb, ra)
	local degrads = math.pi/180
	local start	= rstart*degrads-math.pi/2
	local finish = rend*degrads-math.pi/2
	local xring	= 0+circrad*(math.sin(degrads*rstart))
	local yring	= 0-circrad*(math.cos(degrads*rstart))
	cairo_move_to (cr, across+xring, down+yring)
	cairo_arc (cr, across, down, circrad, start, finish)
	cairo_set_line_width (cr, rlw)
	cairo_set_source_rgba (cr, rr, rg, rb, ra)
	cairo_stroke (cr)
end
function draw_hand(co, across, down, circrad, hlw, hx, hy, hr, hg, hb, ha)
	xhours = 0+circrad*math.sin(hours_arc)
	yhours = 0-circrad*math.cos(hours_arc)
	xmins = 0+circrad*math.sin(mins_arc)
	ymins = 0-circrad*math.cos(mins_arc)
	xsecs = 0+circrad*math.sin(secs_arc)
	ysecs = 0-circrad*math.cos(secs_arc)
	xdsecs = 0+circrad*math.sin(dsecs_arc)
	ydsecs = 0-circrad*math.cos(dsecs_arc)
	cairo_move_to (cr, across, down)
	cairo_line_to (cr, across+hx, down+hy)
	cairo_set_line_width (cr, hlw)
	cairo_set_source_rgba (cr, hr, hg, hb, ha)
	cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT)
	cairo_stroke (cr)
end
function draw_date(co, across, down, font, slant, weight, text, size, dr, dg, db, da)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, dr, dg, db, da)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_stroke (cr)
end
function draw_suffix(co, across, down, font, slant, weight, text, suffix, size, sr, sg, sb, sa)
	if days == 1 or days == 21 or days == 31 then
		suffix = 'st'
	elseif days == 2 or days == 22 then
		suffix = 'nd'
	elseif days == 3 or days == 23 then
		suffix = 'rd'
	else
		suffix = 'th'
	end
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, sr, sg, sb, sa)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_show_text (cr, suffix)
	cairo_stroke (cr)
end
function draw_desktop (co, across, down, font, slant, weight, desk, size, dskr, dskg, dskb, dska)
	local desk = tonumber(conky_parse("${desktop}"))
	for desk in tonumber do tonumber = desk end
	cairo_set_source_rgba (cr, dskr, dskg, dskb, dska)
	cairo_move_to (cr, across, down)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_set_font_size (cr, size)
	cairo_show_text (cr, desk)
end
dsecs = os.date("%S") --Define deciseconds as seconds (HAS TO BE GLOBAL OUTSIDE FUNCTION, DON'T MOVE)
function conky_draw_superclock()
	if conky_window == nil then return end
	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	cr = cairo_create(cs)
--------SET HORIZONTAL AND VERTICAL POSITION RELATIVE TO CONKY WINDOW-----------
	across = 200
	down = 170
--------SET THE CLOCK RADIUS----------------------------------------------------
	circrad = 60
--------TURN ON AND OFF THE PARTS OF THE DATE-----------------------------------
	show_weekday	= true
	show_month		= true
	show_days		= true
	show_year		= true
--------TURN ON AND OFF SMOOTH TICKS FOR THE SECONDS HAND-----------------------
	show_smooth		= true
--------TURN ON AND OFF THE SECOND HAND FOR THE CLOCK---------------------------
	show_seconds	= true
--------TURN ON AND OFF THE CLOCK HANDS-----------------------------------------
	show_hands		= true
--------TURN ON AND OFF AM OR PM------------------------------------------------
	show_ampm		= true
--------TURN ON AND OFF WORD TIME-----------------------------------------------
	show_wordtime	= true
--------TURN ON AND OFF THE PIPS------------------------------------------------
	show_pips		= true
--------TURN ON AND OFF THE SOLID RINGS-----------------------------------------
	show_rings		= true
--------TURN ON AND OFF THE MOVING RINGS----------------------------------------
	show_moving		= true
--------TURN ON AND OFF THE DESKTOP INDICATOR-----------------------------------
	show_desk		= true
--------DEFINE THE DATE AND TIME------------------------------------------------

	local update_interval = conky_set_update_interval(0.1)
	secs = os.date("%S")
    mins = os.date("%M")
    hours = os.date("%I")
    local ampm = os.date("%p")
	local weekday = os.date("%A")
	local days = os.date("%e")
	local month = os.date("%B")
	local year = os.date("%Y")
	dsecs = dsecs + 0.1 --Matches second hand to conky_set_update_interval
--[[The following seems really counterintuitive but I tried for over a week to match
the second hand to the seconds while show_smooth = true and nothing I did worked,
it always drifted one way or the other.  This makes it work and I still don't
understand why it works but it does.  It also introduces a small bug that only the
most anal will notice.  When dsecs goes negative due to this equation, the moving
arc will offset by 1 pixel and is noticable by not being in line with the rest of
the moving arcs.]]
	if dsecs >= 60 then
		dsecs = 0
		dsecs = dsecs-60
	end
	print(dsecs)
--------DEFINE THE ARCS---------------------------------------------------------
	dsecs_arc = (2*math.pi/60)*dsecs
    secs_arc = (2*math.pi/60)*secs
    mins_arc = (2*math.pi/60)*mins+secs_arc/60
    hours_arc = (2*math.pi/12)*hours+mins_arc/12
    local dsecsperc = ((dsecs/60)*100)*(360/100)
	local secsperc = ((secs/60)*100)*(360/100)
	local minsperc = ((mins/60)*100)*(360/100)+secs_arc
	local hoursperc	= ((hours/12)*100)*(360/100)+mins_arc*4.75 --this seems to be a hack but it works
--------HOURS HAND--------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+30+6, 6, xhours, yhours, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS RINGS-------------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+30, 8, 0, 360, 0.4, 0.4, 0.4, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+30, 8, hours_arc-(hoursperc/60), hoursperc, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS PIP---------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+30, 8, hoursperc-1.1, hoursperc+1.1, 0.5, 0.5, 1.0, 1.0)
	end
--------MINUTES HAND------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+40+6, 4, xmins, ymins, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES RINGS-----------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+40, 8, 0, 360, 0.5, 0.5, 0.5, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+40, 8, mins_arc-(minsperc/60), minsperc, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES PIP-------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+40, 8, minsperc-0.7, minsperc+0.7, 0.5, 1.0, 0.5, 1.0)
	end
--------SECONDS HAND------------------------------------------------------------
	if show_seconds then
		if show_hands then
			if show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xdsecs, ydsecs, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xsecs, ysecs, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS RINGS-----------------------------------------------------------
		if show_rings then
			draw_ring(0, across, down, circrad+50, 8, 0, 360, 0.6, 0.6, 0.6, 0.5)
		end
		if show_moving then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecs_arc-(dsecsperc/60), dsecsperc, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secs_arc-(secsperc/60), secsperc, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS PIP-------------------------------------------------------------
		if show_pips then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecsperc-0.3, dsecsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secsperc-0.3, secsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
		end
	end
--------DAY OF THE WEEK---------------------------------------------------------
	if show_weekday then
		draw_date(0, across-185, down-120, "virgo01", 0, 0, weekday, 34, 0.4, 0.4, 0.4, 0.8)
	end
--------MONTH-------------------------------------------------------------------
	if show_month then
		draw_date(0, across-185, down+200, "virgo01", 0, 0, month, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------DAY---------------------------------------------------------------------
	if show_days then
		draw_suffix(0, across, down+240, "virgo01", 0, 0, days, suffix, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------YEAR--------------------------------------------------------------------
	if show_year then
		draw_date(0, across-185, down+240, "virgo01", 0, 0, year, 34, 0.6, 0.6, 0.6, 0.8)
	end
--------WORD TIME---------------------------------------------------------------
	if show_wordtime then --valid values are boringTime and awesomeTime 
		draw_wordTime(0, across-185, down+140, "virgo01", 0, 0, boringTime, 20, 0.6, 0.6, 0.6, 0.8)
	end
--------AM / PM-----------------------------------------------------------------
	if show_ampm then
		draw_date(0, across-185, down+165, "virgo01", 0, 0, ampm, 20, 0.6, 0.6, 0.6, 0.8)
	end
--------DESKTOP INDICATOR-------------------------------------------------------
	if show_desk then
		draw_desktop (0, across-10, down+10, "virgo01", 0, 0, desk, 32, 0.6, 0.6, 0.6, 1.0)
	end
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
end

Edit--Reverted back to msecs (actually renamed to dsecs as in deciseconds because that's actually what we're dealing with here) due to a bug where minute hand jumps at 60 secs.  If I work it out I'll re-edit.  Also realized that the way the railway clock gets 1/10th of a second resolution was introducing an offset of +0.1 every minute so that over time the clock would be off.  I beleive I have finally fixed this.  I've watched the seconds over time and it seems to track the actual clock the right way now.  If you find that it's not behaving right, let me know and I'll keep digging into the code.

Renamed to SuperClock to avoid confusion with other clocks.  Packaged everything up in a 7z for download @ deviantart

--update: I've changed this code and replaced it with a non-buggy version because I finally got the seconds to track right with smooth ticks on.  I'd rather people had the one that works and not one that doesn't.  Plus, this avoids any confusion.

Last edited by liquibyte (2013-11-17 03:51:01)

Offline

#6592 2013-11-09 03:30:17

dreadkopp
Member
Registered: 2011-10-13
Posts: 12

Re: Conky v1.9 Thread

hey! i did a conky.conf to post all important current logs

looks like this

     
    update_interval 1
    alignment tr
    double_buffer yes
    gap_x 302
    gap_y 40
    own_window yes
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 255
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager   
    use_xft yes
    default_color white
    default_shade_color black
    draw_shades no
    default_outline_color black
    maximum_width 722
    minimum_size 722


TEXT
${font sans-serif:normal:size=10}H${font sans-serif:normal:size=8}ttp-Access_Log:${hr 2}:
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/access_log | tail -n 10 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/access_log | tail -n 8 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/access_log | tail -n 6 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/access_log | tail -n 4 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/access_log | tail -n 2}

${font sans-serif:normal:size=10}H${font sans-serif:normal:size=8}ttp-Error_log:${hr 2}:
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/error_log | tail -n 5 | head -n 1}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/error_log | tail -n 4 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 cat /var/log/httpd/error_log | tail -n 2}

${font sans-serif:normal:size=10}S${font sans-serif:normal:size=8}SH_log:${hr 2}:
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/auth.log | grep ssh | tail -n 5 | head -n 1}
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/auth.log | grep ssh | tail -n 4 | head -n 2}
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/auth.log | grep ssh | tail -n 2}

${font sans-serif:normal:size=10}S${font sans-serif:normal:size=8}ystem_Log:${hr 2}:
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 10 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 9 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 8 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 7 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 6 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 5 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 4 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 3 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 2 | head -n 1 }
${font sans-serif:normal:size=8}${execi 60 sudo cat /var/log/messages.log | tail -n 1 }

${font sans-serif:normal:size=10}P${font sans-serif:normal:size=8}acman_Log:${hr 2}:
${font sans-serif:normal:size=8} Installed:${alignc}${font sans-serif:normal:size=8}Removed:${alignr}${font sans-serif:normal:size=8}Updated:
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 10 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 10 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 10 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 9 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 9 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 9 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 8 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 8 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 8 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 7 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 7 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 7 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 6 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 6 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 6 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 5 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 5 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 5 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 4 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 4 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 4 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 3 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 3 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 3 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 2 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 2 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 2 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}
${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep installed |tail -n 1 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignc}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep removed |tail -n 1 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}${alignr}${font sans-serif:normal:size=8}${execi 600 cat /var/log/pacman.log | grep upgraded |tail -n 1 | head -n 1 | awk -F] '{print $3}' | awk -F \( '{print$1}' | awk -F ed '{print $2}'}

is there a better way to read the Logs?

doing it this way screws up my cpu to ~90% every 60 seconds.

greetings

Offline

#6593 2013-11-14 12:41:21

easysid
#! CrunchBanger
From: India
Registered: 2013-01-25
Posts: 150

Re: Conky v1.9 Thread

^ not that it would make a difference, but you may want to call the pound. A lot of stray cats here big_smile big_smile

Offline

#6594 2013-11-14 16:09:58

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

I wasn't going to say anything because if he didn't see it, it wasn't worth mentioning.

The script calls the following at either 60ms or 600ms:

execi 51times
cat 51times
tail 51times
grep 33 times
head 47 times
awk 90 times
print 90 times

I didn't try it out because looking at it there seems to be no reason to want that much info that fast, ever.

Offline

#6595 2013-11-14 17:26:17

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

easysid wrote:

^ not that it would make a difference, but you may want to call the pound. A lot of stray cats here big_smile big_smile

lol lol lol lol  I love it!!!!!

dreadkopp wrote:

is there a better way to read the Logs?

doing it this way screws up my cpu to ~90% every 60 seconds.

Why not create a log conky for each log file you want to monitor but put them in windows so you can call them read them and shut them down when not needed:

Some samples of one log file
# killall conky && conky -c /media/5/Conky/S11_LOGS.conky &
# pkill -xf "conky -c /media/5/Conky/S11_LOGS.conky" &
###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent no #yes
own_window_hints below,skip_taskbar,skip_pager
own_window_class Conky
own_window_title /var/log/alternatives.log
own_window_colour black

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0 #255

minimum_size 1800 900	### w|h
maximum_width 1800	### w

gap_x 10	### l|r
gap_y 0	### u|d

# Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
alignment tm
##################################left#################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Liberation Sans:size=15
xftfont monofur:bold:size=10

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no

######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades yes #no # amplifies text if yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

default_color DCDCDC #220 220 220	Gainsboro
#default_color C0C0C0 #192 192 192 Silver
#default_color B0E0E6 #176 224 230 PowderBlue
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 778899 #119 136 153	LightSlateGray
color2 D8BFD8 #216 191 216	Thistle
color3 9ACD32 #154 205  50	YellowGreen
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite${hr}
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 5F9EA0 # 95 158 160	CadetBlue
color8 BDB76B #189 183 107	DarkKhaki
color9 CD5C5C #205  92  92	IndianRed
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 6000 # required for the horiz-cal

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit

## Imlib2 image cache size, in bytes. Defaults to 4MiB. Increase this value
## if you use $image lots.		Set to 0 to disable the image cache.
imlib_cache_size 0

#top_name_width 15
##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or it blinks.
##
# lua_load ~/wea_conky/draw_bg.lua
## TEXT
## ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
##
## OR Both above TEXT (No composite manager required - no blinking!)
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 50 0 0 0 0 0x000000 0.3
#
# TEXT
#
update_interval 1

TEXT
CPU Avg: ${cpu cpu0}%${goto 150}CPU1: ${cpu cpu2}%${goto 350}CPU2: ${cpu cpu2}%${goto 500}CPU3 ${cpu cpu3}%

--- tail 10 | head 2 ---------------------------------------------------------
${exec cat /var/log/alternatives.log | tail -n 10 | head -n 2}

--- head 2 | tail 10 ---------------------------------------------------------
${exec cat /var/log/alternatives.log | head -n 2 | tail -n 10}

=== tail 10 | fold on a space - 250 ==========================================
${exec cat /var/log/alternatives.log | tail -n 10 | fold -s -w 250}

=== head 10 | fold on a space - 250 ==========================================
${exec cat /var/log/alternatives.log | head -n 10 | fold -s -w 250}

=-= | fold on a space - 250 =-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
${exec cat /var/log/alternatives.log | fold -s -w 250}

2013_11_14_13_14_38_1920x1080_Sector11.jpg

As you see - CPU usage is minimal.  Run It - Read It - Close It!

======================
I have a button-script (LUA - by mrpeachy) - when I find a link I'll post it:

# killall conky && conky -c /media/5/Conky/S11_LOGS.conky &
# pkill -xf "conky -c /media/5/Conky/S11_LOGS.conky" &

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_class click_log
own_window_title click_log  ##### NOTE instruction in the LUA script!

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### 'own_window_type override'
#                                                own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 200

minimum_size 1800 950     ## width, height
maximum_width 1800       ## width, usually a good idea to equal minimum width

gap_x 0 # left-right
gap_y 10 # up-down

alignment tm
###################################################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Monofur:size=12

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 0
# Force UTF8? requires XFT ###
override_utf8_locale yes


uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #Gainsboro
color0 9ACD32 #YellowGreen
color1 778899 #LightSlateGrey
color2 FF8C00 #Darkorange
color3 7FFF00 #Chartreuse
color4 FFA07A #LightSalmon
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 00FFFF #Cyan 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no #yes
default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################

# Boolean value, if true, Conky will be forked to background when started.
background no

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 2048

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
lua_load /media/5/Conky/LUA/s11buttons.lua
lua_draw_hook_pre conky_main
#######################################################  End LUA Settings  ###

update_interval 1
## one blank line after text!
TEXT
${cpu}%

I added ${cpu} in there to sho my average cpu usage over three cpu's

s11buttons.lua

--[[conky interactive log messages by mrpeachy 03/12
http://youtu.be/SQVX3sgXdnA
call in conkyrc in a similar manner to this
lua_load /home/mcdowall/lua/filename.lua
lua_draw_hook_pre draw_main

in the conkyrc you also need to add this setting

own_window_title click_log

or you can set your own window title then edit towards the bottom of the script
so that any instances of click_log are replaced with the title you set
avoid spaces in title name


see interactive weather thread on crunchbang forum
link soon

]]

require 'cairo'
start=1
buttons={}
buttons[1]=0
text_table={}
--------------------------------------------------------------------------------
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--get click coordinates
localx,localy=clickfunction() --dont edit
--##############################################
--SETTINGS #####################################
--set message length
local tail_length=1
commands={
"dmesg",
"/var/log/alternatives.log",
"/var/log/alternatives.log.1",
"/var/log/apt/history.log",
"/var/log/apt/term.log",
"/var/log/ConsoleKit/history",
"/var/log/ConsoleKit/history.1",
"/var/log/dpkg.log",
"/var/log/dpkg.log.1",
"/var/log/fontconfig.log",
"/var/log/installer/hardware-summary",
"/var/log/installer/lsb-release",
"/var/log/nvidia-installer.log",
"/var/log/pm-powersave.log",
"/var/log/pm-powersave.log.1",
"/var/log/sgfxi/sgfxi.log.1",
"/var/log/smxi.log",
"/var/log/syslog",
"/var/log/syslog.1",
"/var/log/Xorg.0.log",
"/var/log/Xorg.1.log",
"/var/log/Xorg.2.log",
}
--setup list table
list={
"dmesg",
"alternatives.log",
"alternatives.log.1",
"apt/history.log",
"apt/term.log",
"ConsoleKit/history",
"ConsoleKit/history.1",
"dpkg.log",
"dpkg.log.1",
"fontconfig.log",
"installer/hardware-summary",
"installer/lsb-release",
"nvidia-installer.log",
"pm-powersave.log",
"pm-powersave.log.1",
"sgfxi/sgfxi.log.1",
"smxi.log",
"syslog",
"syslog.1",
"Xorg.0.log",
"Xorg.1.log",
"Xorg.2.log",
}
--set list font and size
local list_font="Monofur"
local list_fsize=12
--set text properties for [Logs] main button
local log_text="[Logs]"
local log_font="Monofur"
local log_fsize=12
--set [Logs] button top left corner coordinates and width/height
local log_tlx=20 -- left-right
local log_tly=20 -- up-down
--need to set the top left corner of the top button IN THE LIST
local list_tlx=140 -- left-right
local list_tly=20 -- up-down
--set gap between buttons
local gap=5
--setup sections ###############################
--set top left coords and size of [Close] button
local tlx_close=80 -- left-right
local tly_close=20 -- up-down
--set text properties for CLOSE main button
local close_text="[Close]"
local close_font="Monofur"
local close_fsize=12
--set properties for section display text
local section_font="Monofur"
local section_fsize=12
local section_blx=20 -- left-right
local section_bly=70 -- up-down
--set how many lines to show
local max_lines=60
local line_height=12
--END OF SETTINGS ########################################
--########################################################
--calculate number of entries in the above table
number_in_list=#list
--main button, button1 ###################################
--get dimensions of log text
cairo_select_font_face (cr, log_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, log_fsize)
--get font height
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,log_text,extents)
local log_height=extents.height
local log_width=extents.width
--########################################################
--calculate if click was inside box
if localx>=log_tlx and localx<=log_tlx+log_width and localy>=log_tly and localy<=log_tly+log_height and buttons[1]~=1 then
buttons[1]=1
elseif localx>=log_tlx and localx<=log_tlx+log_width and localy>=log_tly and localy<=log_tly+log_height and buttons[1]==1 then
buttons[1]=0
end
if buttons[1]==1 then
color={1,0,0,1}--set on color red
elseif buttons[1]==0 then
color={1,1,1,1}--offcolor white
end
cairo_set_source_rgba (cr,color[1],color[2],color[3],color[4])
--[[draw the box for positioning purposes, you can comment out the draw commands later
cairo_set_line_width (cr,1)
cairo_rectangle (cr,tlx,tly,width,height)
cairo_stroke (cr)--]]
--write title
cairo_move_to (cr,log_tlx,log_tly+log_height)
cairo_show_text (cr,log_text)
cairo_stroke (cr)
--------------------------------------------------------------------------------------
--if the main button is clicked then all this stuff will happen
if buttons[1]==1 then
--generate buttons
cairo_select_font_face (cr, list_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, list_fsize)
--get font height
local getheight_text="the quick brown fox jumps over the lazy dog"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,getheight_text,extents)
list_height=extents.height--dont localize
for i=1,number_in_list do --use a for loop to generate all the buttons with a single code chunk
--###########################################################
--buttons--##################################################
--calculate width and height based on text and font and fsize
local list_text=list[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,list_text,extents)
local list_width=extents.width
--###########################################################
--calculate if click is inside buttons
	if localx>=list_tlx and localx<=list_tlx+list_width and localy>=list_tly+((gap+list_height)*(i-1)) and localy<=list_tly+((gap+list_height)*(i-1))+list_height and buttons[tostring("button1_"..i)]~=1 then
	buttons[tostring("button1_"..i)]=1
	elseif localx>=list_tlx and localx<=list_tlx+list_width and localy>=list_tly+((gap+list_height)*(i-1)) and localy<=list_tly+((gap+list_height)*(i-1))+list_height and buttons[tostring("button1_"..i)]==1 then
	buttons[tostring("button1_"..i)]=0
	end
if buttons[tostring("button1_"..i)]==1 then
color={1,0,0,1}--set on color red
--also going to turn off all the other buttons
		n=i
		for i=1,number_in_list do
			if i~=n then
			buttons[tostring("button1_"..i)]=0
			end
		end
		buttons[1]=0
else--if buttons[tostring("button1_"..i)]==0 then
color={1,1,1,1}--offcolor white
end
cairo_set_source_rgba (cr,color[1],color[2],color[3],color[4])
--[[draw the box for positioning purposes, you can comment out the draw commands later
cairo_set_line_width (cr,1)
cairo_rectangle (cr,tlx,tly+((gap+height)*(i-1)),width,height)
cairo_stroke (cr)--]]
--------------------------------------------------------------------------------------
--write titles
cairo_move_to (cr,list_tlx,list_tly+((gap+list_height)*(i-1))+list_height)
cairo_show_text (cr,list_text)
cairo_stroke (cr)
end--for loop
end--if main button=1
--############################################################
--activate the function
--get dimensions of close text
cairo_select_font_face (cr, close_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, close_fsize)
--get font height
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,close_text,extents)
local height_close=extents.height
local width_close=extents.width
for i=1,number_in_list do
	if buttons[tostring("button1_"..i)]==1 then
if get_text~=1 then
text_table={}
--do the thing and put it in table
if i>1 then
	local file = assert(io.open(tostring(commands[i]), "r"))
	for line in file:lines() do
	table.insert(text_table,line)
	end
	file:close()
	get_text=1
elseif i==1 then
	local file = io.popen(tostring(commands[i]))
	for line in file:lines() do
	table.insert(text_table,line)
	end
	file:close()
	get_text=1
end
end
	cairo_set_source_rgba (cr,1,1,1,1)
	cairo_select_font_face (cr, section_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
	cairo_set_font_size (cr, section_fsize)
	for i=1,max_lines do
	cairo_move_to (cr,section_blx,section_bly+((i-1)*line_height))
	cairo_show_text (cr,text_table[i])
	cairo_stroke (cr)
	end
	cairo_set_source_rgba (cr,1,1,1,1)
	cairo_select_font_face (cr, list_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
	cairo_set_font_size (cr, list_fsize)
	cairo_move_to (cr,list_tlx,list_tly+list_height)
	cairo_show_text (cr,list[i])
	cairo_stroke (cr)
	--loadstring('button1_'..i..'display("'..section_font..'",'..section_fsize..','..section_blx..','..section_bly..')')()
	--close button- turns everything off back to start position
	--calculate if click was inside box
	if localx>=tlx_close and localx<=tlx_close+width_close and localy>=tly_close and localy<=tly_close+height_close and buttons[2]~=1 then
	buttons[2]=1
	elseif localx>=tlx_close and localx<=tlx_close+width_close and localy>=tly_close and localy<=tly_close+height_close and buttons[2]==1 then
	buttons[2]=0
	end
	if buttons[2]==1 then
	color={1,0,0,1}--set on color red
			for i=1,number_in_list do
				buttons[tostring("button1_"..i)]=0
			end
			buttons[1]=0
			buttons[2]=0
			get_text=0
	else
	color={1,1,1,1}--offcolor white
	end
	cairo_set_source_rgba (cr,color[1],color[2],color[3],color[4])
	--[[draw the box for positioning purposes, you can comment out the draw commands later
	cairo_set_line_width (cr,1)
	cairo_rectangle (cr,tlx_close,tly_close,width_close,height_close)
	cairo_stroke (cr)--]]
	--write titles
	cairo_select_font_face (cr, close_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
	cairo_set_font_size (cr, close_fsize)
	cairo_move_to (cr,tlx_close,tly_close+height_close)
	cairo_show_text (cr,close_text)
	cairo_stroke (cr)
	end--if button =1
end--for i=
--#########################################################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end--end main function

function clickfunction()
--start click logging and calculations ##########################################
if start==1 then
xdot=conky_parse("${if_running xdotool}1${else}0${endif}")
	if tonumber(xdot)==1 then
	os.execute("/usr/bin/killall xdotool && echo 'xdo killed' &")
	end
os.execute("xdotool search --name click_log behave %@ mouse-click getmouselocation >> /tmp/xdo &")
start=nil--]]
local f = io.popen("xwininfo -name 'click_log' | grep 'Absolute'")
geometry = f:read("*a")
f:close()
geometry=string.gsub(geometry,"[\n]","")
s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")
end--if start=1 ######################################
--click calculations #################################
local f=io.open("/tmp/xdo")
click=f:read()
f:close()
	if click~=nil then
	local f = io.open("/tmp/xdo","w")
	f:write("")
	f:close()
	end--if click=nil
if click==nil then click="x:0 y:0 " end
s,f,mousex=string.find(click,"x%p(%d*)%s")
s,f,mousey=string.find(click,"y%p(%d*)%s")
mousex=tonumber(mousex)
mousey=tonumber(mousey)
localx=mousex-abstlx
localy=mousey-abstly
--END CLICK CALCULATIONS #################################
return localx,localy
end--function

2013_11_14_14_03_39_1920x1080_Sector11.jpg 2013_11_14_14_04_10_1920x1080_Sector11.jpg

2013_11_14_14_04_34_1920x1080_Sector11.jpg 2013_11_14_14_05_03_1920x1080_Sector11.jpg

Last edited by Sector11 (2013-11-14 17:28:51)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6596 2013-11-14 17:40:28

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

liquibyte wrote:

I wasn't going to say anything because if he didn't see it, it wasn't worth mentioning.

EDIT:  I like this - I'll have to C4 it when done  big_smile

And all those font calls....

Once a font is called ... it is in use until it is changed to another font OR stopped ( ${font} ) at which time conky falls back on the default font as set above TEXT
so all those:

${font sans-serif:normal:size=8}

can be eliminated by:

use_xft yes
xftfont  sans-serif:size=8
TEXT

and closing the larger fonts:

${font sans-serif:size=10}P${font}acman_Log:${hr 2}:

Just trying to help dreadkopp - no disrespect meant!

Last edited by Sector11 (2013-11-14 17:42:14)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6597 2013-11-14 22:01:29

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

Sector11 wrote:

EDIT:  I like this - I'll have to C4 it when done  big_smile

I was hoping someone could tell me where I went wrong on the os.date calls.  I can't seem to get it to keep time consistently.  Because of this, I haven't managed to tighten things up enough for my tastes.  It works and seems to not take up too much cpu or memory though I've noticed that memory grows lately.  Critiques are most certainly welcome.

Offline

#6598 2013-11-14 23:03:06

xero
#! Junkie
From: 0x000000
Registered: 2013-09-30
Posts: 382
Website

Re: Conky v1.9 Thread

i've been working on a top bar conky.
finally got the percentages to overlay the bars with a negative vertical offset.

screenshot:
iFbyi0Jl.png

code:
https://gist.github.com/xero/7475864


▬▬ι═════════-
dotfiles http://git.io/.files

Offline

#6599 2013-11-14 23:11:42

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

liquibyte wrote:
Sector11 wrote:

EDIT:  I like this - I'll have to C4 it when done  big_smile

I was hoping someone could tell me where I went wrong on the os.date calls.  I can't seem to get it to keep time consistently.  Because of this, I haven't managed to tighten things up enough for my tastes.  It works and seems to not take up too much cpu or memory though I've noticed that memory grows lately.  Critiques are most certainly welcome.

That is beyond my scope of LUA knowledge ... maybe someone will come to your rescue.  X-ing fingers


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Be excellent to each other!

#6600 2013-11-15 00:18:46

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

xero wrote:

i've been working on a top bar conky.
finally got the percentages to overlay the bars with a negative vertical offset.

@ xero

I see a conky I'm interested in and I gotta play with it ...

You can do that conky without a single ${voffset}!  And by using ${goto} vs ${offset} your all your % values don't shift the the right one character when CPU goes from 9% to 10% or back again when dropping down to 9% from 10%

In progress: «---------------------------» Done:
2013_11_14_20_59_26_1920x1080_Sector11.jpg «--» 2013_11_14_21_00_27_1920x1080_Sector11.jpg

I don't have some of the things you had so I faked a few bars and values.  big_smile

# conky -c /media/5/conky/xero.conky &
# pkill -xf "/media/5/conky/xero.conky" &
# conky configuration
#
# screenshot: http://i.imgur.com/iFbyi0J.png
#
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Monospace:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent no
own_window_type desktop
own_window_colour black
#own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 1361 0
maximum_width 1361
draw_shades no
draw_outline no
draw_borders no
default_bar_size 180 14
#draw_graph_borders yes
color1 7C7D7E
color2 5C95B3
color3 FFFFFF
alignment top_middle
gap_x 0
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
# Output
##############################################
TEXT
${goto 30}${color1}cpu${goto 75}${color2}${cpubar}${goto 165}${color3}${cpu cpu0}%\
${goto 285}${color1}memory${goto 346}${color2}${membar}${goto 435}${color3}${memperc}%\
${goto 556}${color1}entropy${goto 630}${color2}${membar}${goto 720}${color3}99%\
${goto 840}${color1}mpd${offset 15}${color2}${membar}${goto 969}${color3}89%\
${goto 1090}${color1}temp${offset 15}${color2}${cpubar cpu0}${goto 1228}${color3}${platform f71882fg.2560 temp 1}${iconv_start UTF-8 ISO_8859-1}°${iconv_stop}c

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo