SEARCH

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

You are not logged in.

#5151 2013-04-23 21:17:24

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

@ragamatrix
that does look good (if i may say so smile )
in many ways that script was the forerunner of v9000
the 2 scripts could be made to work side by side although it would be easier to move the graphics drawing elements of the first script into a v9000 template.

all the data in your screenshot is available through v9000, would just have to make the gauges and meters modular and feed them numbers from v9000

Offline

Help fund CrunchBang, donate to the project!

#5152 2013-04-24 09:37:10

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

@mr peachy
Hello,
Thanks for explanations.
And then what I'd like to do (display weather icons in it) might be possible. The ideas are to use these thermos wich change colors (great) with the v9000 and icons ... yikes
I' ve got a little bit of work to do that, when I'll have more time I will enjoy to show you the result of this conky project.
regards

Offline

#5153 2013-04-24 15:45:09

monica
New Member
Registered: 2013-04-24
Posts: 8

Re: Conky v1.9 Thread

Thanks, it works! I just had to install gawk first.  The script also works for Canadian postal codes. smile

Offline

#5154 2013-04-24 16:10:17

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

do u have an idea how i display the status of a battery?

like this?

${if_existing /proc/acpi/battery/BAT0/state}on${else}off$endif

Offline

#5155 2013-04-24 17:00:51

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

Re: Conky v1.9 Thread

monica wrote:

Thanks, it works! I just had to install gawk first.  The script also works for Canadian postal codes. smile

What script?


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

Offline

#5156 2013-04-24 17:09:58

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

This one

Confirmed it works quite well

screenshot-04242013-121111pm.php


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#5157 2013-04-24 17:17:32

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

Re: Conky v1.9 Thread

lionhead wrote:

do u have an idea how i display the status of a battery?

like this?

${if_existing /proc/acpi/battery/BAT0/state}on${else}off$endif

Do you have a /proc/acpi/battery/BAT0 is so it's even simpler: http://conky.sourceforge.net/variables.html

Since conky defaults to BAT0:

apcupsd_charge
        Current battery capacity in percent.

apcupsd_lastxfer
         Reason for last transfer from line to battery.

apcupsd_status
         Prints current status (on-line, on-battery).

apcupsd_timeleft
         Time left to run on battery.

TEXT
Current battery capacity in percent: ${apcupsd_charge}

Reason for last transfer from line to battery: ${apcupsd_lastxfer}

Prints current status (on-line, on-battery): ${apcupsd_status}

Time left to run on battery: ${apcupsd_timeleft}

Otherwise:

TEXT
${apcupsd_status BAT1}

I don't have a battery so I can not check these.


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

Offline

#5158 2013-04-24 17:30:41

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

Re: Conky v1.9 Thread

VastOne wrote:

OK .. thanks

Needed to change more than:

METRIC=1 #Should be 0 or 1; 0 for F, 1 for C

While METRIC changes numerical out put between F and C there are two places in the code that need changing as well:

1st change is noted in the code:

		split(tmp[2],statement," C ") # substitute C for F if metric differs

the second one isn't:

		forecast[++y]=sprintf("%s %d-%dF %-15s",strftime("%a",DateIndx[x]),temp[5],temp[2],statement[3])

Now I have:

		forecast[++y]=sprintf("%s %d-%dC %-15s",strftime("%a",DateIndx[x]),temp[5],temp[2],statement[3]) # substitute %dC for %dF if metric differs
 24 Apr 13 | 14:48:21 /media/5/Conky/scripts
         $ /media/5/Conky/scripts/accweather.sh L#L#L#
Now Rain, 4C
Wed -3-6F Rain and drizzle
Thu -1-9F A couple of afternoon showers 
 
 24 Apr 13 | 14:48:26 /media/5/Conky/scripts
         $ /media/5/Conky/scripts/accweather.sh L#L#L#
Now Rain, 4C
Wed -3-6C Rain and drizzle
Thu -1-9C A couple of afternoon showers 
 
 24 Apr 13 | 14:48:54 /media/5/Conky/scripts
         $ 

KUDOS to damionhh for a great little script!
Results shown are for a Canadian Postal Code in London Ont.

Last edited by Sector11 (2013-04-24 18:02:51)


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

Offline

#5159 2013-04-24 18:40:05

kols
#! CrunchBanger
From: Norway
Registered: 2013-03-22
Posts: 151

