You are not logged in.
Hi Folks
well I have got rid of the warning
WARNING: gnome-keyring:: couldn't connect to: /home/gordon/.cache/keyring-f9X7
by coping an existing basic conky that comes with the distro but won't mark this as solved as I have no idea what caused it.
still no luck with the lua script though but I will keep trying
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
i have a little problem. i would like to display the status of the weather from this webpage:
if they show a specific image they display a special text, for example:
http://www.gco.org.au/weather/clearsky.gif ---> shows the word: clear
this is the code from their wegpage:
<SCRIPT LANGUAGE="JavaScript">
var boltwood='1'
var icon
var bolttext
if (boltwood == 0)
{icon = 'unknownsky.gif';bolttext='Unknown'}
else if (boltwood == 1)
{icon = 'clearsky.gif';bolttext='Clear'}
else if (boltwood == 2)
{icon = 'partcloudsky.gif';bolttext='Partly Cloudy'}
else if (boltwood == 3)
{icon = 'cloudsky.gif';bolttext='Very Cloudy'}
else if (boltwood == 4)
{icon = 'rainsky.gif';bolttext='Raining'}
document.write('<BR> <ALIGN=CENTER><IMG SRC=\"' + icon + '\" BORDER=0><BR>');
document.write('<ALIGN=CENTER><B><font color="yellow" face="Arial" size="2">' + bolttext + '</P></B>');
</SCRIPT>
Offline
i have a little problem. i would like to display the status of the weather from this webpage:
if they show a specific image they display a special text, for example:
http://www.gco.org.au/weather/clearsky.gif ---> shows the word: clear
this is the code from their wegpage:
<SCRIPT LANGUAGE="JavaScript"> var boltwood='1' var icon var bolttext if (boltwood == 0) {icon = 'unknownsky.gif';bolttext='Unknown'} else if (boltwood == 1) {icon = 'clearsky.gif';bolttext='Clear'} else if (boltwood == 2) {icon = 'partcloudsky.gif';bolttext='Partly Cloudy'} else if (boltwood == 3) {icon = 'cloudsky.gif';bolttext='Very Cloudy'} else if (boltwood == 4) {icon = 'rainsky.gif';bolttext='Raining'} document.write('<BR> <ALIGN=CENTER><IMG SRC=\"' + icon + '\" BORDER=0><BR>'); document.write('<ALIGN=CENTER><B><font color="yellow" face="Arial" size="2">' + bolttext + '</P></B>'); </SCRIPT>
So, it's that "boltwood" variable is changing, rest is static.
Then you can hardwire your own table with both icon and text depending on this variable and search for this variable value only:
--[[
Sunrise and Sunset time from http://www.gco.org.au/weather/weather.html page
usage:
default interval=3600 of conky updates (1h if conky_updates=1)
lua_load $HOME/path-to-script/sunriseset.lua
lua_draw_hook_pre conky_sunriseset
set custom interval=4000 of conky updates (1h 10m if conky_updates=1)
lua_load $HOME/path-to-script/sunriseset.lua
lua_draw_hook_pre conky_sunriseset 4000
--]]
local file_uri, file = "http://www.gco.org.au/weather/weather.html", "/tmp/weather.html"
local def_sunrise, def_sunset, startup, def_interval, fTab = "06:00:00", "18:00:00", false, 3600, {}
local sunrise, sunset, weatherNo = nil, nil, 0
local weatherTab={ { icon="unknow.gif", text="Unknow" }, { icon="clearsky.gif", text="Clear" }, { icon="partcloudsky.gif", text="Partly Cloudy" }, { icon="cloudsky.gif", text="Very Cloudy" }, { icon="rainsky.gif", text="Raining" } }
local function fetch_weather(updates, interval)
if startup then if (updates % interval) ~= 0 then return "100" end else startup=true end
os.execute("wget -q "..file_uri.." -O "..file.." &")
end
local function fetch_file(fw, updates, interval)
if ( fw ~= "100" and fTab[1] ~= nil ) or (updates % interval) ~= 0 then return "" end
i=0
local f=io.open(file, 'r')
if f then io.close(f) else return "200" end
for line in io.lines(file) do
i=i+1
fTab[i]=line
end
end
local function parse_table(ff)
if ff == "200" or fTab[1] == nil then return "300" end
local t, i, k, v = {}, 0, nil
for k, v in pairs(fTab) do
if string.find(v, ">Sunrise") then
for k in string.gmatch(v, "%d%d:%d%d:%d%d") do i=i+1; t[i]=k end
end
if string.find(v, "var boltwood") then t[0]=string.gsub(v, ".*(%d).*", "%1") end
end
if not t[0] or tonumber(t[0]) > 4 or tonumber(t[0]) < 0 then t[0]="0" end
if t[1] and t[2] then return "", t[1], t[2], t[0] else return "300", nil, nil, t[0] end
end
function conky_sunriseset(interval)
if conky_window == nil then return "0" end
local updates=tonumber(conky_parse('${updates}'))
if updates <= 5 then return "0" end
if not interval or tonumber(interval) < 3600 then interval=def_interval else interval=tonumber(interval) end
fw=fetch_weather(updates, interval)
ff=fetch_file(fw, updates, 15)
pt, sunrise, sunset, weatherNo = parse_table(ff)
if not sunrise or pt == "300" then sunrise=def_sunrise end
if not sunset or pt == "300" then sunset=def_sunset end
if not weatherNo then weatherNo=1 else weatherNo=tonumber(weatherNo)+1 end
if fw ~= "100" then fTab={} end
print("Sunrise = "..sunrise,"Sunset = "..sunset, "Icon = "..weatherTab[weatherNo].icon, "Text = "..weatherTab[weatherNo].text)
end
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
still no luck with the lua script though
but I will keep trying
Just a thought - maybe you've picked up on this already:
-- ####################################
ptint ('hello world')
-- ####################################
ptint = print <<-- I do the same all the time
Last edited by Sector11 (2013-03-09 13:10:57)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
this is the code from their wegpage:
@Sector11
you are not alone
@dk75
thanks for your help. this is a really good-looking webcam. look at it
Last edited by lionhead (2013-03-09 14:28:23)
Offline
Offline
I get the following
WARNING: gnome-keyring:: couldn't connect to: /home/gordon/.cache/keyring-f9X7tR/pkcs11: No such file or directory
Where do I find the keyring mentioned or do I just go to the .cashe and make it ?
This is only a warning message and won't cause any problems if you ignore it.
You have to run
/usr/bin/gnome-keyring-daemon --start --components=pkcs11
with your window managers "run command at login" function to get rid of that warning.
There are more options that may need to be added to the "--components=" section (as a comma separated list) if you use programs that need them but conky wants the "pkcs11" option.
Offline
Hi Folks,
Thanks for your help
@ Sector11,
Thanks for that but just for once I had actuall spotted that typo
@ arclance,
Thanks for the info. Not sure that I understand what you are saying when you say windows manager. Do you mean slim and if so how do I add that command or is it in oopenbox that it has to go ?
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
@ Gordon ...
OpenBox is the Window Manager of choice in #!
Probably need to put that command in ~/.config/openbox/autostart
Personally, I just deleted the keyring, I don't need it.
Last edited by Sector11 (2013-03-10 14:09:20)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
^ I believe that is correct for openbox but it needs to be
/usr/bin/gnome-keyring-daemon --start --components=pkcs11 &
if your window manager uses a startup script.
Offline
Hi arclance,
Thanks for the quick reply.
I have just opened openbox autostart and that line is already inserted, still not to worry as it causes no problems I'll just ignore it in future.
Next question if I can tag it on Iget this
Conky: llua_load: /home/gordon/lua/GordonsScripts/hello:5: '=' expected near 'yes'
I have nothing in the script that has a yes near it what is that about please ?
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
Hi arclance,
Thanks for the quick reply.
I have just opened openbox autostart and that line is already inserted, still not to worry as it causes no problems I'll just ignore it in future.
Post your whole "~/.config/openbox/autostart" file to see if there is anything that could cause it not to work in there.
Next question if I can tag it on Iget this
Conky: llua_load: /home/gordon/lua/GordonsScripts/hello:5: '=' expected near 'yes'
I have nothing in the script that has a yes near it what is that about please ?
I would need to see your script as it is now to help you with that.
Offline
Hey! i used the wallbydesk-script (thanks to ragamatrix) and non-sticky conkys to build kind of an command center on first desktop:
yes, for me there is a slight delay when switching desktops but only in combination with conky, which means the bg of the conkys changes about half a sec later than the rest, but this is not much of a problem and the mem-usage in idle increased by 2mb.
next step is to make the bottom-right conky clicky (i d love to only show the fs_bars on click) and to place a quarter ring launcher in the bottom left.
@ansem_of_nexus: love your new projekt!
@ all: thanks for all the knowladge and inspiration!
greetz -naik
Last edited by Naik (2013-03-10 23:31:35)
*kaum macht man es richtig, funktioniert es sofort*
Offline
@naik - nice one.
and:
@ all: thanks for all the knowladge and inspiration!
ditto that.
"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe
Offline
Hi arclance,
Sorry about the long delays in posting but I am not around a lot at the moment, rather busy with other things.
Here is my autostart menu, I have done nothing to this at all.
(\
nitrogen --restore && \
cb-compositor --start && \
sleep 2s && \
conky -q && \
tint2 \
) &
## Enable hot corners
cb-hotcorners --daemon &
## FIXME: volumeicons requires an extra-long sleep,
## else it fails to start?!
(sleep 30s && volumeicon) &
## Enable power management
xfce4-power-manager &
## Start Thunar Daemon
thunar --daemon &
## Detect and configure touchpad. See 'man synclient' for more info.
if egrep -iq 'touchpad' /proc/bus/input/devices; then
synclient VertEdgeScroll=1 &
synclient TapButton1=1 &
fi
## Start xscreensaver
xscreensaver -no-splash &
## Start Clipboard manager
(sleep 3s && parcellite) &
## The following command runs hacks and fixes for #! LiveCD sessions.
## Safe to delete after installation.
cb-cowpowers &
## cb-welcome - post-installation script, will not run in a live session and
## only runs once. Safe to remove.
(sleep 10s && cb-welcome --firstrun) &
## cb-fortune - have Statler say a little adage
#(sleep 120s && cb-fortune) &
## GNOME PolicyKit and Keyring
(\
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 && \
/usr/bin/gnome-keyring-daemon --start --components=ssh && \
/usr/bin/gnome-keyring-daemon --start --components=secrets && \
/usr/bin/gnome-keyring-daemon --start --components=pkcs11 && \
/usr/bin/gnome-keyring-daemon --start --components=gpg \
) &
and here is my lua script
-- this is a lua script for use in conky
require 'cairo'
background yes
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius
double_buffer yes
no_buffers yes
text_buffer_size 2048
gap_x 100
gap_y 100
minimum_size 260 700
-- maximum_width 190
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment top left
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
override_utf8_locale yes
use_xft yes
xftfont Comic Sans MS:size=8
xftalpha 0.5
uppercase no
default_color FFFFFF
color1 888888
color2 AAAAAA
color3 DDDDDD
color4 CC3333
color5 F09000
-- start of main function
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)
local cr=cairo_create(cs)
if updates(conky_parse('${updates}'))>5 then
-- ####################################
text1='hello world'
print (text1)
-- ####################################
end --if updates
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr = nil
end -- main function
I have tried it with just "print 'hello world'" as well as the way you see it now with the same result
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
Hi arclance,
Sorry about the long delays in posting but I am not around a lot at the moment, rather busy with other things.
![]()
Here is my autostart menu, I have done nothing to this at all.
## GNOME PolicyKit and Keyring (\ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 && \ /usr/bin/gnome-keyring-daemon --start --components=ssh && \ /usr/bin/gnome-keyring-daemon --start --components=secrets && \ /usr/bin/gnome-keyring-daemon --start --components=pkcs11 && \ /usr/bin/gnome-keyring-daemon --start --components=gpg \ ) &
This is wrong you can't call each component argument separately like that.
I think this was a error in a old version of #! when things were being tried to get rid of the "gnome-keyring" warning.
The correct command would be like this.
## GNOME PolicyKit and Keyring
(\
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 && \
/usr/bin/gnome-keyring-daemon --start --components=ssh,secrets,pkcs11,gpg \
) &
I don't know if you need the
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 && \
line or not in Openbox but I don't need it with Fluxbox.
All of this belongs in your .conkyrc not your Lua script, they are separate files.
background yes update_interval 1 cpu_avg_samples 2 net_avg_samples 2 temperature_unit celsius double_buffer yes no_buffers yes text_buffer_size 2048 gap_x 100 gap_y 100 minimum_size 260 700 -- maximum_width 190 own_window yes own_window_type override own_window_transparent yes own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below border_inner_margin 0 border_outer_margin 0 alignment top left draw_shades no draw_outline no draw_borders no draw_graph_borders no override_utf8_locale yes use_xft yes xftfont Comic Sans MS:size=8 xftalpha 0.5 uppercase no default_color FFFFFF color1 888888 color2 AAAAAA color3 DDDDDD color4 CC3333 color5 F09000
You load the lua script with "lua_load" in your .conkyrc and run it with "lua_draw_hook_pre" or "lua_draw_hook_post" most of the time.
There are other commands to run a script with but they are for more specialized scripts than the one you are working on.
You can find the documentation on those settings here.
Offline
Hi arclance
Thanks for that. I will try all that out later, poss tomorrow, going out now for the night with the ball and chain for a meal etc.
will let you know how it all goes later on
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
Hi arclance,
Well I have got there in the end. It is now working. I managed to find a couple of mistakes that I had made
The first one was I had pointed lua_draw_hook_pre to the wrong place / item ( main_box instead of conky_main ) in .conkyrc
The second one was a complete mess up of ' if updates ' which I had jumbled up with ' local updates '. All put ito one line of nothingness
Anyway thanks for all your time and efforts to sort me out without which I doubt that I would have got anywhere at all
THANK YOU
Cheers
Gordon
Using Janice Testing at present also sid and systemd and VSIDO
A7N8X delux motherboard, 1 GB ram, AMD ATHLON XP 2800+ ( 2255 Mhz ), Nvidia Geforce PNY 62000 graphics card
Offline
as the launcher wont launch and i am short in time i layed the control-center-thing aside for now and switched back to usual:
thanks to Nerdchotics for submitting the foundation for the wall.
greetz -naik
Last edited by Naik (2013-03-15 10:33:35)
*kaum macht man es richtig, funktioniert es sofort*
Offline
i made a function that displays several variables in conky and adds automatically custom endings.
the most variables that shows the unit 'percent' have the word 'perc' or 'percent within the name of the variable, for example
memperc
the variable 'cpu' also displays the unit % the problem is that this word doesn't use the word 'perc'. but there are also other variables that contain the word 'cpu' within, for example cpugauge
when i use this then it wont work
string.find(conky_variable, "cpu")~= nil
do u have an idea how i fix this?
Offline
Offline
i made a function that displays several variables in conky and adds automatically custom endings.
the most variables that shows the unit 'percent' have the word 'perc' or 'percent within the name of the variable, for example
memperc
the variable 'cpu' also displays the unit % the problem is that this word doesn't use the word 'perc'. but there are also other variables that contain the word 'cpu' within, for example cpugauge
when i use this then it wont work
string.find(conky_variable, "cpu")~= nil
do u have an idea how i fix this?
dunno how you use it but this snippet works for me in LUA terminal:
test="acpugauge"; if string.find(test, "cpu") then print("it is") else print("it is not") end
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
@ansem_of_nexus:
I tryed to, but recently i can`t get it to work...
edit: as for my last post: is there by any means a chance to wrap the output of the conky to the surface of the tablet? maybe with lua?
Last edited by Naik (2013-03-15 10:35:38)
*kaum macht man es richtig, funktioniert es sofort*
Offline
i hope that this works for all conky-variables:
function conky(cd)
-----------------------------
local conky_order=nil
local variable=nil
local device=nil
local del=nil
local cs = nil
local ms = nil
-----------------------------
variable=cd.variable
device=(cd.device or '')
del=(cd.del or '.')
-----------------------------
conky_order=conky_parse("${"..variable..' '..device.."}")
local value = conky_order:gsub(" ","")
---- 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"
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=conky_order.." Mhz"
elseif ((string.find(variable,"downspeedf") ~= nil) or (string.find(variable,"upspeedf") ~= nil)) then
ms=value:gsub(" ","").." kb/s"
elseif string.find(variable,"time") ~= nil then
ms=conky_order:gsub(" ","")
elseif string.find(variable,"cpu") ~= nil then
ms=conky_order.." %"
---- 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
------------------------------------------------------
cs=string.gsub(tostring(ms),"%.",del)
return cs
end -- of function
if u see something to optimize then please pm me
edit: i still have problems when this code is behind the first line:
elseif ((string.find(variable,"upspeed") ~= nil) and (string.find(variable,"f") == nil)) then
ms=value:gsub(" ","")
Last edited by lionhead (2013-03-15 20:38:24)
Offline
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