SEARCH

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

You are not logged in.

#5126 2013-04-18 21:05:58

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

Last edited by ichase (2013-04-18 21:12:46)

Offline

Help fund CrunchBang, donate to the project!

#5127 2013-04-18 21:43:10

damionhh
Member
Registered: 2012-10-11
Posts: 45

Re: Conky v1.9 Thread

i know people have plenty of these but i just couldnt find one i liked.  heres mine

# !/usr/bin/bash
METRIC=0 #Should be 0 or 1; 0 for F, 1 for C
if [ -z $1 ]; then
    echo "USAGE: weather.sh <locationcode>"
    exit 0;
fi

wget -q http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 -O - | gawk \
'/Currently:/ {CurWeather=$0}
/[0-9][0-9][0-9][0-9] Forecast<\/title>/ {nr=NR+3; split($0,z," "); split(z[1],r,"/|>"); DateIndx[x+1]=mktime(sprintf("%s %s %s 0 0 0",r[4],r[2],r[3]))} 
NR==nr   {postIndx[++x]=$0}
# x>2    {exit}
END{
    split(CurWeather,tmp,"Currently: ")
    split(tmp[2],tmp1,"<")
    CurWeather=sprintf("%s",tmp1[1])
    sub(":",",",CurWeather)
    
    for(x in postIndx){
		split(postIndx[x],tmp,";|&")
		split(tmp[1],tmp,">")
		split(tmp[2],statement," F ") # substitute C for F if metric differs
		split(tmp[2],temp)
		forecast[++y]=sprintf("%s %d-%dF %-15s",strftime("%a",DateIndx[x]),temp[5],temp[2],statement[3])
    }
    printf("Now %s\n%s\n%s\n",CurWeather,forecast[1],forecast[2])
}'

and you call it from conky by using this line in your .conkyrc
you must have gawk installed also.  (thanks for pointing that out monica)

${execi 1800 /path/to/weather.sh 90011}

make sure to cut the script code and paste it into weather.sh and make the file executable.  replace 90011 with your actual zipcode.  checks every 30 minutes.  i modified this script i found over in the ArchLinux forums.

Last edited by damionhh (2013-04-25 00:38:00)

Offline

#5128 2013-04-18 23:22:59

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

Re: Conky v1.9 Thread

/                   140Gib / 360GiB
OOOOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXX

/server             140Gib / 360GiB
OOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

/external           140Gib / 360GiB
OOOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Last edited by Sector11 (2013-04-18 23:24:37)

Offline

#5129 2013-04-19 01:54:45

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

Offline

#5130 2013-04-19 02:14:24

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

Re: Conky v1.9 Thread

Last edited by PackRat (2013-04-19 02:17:01)


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

Offline

#5131 2013-04-19 02:24:16

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

Re: Conky v1.9 Thread

lua_load ~/bargraph_small_fs.lua
lua_draw_hook_post main_bars

TEXT

Offline

#5132 2013-04-19 02:45:42

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

Re: Conky v1.9 Thread

Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/v9000.lua:1746: attempt to perform arithmetic on global 'conum' (a nil value)

Last edited by mrpeachy (2013-04-19 02:50:17)

Offline

#5133 2013-04-19 08:05:29

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

Re: Conky v1.9 Thread

Offline

#5134 2013-04-19 09:30:16

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

Re: Conky v1.9 Thread

hello

the script works but it shows the error-message only three times (maybe after function gets the necessary datas?).

this is the call of the function (example):

draw_bar({var="cpu",dev="cpu0", w=150,h=10, x=15,y=400, bgc=0xffff00, indc=0x0000ff, lc=0x000000,lw=2})

i use conky_parse:

conum=conky_parse("${"..var..' '..dev.."}")
conum=tonumber(conum)

local inum=(((width-lw)/100)*conum)

btw: i tried the command 'print' at first smile

regards, alex

Offline

#5135 2013-04-19 10:17:47

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

Offline

#5136 2013-04-19 10:49:16

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

Re: Conky v1.9 Thread

package.path = "/home/climatix/.conky/conky6/?.lua"
require 'weathercircle' --for scriptA.lua ".lua" is not required here
require 'thermometer3'

function conky_main()
     conky_weather()
     conky_quadrants()
end

Offline

#5137 2013-04-19 13:02:04

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

Re: Conky v1.9 Thread

local inum=(((width-lw)/100)*(conum or 0))

Last edited by mrpeachy (2013-04-19 13:02:34)

Offline

#5138 2013-04-19 13:39:20

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

Re: Conky v1.9 Thread

thanks, it works. the terminal output looks much better  now wink

@mrpeachy

is there a chance to see new eye-candy in near future?

Offline

#5139 2013-04-19 22:11:54

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

Re: Conky v1.9 Thread

Offline

#5140 2013-04-20 13:05:50

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

Re: Conky v1.9 Thread