Re: Conky v1.9 Thread

Here's mine!

crunchbang_april_by_kols-d62uvxr.png

Link to full view

It's a heavily edited version of the conky that comes with crunchbang

#####NOTE#####

The "#!" image at the top is a edited version of the file with the same name, except for "_white". So either remove "_white" or make that image yourself, and call it "...._white" smile

background yes
use_xft yes
xftfont Liberation Sans:Bold:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
#own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 20
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color ADAEB0
default_shade_color 000000
default_outline_color 828282
alignment middle_right
gap_x 20
gap_y 0
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

#lua_load ~/.scripts/draw_bg.lua
#lua_draw_hook_pre draw_bg

#${image /home/ojkolsrud/images/wallpapers/shared/crunchbang-logo-minimal_white.png -p 990,-1 -s 291x20}
TEXT
${image /home/ojkolsrud/images/wallpapers/shared/crunchbang-logo-minimal_white.png -p 10,0 -s 80x80}${goto 100}${color EAEAEA}${nodename}
${goto 100}${color EAEAEA}${kernel}





${goto 10}${color #FFFFFF}S Y S T E M    I N F O
${goto 10}${hr}
${goto 10}${color 1793D1}UP${goto 50}${color EAEAEA}${uptime}   
${goto 10}${color 1793D1}USER${goto 50}${color EAEAEA}${uid_name 1000}     

${goto 10}${color 1793D1}CPU ${goto 50}${color EAEAEA}${cpu cpu1}% | ${acpitemp}C ${goto 200}${cpugraph 10,40}
${goto 10}${color 1793D1}LOAD${goto 50}${color EAEAEA}${loadavg} ${goto 200}${loadgraph 10,40 -l}
${goto 10}${color 1793D1}PROC ${goto 50}${color EAEAEA}${processes} | ${running_processes}

${goto 50}${top name 1} ${goto 150}${top cpu 1}% 
${goto 50}${top name 2} ${goto 150}${top cpu 2}% 
${goto 50}${top name 3} ${goto 150}${top cpu 3}% 

${goto 10}${color 1793D1}MEM${goto 50}${color EAEAEA}${memperc}% | ${color EAEAEA}${mem}
${goto 10}${color 1793D1}SWAP${goto 50}${color EAEAEA}${swapperc}% | ${swap}

${goto 50}${top_mem name 1} ${goto 150}${top_mem mem 1}%
${goto 50}${top_mem name 2} ${goto 150}${top_mem mem 2}%
${goto 50}${top_mem name 3} ${goto 150}${top_mem mem 3}%

${goto 10}${color 1793D1}ROOT ${goto 50}${color EAEAEA}${fs_used_perc /}% | ${fs_used /} ${goto 200}${diskiograph sda8 10,40 -l}
${goto 10}${color 1793D1}HOME ${goto 50}${color EAEAEA}${fs_used_perc /home}% | ${fs_used /home}${goto 200}${diskiograph sda9 10,40 -l}

${goto 10}${color 1793D1}LINK ${goto 50}${color EAEAEA}${wireless_link_qual_perc eth3}% | ${wireless_essid eth3}
${goto 10}${color 1793D1}ADDR${goto 50}${color EAEAEA}${addr eth3}

${goto 10}${color 1793D1}RX ${goto 50}${color EAEAEA}${downspeed eth3} ${goto 100}| ${totaldown eth3}${goto 200}${downspeedgraph eth3 10,40 -t}
${goto 10}${color 1793D1}TX ${goto 50}${color EAEAEA}${upspeed eth3} ${goto 100}| ${totalup eth3}${goto 200}${upspeedgraph eth3 10,40 -t}

${goto 10}${color #FFFFFF}S H O R T C U T    K E Y S
${goto 10}${hr}
${goto 10}Alt+F2$alignr Run Dialog
${goto 10}Alt+F3$alignr Alt Menu
${goto 10}Super+Space$alignr Main Menu
${goto 10}Super+Tab$alignr Client Menu
${goto 10}Super+t$alignr Terminal
${goto 10}Super+f$alignr File Manager
${goto 10}Super+e$alignr Editor
${goto 10}Super+m$alignr Media Player
${goto 10}Super+w$alignr Web Browser
${goto 10}Super+h$alignr Task Manager
${goto 10}Super+l$alignr Lock Screen
${goto 10}Super+v$alignr Volume Control
${goto 10}Super+x$alignr Logout
${goto 10}PrtSc$alignr Screenshot

Last edited by kols (2013-04-24 18:42:14)


I mostly code at night. Mostly.

Offline

#5160 2013-04-25 14:38:20

grzegorzdabrowka
New Member
Registered: 2013-04-25
Posts: 3

Re: Conky v1.9 Thread

http://htmelek.republika.pl/

new version 002 on webside

9787b09cc533.png 197af50b530b.png 49c0fdcd468e.png05d5cdd52142.png 0c88a84401f8.png

Last edited by grzegorzdabrowka (2013-05-07 20:30:42)

Offline

#5161 2013-04-25 15:13:03

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

Re: Conky v1.9 Thread

@ grzegorzdabrowka

Very nice!
Bardzo ładnie!

"Kalendarz" is Polish right?
Kalendarz jest polskie prawo?

Last edited by Sector11 (2013-04-25 15:15:54)


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

Offline

#5162 2013-04-25 15:31:42

grzegorzdabrowka
New Member
Registered: 2013-04-25
Posts: 3

Re: Conky v1.9 Thread

Sector11 wrote:

@ grzegorzdabrowka

Very nice!
Bardzo ładnie!

"Kalendarz" is Polish right?
Kalendarz jest polskie prawo?

thank you very much Sector11
yes - polish

if somebody have batery, wifi or swap partition can test it, and send me screen

Last edited by grzegorzdabrowka (2013-04-25 15:32:42)

Offline

#5163 2013-04-25 16:02:39

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

Re: Conky v1.9 Thread

grzegorzdabrowka wrote:

thank you very much Sector11
yes - polish

if somebody have batery, wifi or swap partition can test it, and send me screen

sad no battery, no wifi, just swap ... my machine never uses it either.
But I have the code.  big_smile


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

Offline

#5164 2013-04-26 09:49:54

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i've some problems to include vnstat for the month. i want to include it in my v9000 smile

conky_parse("${execi 1 vnstat -i wlan0 -m | grep "`date +"%b '%y"`" | awk '{print $3 $4}'}")		

Offline

#5165 2013-04-26 16:30:01

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

Sector11 wrote:

"Kalendarz" is Polish right?
Kalendarz jest polskie prawo?

That means:
"Kalendarz is Polish law?"
Polish translator at Google is rubbish.
If I have to translate to Polish, most of the time I translate to... English. That way I can understand what it is about.
Google Polish translation is not understandable.



lionhead wrote:

i've some problems to include vnstat for the month. i want to include it in my v9000 smile

conky_parse("${execi 1 vnstat -i wlan0 -m | grep "`date +"%b '%y"`" | awk '{print $3 $4}'}")		

You parse Conky in LUA to parse shell in Conky... but you can parse shell in LUA without any third party interface:

function os_capture(cmd, raw)
	local f = assert(io.popen(cmd, 'r'))
	local s = assert(f:read('*a'))
	f:close()
	if raw then return s end
	s = string.gsub(s, '^%s+', '')
	s = string.gsub(s, '%s+$', '')
	s = string.gsub(s, '[\n\r]+', ' ')
	return s
end

and then

cmd=[[vnstat -i wlan0 -m | mawk '$0 ~ "'`date +"%b.+%y"`'" {print $3, $4}']]
monthVnstat = os_capture(cmd, raw)
print(monthVnstat)

Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#5166 2013-04-26 17:39:48

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

@dk75

but this way also works:

txt=conky_parse("${execi 1 vnstat -i "..device.." -w | grep 'current week' | awk '{print $3 $4}'}")
ms=conky_parse("${if_up "..device.."}"..parse(txt,del,se).."${else}offline${endif}")

i know that this is not the best way but it works for me. i do not like third-party tools. that's why the most of my code is only written in lua. that's the reason i always ask for the a 'lua-version' of the code.

because the code above is only a part of the function i post the whole function:

-- #####################################################################
-- ## parse conky-variables ############################################
-- #####################################################################

function chgDel(value,del)

local ausgang=nil
local ersteZahl=nil
local rest=nil
local outputNumber=nil

ausgang=string.gsub(value, "(%d*\.*%d+).*", "%1") -- remove ending
ausgang=tonumber(ausgang)

if not ausgang then ausgang=0; end

 if ((ausgang >= 10000) and (ausgang <= 99999.99)) then ----------------
       ersteZahl=string.sub(ausgang,1,2)
       rest=string.sub(ausgang,3,string.len(ausgang))
       
       if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",",")
	   else
	   outputNumber=ersteZahl..','..string.gsub(tostring(rest),"%,",".")
       end
       
 elseif ((ausgang>=1000) and (ausgang <9999.99)) then ------------------
       ersteZahl=string.sub(ausgang,1,1)
       rest=string.sub(ausgang,2,string.len(ausgang))
       
	   if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",del)
	   elseif del=="." then
	   outputNumber=ersteZahl..','..rest
       end
       
 elseif ausgang<999 then  ----------------------------------------------
	   if del=="," then
       outputNumber=string.gsub(tostring(ausgang),"%.",',')
	   elseif del=="." then
	   outputNumber=ausgang
       end
       
 elseif ausgang >=100000 then ------------------------------------------
	   
       ersteZahl=string.sub(ausgang,1,3)
       rest=string.sub(ausgang,4,string.len(ausgang))
       
	   if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",del)
	   elseif del=="." then
	   outputNumber=ersteZahl..','..rest
       end
       -----------------------------------------------------------------
 end

return outputNumber

end -- of function


function parse(value,delimiter,ending)
	local ms=nil
	value = value:gsub(" ","") --# remove spaces to account for inconsistencies in the inclusion of spaces in the output of different conky objects.
	local txt=nil
	local jn=nil
	
	if value==nil then value=0 end
	
	---- short_units no ------------------------------------------------
	if ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		jn=value:gsub("B","") -- only number
		jn=chgDel(jn,delimiter) -- chg format of the number
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." byte" end
	elseif string.find(value, 'KiB') ~= nil then
		jn=value:gsub("KiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." kb" end
	elseif string.find(value, 'MiB') ~= nil then
		jn=value:gsub("MiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." mb" end
	elseif string.find(value, 'GiB') ~= nil then
		jn=value:gsub("GiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." gb" end
	elseif string.find(value, "TiB") ~= nil then
		jn=value:gsub("TiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." tb" end
	---- short_units yes -----------------------------------------------
	elseif ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		jn=value:gsub("B","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." byte" end
	elseif string.find(value, "K") ~= nil then
		jn=value:gsub("K","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." kb" end
	elseif string.find(value, "M") ~= nil then
		jn=value:gsub("M","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." mb" end
	elseif string.find(value, "G") ~= nil then
		jn=value:gsub("G","") 
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." gb" end
	elseif string.find(value, "T") ~= nil then
		jn=value:gsub("T","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." tb" end
	else
		ms=value:gsub(" ","")
	end

	return ms
end -- of function


function system(cd) ----------------------------------------------------
-- you can call the function like this (example)
-- system({variable="totaldown",device="wlan0",del=',',se="no"})
local conky_order=nil
local variable=nil
local device=nil
local del=nil
local cs = nil
local ms = nil
local tf = nil
local txt=nil
local se=nil
------------------------------------------------------------------------
variable=cd.variable
device=cd.device or ''
del=cd.del or '.' -- delimiter
tf=cd.tf or '24' -- time format
se=cd.se or "yes" -- show ending

conky_order=conky_parse("${"..variable..' '..device.."}")
adv=parse(conky_order,del,se)

	if string.find(variable,"cpu") ~= nil then -------------------------
		if se=="no" then ms=conky_order else ms=conky_order.." %" end
	elseif string.find(variable,"uptime") ~= nil or string.find(variable,"user_number") ~= nil then
		ms=conky_order
	elseif ((string.find(variable, "perc") ~= nil) or (string.find(variable, "percent") ~= nil)) then
		if se=="no" then ms=conky_order else ms=conky_order.." %" end
	--------------------------------------------------------------------
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") == nil)) then
		jn=chgDel(adv,del)
		if se=="no" then ms=add_decimal(jn,del) else ms=add_decimal(jn,del).." mhz" end
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") ~= nil)) then
		jn=chgDel(adv,del)
		if se=="no" then ms=add_decimal(jn,del) else ms=add_decimal(jn,del).." ghz" end
	--------------------------------------------------------------------
	elseif string.find(variable,"addr") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_bitrate") ~= nil then
		txt=conky_order:gsub("Mb/s","")
		txt=txt:gsub(" ","")
		ms=conky_parse("${if_up "..device.."}"..add_decimal(txt,del).." mb/s".."${else}offline${endif}")
	elseif string.find(variable,"wireless_essid") ~= nil or string.find(variable,"wireless_mode") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_link_qual") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.." %".."${else}offline${endif}")
	elseif string.find(variable,"upspeedf") ~= nil or string.find(variable,"downspeedf") ~= nil then
		jn=chgDel(adv,del) -- chg format
		jn=add_decimal(jn,del)
		ms=conky_parse("${if_up "..device.."}"..jn.." kb/s".."${else}offline${endif}")

	elseif string.find(variable,"battery") ~= nil then
		ms=conky_order
	--------------------------------------------------------------------
	elseif string.find(variable,"prozessor") ~= nil or string.find(variable,"processor") ~= nil then
		ms=conky_parse("${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq}")
	elseif string.find(variable,"download") ~= nil and string.find(variable,"heute") ~= nil then
		txt=conky_parse("${execi 1 vnstat -i "..device.." | grep 'today' | awk '{print $2 $3}'}")
		ms=conky_parse("${if_up "..device.."}"..parse(txt,del,se).."${else}offline${endif}")
	elseif string.find(variable,"download") ~= nil and string.find(variable,"woche") ~= nil then
		txt=conky_parse("${execi 1 vnstat -i "..device.." -w | grep 'current week' | awk '{print $3 $4}'}")
		ms=conky_parse("${if_up "..device.."}"..parse(txt,del,se).."${else}offline${endif}")
	elseif string.find(variable,"download") ~= nil and string.find(variable,"monat") ~= nil then
		--ms=conky_parse("${execi 1 vnstat -i wlan0 -m | grep "`date +"%b '%y"`" | awk '{print $3 $4}'}")		
	--------------------------------------------------------------------
	elseif string.find(variable,"up") == nil and string.find(variable,"time") ~= nil then
		if tf == "24" then ---------------------------------------------
			if se=="no" then ms=adv else ms=adv.." uhr" end	
		elseif tf == "12" then
		ms=convert12(conky_order,tf) end -------------------------------
	else
	--------------------------------------------------------------------
		if string.find(device,"wlan") ~= nil or string.find(device,"eth") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.."${else}offline${endif}")
		elseif string.find(device,"media") ~= nil then
		ms=conky_parse("${if_mounted "..device.."}"..add_decimal(adv,del).."${else}not plugged in${endif}")
		else 
		ms=adv 
		end 
	--------------------------------------------------------------------
	end

	return ms
end -- of function


function convert12(value,format) -- convert 24h-format into 12h-format

local stunden=nil
local minuten=nil
local zeit=nil
local sekunden=nil

local stunden=string.sub(value,1,2)
local stunden=tonumber(stunden)
local minuten=string.sub(value,4,5)
local sekunden=string.sub(value,7,8)

if not sekunden then sekunden=''; end

if stunden > 12 and stunden < 24 then
	if sekunden ~= '' then
	zeit=(stunden-12)..':'..minuten..':'..sekunden..' pm'
	elseif sekunden == '' then
	zeit=(stunden-12)..':'..minuten..' pm'
	end
elseif stunden < 12 then
	if sekunden ~= '' then
	zeit=stunden..':'..minuten..':'..sekunden..' am'
	elseif sekunden == '' then
	zeit=stunden..':'..minuten..' am'
	end
elseif stunden == 12 then
	if sekunden ~= '' then
	zeit=stunden..':'..minuten..':'..sekunden..' pm'
	elseif sekunden == '' then
	zeit=stunden..':'..minuten..' pm'
	end
elseif stunden == 24 or stunden == 0 then
	if sekunden ~= '' then
	zeit=(stunden-12)..':'..minuten..':'..sekunden..' am'
	elseif sekunden == '' then
	zeit=(stunden-12)..':'..minuten..' am'
	end
end

return zeit

end

function add_decimal(input,sign) -- add decimal place

if string.find(input,"%a")==nil then
        if string.find(input,"%p")==nil then        
        input=input..sign..'0'
        end
end

return input
end

-- #####################################################################
-- ## end of functions to modify conky-output ##########################

Last edited by lionhead (2013-04-26 17:59:25)

Offline

#5167 2013-04-26 17:51:06

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

Re: Conky v1.9 Thread

dk75 wrote:
Sector11 wrote:

"Kalendarz" is Polish right?
Kalendarz jest polskie prawo?

That means:
"Kalendarz is Polish law?"
Polish translator at Google is rubbish.
If I have to translate to Polish, most of the time I translate to... English. That way I can understand what it is about.
Google Polish translation is not understandable.

lol  lol  well, I don't know enough Polish to realize that imTranslator (FF plugin) made that error.

Any machine translated text runs the risk of being "Tarzan speak: "Me Linux, you open-close air!"

It tells me that prawo = right and law [English ==> Polish]

I need to translate "to" Polish though, and at least grzegorzdabrowka understood me.
That's gotta count for something. smile


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

Offline

#5168 2013-04-26 23:03:28

Rutz
#! Member
Registered: 2012-12-26
Posts: 87

Re: Conky v1.9 Thread

Hey Guys.

I tried to use this script:

http://crunchbang.org/forums/viewtopic. … 7271#p7271

But it didn't work...can you help me?

${voffset 4}${font PizzaDude Bullets:size=14}${font}   Distrowatch Ranking: ${execi 3600 /etc/conky/iggykoopa-distrowatch.py}

while :; do eject -T; sleep 5; done
Unreliable Cup Holder

Offline

#5169 2013-04-26 23:05:27

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

^What did not work?  What was the error message?


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#5170 2013-04-26 23:09:49

Rutz
#! Member
Registered: 2012-12-26
Posts: 87

Re: Conky v1.9 Thread

It didn't appear.

How can I see error messages?


while :; do eject -T; sleep 5; done
Unreliable Cup Holder

Offline

#5171 2013-04-26 23:10:48

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

Run your conky from a terminal session and it will spit out any errors


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#5172 2013-04-26 23:19:50

Rutz
#! Member
Registered: 2012-12-26
Posts: 87

Re: Conky v1.9 Thread

Okay..It says:

from: can't read /var/mail/BeautifulSoup
/etc/conky/distrowatch.py: 6: address: not found
/etc/conky/distrowatch.py: 7: try:: not found
/etc/conky/distrowatch.py: 8: Syntax error: "(" unexpected

while :; do eject -T; sleep 5; done
Unreliable Cup Holder

Offline

#5173 2013-04-26 23:26:12

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

^ That python script is from 4 years ago... I am sure several of the url links have changed in the 4 years making it a broken script

You could go through the errors at each line and try to correct it


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#5174 2013-04-26 23:28:14

Rutz
#! Member
Registered: 2012-12-26
Posts: 87

Re: Conky v1.9 Thread

Okay...so it's the script.

Thanks smile


while :; do eject -T; sleep 5; done
Unreliable Cup Holder

Offline

Help fund CrunchBang, donate to the project!

#5175 2013-04-26 23:37:44

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

color change thermometers for v9000

Screenshot_at_2013_04_26_18_33_00.jpg

ragamartix's post a few back caught my interest and I had some free time so i tired incorporating the thermometers into a v9000 template

put this at the bottom of the template, outside of the weather function (after the final end)

function get_color(ctab)
--by mrpeachy 04/2013
local function color(col)
return {((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, 1}
end
local ncol=#ctab
local val=ctab[1]
local lownum=(ctab[2])[1]
local lowcol=color((ctab[2])[2])
local highnum=(ctab[ncol])[1]
local highcol=color((ctab[ncol])[2])
if val<=lownum then 
color=lowcol
elseif val>=highnum then
color=highcol
else
	for i=2,ncol do
	entry1=ctab[i]
	entry2=ctab[i+1] or ctab[i]
	lower=entry1[1]
	upper=entry2[1]
		if val>=lower and val<=upper then
		nentry=i
		end
	end
ctop=color((ctab[nentry+1] or nentry)[2])
ntop=(ctab[nentry+1] or nentry)[1]
clow=color((ctab[nentry])[2])
nlow=(ctab[nentry])[1]
i1=ntop-nlow
i2=val-nlow
c1=clow[1]+((ctop[1]-clow[1])*i2/i1)
c2=clow[2]+((ctop[2]-clow[2])*i2/i1)
c3=clow[3]+((ctop[3]-clow[3])*i2/i1)
c4=clow[4]+((ctop[4]-clow[4])*i2/i1)
color={c1,c2,c3,c4}
end
ctab=nil
return color
end--function
--#############################################################################################################################################################
function thermometer(therm)
--by mrpeachy 04/2013
local mx=therm.x or 0
local my=therm.y or 0
local tcol=therm.tcol
local temp=therm.val or 0
local label=therm.label or nil
local scale=therm.scale or 1
local units=therm.units or "F"
local font=therm.f or "Mono"
local fsize=therm.fs or "10"
local lines=therm.lines or 1
local numbers=therm.numbers or 1
therm=nil
--by mrpeachy 2011
if units=="F" then height=150 elseif units=="C" then height=160 end
local mx=mx*(1/scale)
local my=my*(1/scale)
cairo_scale (cr,scale,scale)
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,1)
--graphics outer
--bottom circle
r_outer=25
local lang_outer=335
local rang_outer=0+(360-lang_outer)
local h_outer=height-4--maybe make this a percentage?###########
cairo_arc (cr,mx,my,r_outer,(math.pi/180)*(rang_outer-90),(math.pi/180)*(lang_outer-90))
--coordinates,left line
local arc=(math.pi/180)*lang_outer
local lxo=0+r_outer*(math.sin(arc))
local lyo=0-r_outer*(math.cos(arc))
cairo_line_to (cr,mx+lxo,my+lyo-h_outer)
--coordinates,left line
local arc=(math.pi/180)*rang_outer
local rxo=0+r_outer*(math.sin(arc))
local ryo=0-r_outer*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxo+((rxo-lxo)/2),my+lyo-h_outer,(rxo-lxo)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxo+((rxo-lxo)),my+lyo)
cairo_stroke (cr)
----------------------------------------------
--graphics inner
--####################################################
if units=="F" then
cairo_set_source_rgba (cr,tcol[1],tcol[2],tcol[3],tcol[4])
--bottom circle
r_inner=r_outer-6
local lang_inner=lang_outer+9
local rang_inner=0+(360-lang_inner)
local h_inner=temp+30
cairo_arc (cr,mx,my,r_inner,(math.pi/180)*(rang_inner-90),(math.pi/180)*(lang_inner-90))
--coordinates,left line
local arc=(math.pi/180)*lang_inner
lxi=0+r_inner*(math.sin(arc))
local lyi=0-r_inner*(math.cos(arc))
cairo_line_to (cr,mx+lxi,my+lyi-h_inner)
--coordinates,left line
local arc=(math.pi/180)*rang_inner
rxi=0+r_inner*(math.sin(arc))
local ryi=0-r_inner*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxi+((rxi-lxi)/2),my+lyi-h_inner,(rxi-lxi)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxi+((rxi-lxi)),my+lyi)
cairo_fill (cr)
----------------------------
if lines==1 then
--scale lines
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,0.5)
local grad=10
local lnn=15
local lnx=mx+lxo
local lnw=(rxo-lxo)
	for i=1,lnn do
	lny=my-r_inner-(10+((i-1)*grad))-((rxi-lxi)/2)
		if i==lnn then
		lnx=lnx+2
		lnw=lnw-4
		end
	cairo_move_to (cr,lnx,lny)
	cairo_rel_line_to (cr,lnw,0)
	cairo_stroke (cr)
	end
end--if lines
if numbers==1 then
--numbers
cairo_set_source_rgba (cr,1,1,1,1)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local grad=20
local lnn=8
local lnx=mx+lxo+(rxo-lxo)+4
num={-20,"0°"..units,20,40,60,80,100,120}
for i=1,lnn do
lny=my-r_inner-(10+((i-1)*grad))-((rxi-lxi)/2)+(fsize/3)
cairo_move_to (cr,lnx,lny)
cairo_show_text (cr,num[i])
cairo_stroke (cr)
end
end--if label
end--if units=F
--#################################################
if units=="C" then
cairo_set_source_rgba (cr,tcol[1],tcol[2],tcol[3],tcol[4])
--cairo_set_source_rgba (cr,0,1,1,1)
--bottom circle
r_inner=r_outer-6
local lang_inner=lang_outer+9
local rang_inner=0+(360-lang_inner)
local h_inner=(temp*2)+60
cairo_arc (cr,mx,my,r_inner,(math.pi/180)*(rang_inner-90),(math.pi/180)*(lang_inner-90))
--coordinates,left line
local arc=(math.pi/180)*lang_inner
lxi=0+r_inner*(math.sin(arc))
local lyi=0-r_inner*(math.cos(arc))
cairo_line_to (cr,mx+lxi,my+lyi-h_inner)
--coordinates,left line
local arc=(math.pi/180)*rang_inner
rxi=0+r_inner*(math.sin(arc))
local ryi=0-r_inner*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxi+((rxi-lxi)/2),my+lyi-h_inner,(rxi-lxi)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxi+((rxi-lxi)),my+lyi)
cairo_fill (cr)
----------------------------
if lines==1 then
--scale lines
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,0.5)
local grad=10
local lnn=17
local lnx=mx+lxo
local lnw=(rxo-lxo)
	for i=1,lnn do
	lny=my-r_inner-(((i-1)*grad))-((rxi-lxi)/2)
		if i==lnn then
		lnx=lnx+2
		lnw=lnw-4
		end
	cairo_move_to (cr,lnx,lny)
	cairo_rel_line_to (cr,lnw,0)
	cairo_stroke (cr)
	end
end--if lines
if numbers==1 then
--numbers
cairo_set_source_rgba (cr,1,1,1,1)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local grad=20
local lnn=9
local lnx=mx+lxo+(rxo-lxo)+4
num={-30,-20,-10,"0°"..units,10,20,30,40,50}
for i=1,lnn do
lny=my-r_inner-(((i-1)*grad))-((rxi-lxi)/2)+(fsize/3)
cairo_move_to (cr,lnx,lny)
cairo_show_text (cr,num[i])
cairo_stroke (cr)
end
end--if label=none
end--if units=C
--#################################################
--label
if label~=nil then
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local lbx=mx+lxo-5
local lby=my-r_inner-10-((rxi-lxi)/2)
cairo_move_to (cr,lbx,lby)
cairo_rotate (cr,(math.pi/180)*(-90))
cairo_show_text (cr,label)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(90))
--temperature readout
cairo_set_source_rgba (cr,0,0,0,1)
local text=temp.."°"..units
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,mx-(width/2),my+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--if label
------------------------------------
cairo_scale (cr,1/scale,1/scale)
end--thermometer function
--#################################################################################################

then use in the template like this

--########################################################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
--########################################################################################
--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER
--[[
set a string named val to the valyue you want to display first, then use that string in the following 2 functions
use tonumber so that the output is a number
--]]
val=tonumber(now["temp"])
--val=tonumber(os.date("%S"))-10
--[[
get_color settings - this calculates the color of the thermometer inside
settings are inside ({ and }) and seperated by commas
	val needs to always be the first things set.  following val sub tables containing a number and a hex color are set
	sub tables set between { and } with the 2 values separated by a comma
	each sub table {},{} must be seperated from another sub table using a comma
the first number is the number at which the thermometer is that color
eg...  {0,0x00ff00} means that at value 0 the thermometer would be green
by setting multiple colors you can have the thermometer change according to a gradient
{0,0x00ff00},{100,0xff0000} would be green a 0, red at 100 and a gracient between the two colors at values in between

the get_color function outputs a lua formatted table containing the rgba color
tcol=get_color({}) stores that color in the tcol variable which is then used in the drawing function below
--]]
tcol=get_color({val,{20,0x00ffff},{40,0x00ff00},{60,0xffff00},{80,0xff7f00},{110,0xff0000}})
--[[
thermometer settings - this draws the thermometer
settings are inside ({ and }) and seperated by commas
x=x position (center of thermometer circle)
y=y position
lines=1 or 0 , 1 for scale lines, 0 for no scale lines
f=font (font name in quotes)
fs=font size
label=text to display on side, must be in brackets.  Do not set or set label=nil for no label
scale=size of thermometer, this affects all sizes including font size
units="C" or "F" 
val=val, leave this as it is, val is set above
tcol=tcol, leave this as it is to get the correct color change, tcol is set above
--]]
thermometer ({x=100,y=300,numbers=1,lines=1,f="sans",fs=12,label=weather_location,scale=1.5,units="F",tcol=tcol,val=val})

--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

still could do with some optimizing, but it is working for me smile

something new is the ability to set multiple color change points... this thermometer is sky blue up to 20 then transitions from blue to green from 20 to 40, green to yellow from 40 to 60, yellow to orange from 60 to 80 and then orange to red between 80 and 110 then stays red for anything over

Last edited by mrpeachy (2013-04-26 23:44:38)

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