a glimmer of hope smile

Offline

#5141 2013-04-22 11:33:31

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

Re: Conky v1.9 Thread

package.path = "/home/climatix/.conky/conky6/?.lua"
require 'weathercircle' --for scriptA.lua ".lua" is not required here
require 'thermometer3'
require 'cairo'
require 'imlib2'

function conky_main()
     conky_weather()
     conky_quadrants()
end

Last edited by ragamatrix (2013-04-22 11:45:00)

Offline

#5142 2013-04-22 15:48:56

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

Re: Conky v1.9 Thread

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

function parse(value)
	local ms=nil
	---- short_units no ------------------------------------------------
	if ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		ms=(value:gsub("B",""))..' byte'	
	elseif string.find(value, 'KiB') ~= nil then
		ms=(value:gsub("KiB",""))..' kb'
	elseif string.find(value, 'MiB') ~= nil then
		ms=(value:gsub("MiB","")).." mb"
	elseif string.find(value, 'GiB') ~= nil then
		ms=(value:gsub("GiB","")).." gb"
	elseif string.find(value, "TiB") ~= nil then
		ms=(value:gsub("TiB","")).." tb"	
	---- short_units yes -----------------------------------------------
	elseif ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		ms=(value:gsub("B",""))..' byte'
	elseif string.find(value, "K") ~= nil then
		ms=(value:gsub("K",""))..' kb'
	elseif string.find(value, "M") ~= nil then
		ms=(value:gsub("M",""))..' mb'
	elseif string.find(value, "G") ~= nil then
		ms=(value:gsub("G",""))..' gb'
	elseif string.find(value, "T") ~= nil then
		ms=(value:gsub("T",""))..' tb'
	else
		ms=value:gsub(" ","")
	end
	--------------------------------------------------------------------
	return ms
end -- of function


function system(cd) ----------------------------------------------------

local conky_order=nil
local variable=nil
local device=nil
local del=nil
local cs = nil
local ms = nil
local tf = nil

variable=cd.variable
device=(cd.device or '')
del=(cd.del or '.')
tf=(cd.tf or '24')

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

	if string.find(variable,"cpu") ~= nil then -------------------------
		ms=conky_order.." %"
	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
		ms=conky_order.." %"
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") == nil)) then
		ms=adv.." mhz"
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") ~= nil)) then
		ms=adv.." ghz"
	--------------------------------------------------------------------
	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
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${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
		ms=conky_parse("${if_up "..device.."}"..adv.." kb/s".."${else}offline${endif}")
	--------------------------------------------------------------------
	elseif string.find(variable,"battery") ~= nil then
		ms=conky_order
	elseif string.find(variable,"up") == nil and string.find(variable,"time") ~= nil then
		if tf == "24" then ---------------------------------------------
		ms=adv..' uhr'
		elseif tf == "12" then
		ms=convert12(conky_order,tf) end -------------------------------
	elseif string.find(variable,"nodename") ~= nil or string.find(variable,"running_processes") ~= nil then
		ms=adv
	elseif string.find(variable,"processes") ~= nil or string.find(variable,"fs_type") ~= nil then
		ms=adv
	elseif string.find(variable,"conky_version") ~= nil or string.find(variable,"machine") ~= nil then
		ms=adv
	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

	cs=string.gsub(tostring(ms),"%.",del) -- replace delimiter
	return cs
end -- of function

-- #####################################################################
-- ## add decimal place ####################################################
-- #####################################################################

function add_decimal(input,sign)

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

return input
end

Last edited by lionhead (2013-04-22 15:54:10)

Offline

#5143 2013-04-22 20:40:27

rabidfox
#! CrunchBanger
Registered: 2010-09-22
Posts: 121

Re: Conky v1.9 Thread

[url=http://link.to.your.fullsized.image][img]http://link.to.your.thumbnail.image[/img][/url]

...But I'm ever so squeezable!

Offline

#5144 2013-04-22 23:53:52

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

Re: Conky v1.9 Thread

nitrogen --set-auto /path/to/wallpaper.png

Offline

#5145 2013-04-23 08:24:16

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

Re: Conky v1.9 Thread

Offline

#5146 2013-04-23 13:10:44

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

Re: Conky v1.9 Thread

Last edited by ragamatrix (2013-04-23 13:13:11)

Offline

#5147 2013-04-23 13:25:26

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

Re: Conky v1.9 Thread

Offline

#5148 2013-04-23 13:53:30

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

Re: Conky v1.9 Thread

@Sector11
Thanks; do you think it's possible to add the forecast of the next 3 hours; but it doesn't work with v9000 ?

Offline

#5149 2013-04-23 14:05:41

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

Re: Conky v1.9 Thread

Offline

Be excellent to each other!

#5150 2013-04-23 14:13:09

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

Re: Conky v1.9 Thread

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: bleh

Debian Logo