SEARCH

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

You are not logged in.

#4576 2013-01-12 17:12:59

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

Re: Conky v1.9 Thread

When you think of cache, you think about web browser cache which checks if content changed (not every time, but it work, more or less ok).
But imlib2 has been strip of this functionality by design.
There is however separate function to check if source image had changed, but not implemented in Conky.
It could be a good thing to have "flush if changes" options to "${image}" function instead simple "flush"... it would be.


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

Be excellent to each other!

#4577 2013-01-12 19:28:12

Mysterymason
New Member
Registered: 2012-11-27
Posts: 6

Re: Conky v1.9 Thread

I want to make conky semi-transparent (like 50% opacity), but I can't figure out how to do it. I've read everywhere and have tried all combinations of "own_window" elements. I have xcompmgr on and would appreciate some help. Thanks.

EDIT: I got it, don't worry.

Last edited by Mysterymason (2013-01-12 19:37:47)

Offline

#4578 2013-01-12 21:16:49

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

Hey!

I love the ${if_match ..} tag ever since i found it.
now i want it to run a little script for me (especially for my wife) whenever batterylvel runs low:

${if_match ${battery_percent} < 10}${color FF0000}${blink ${battery}}${exec ~/scripts/.batlow.sh}${color}${else}${battery}${endif}

but i am curious on how to tell conky to only run it once...
or to set the comand to run only ${if_match ${battery_percent} == 10} and to set the script to run only once in lets say 12 minutes ( to make sure ${battery_percent} changes during this intervall)?
or is there a way to force this in the script itself?

#!/bin/bash
#small and easy power notifierscript for #! waldorf

notify-send -i gtk-dialog-info -t 400000 -- "Achtung!" "Akku bald leer!" && cvlc --volume 512 ~/music/batlowsound.mp3

exit

i am really new to bash and don`t know if ther can be used a counter or something.

Thanks in advance!
Naik

edit: cleand up conky line

Last edited by Naik (2013-01-12 21:25:05)


*kaum macht man es richtig, funktioniert es sofort*

Offline

#4579 2013-01-12 21:22:22

profoundWHALE
New Member
Registered: 2012-09-14
Posts: 9

Re: Conky v1.9 Thread

Hey, after a long time of not contributing... here!
Here's what it looks like

I even included an installer.sh and uninstaller.sh that will keep your precious settings safe.
(although, I'm still new to this, so it'd be nice if someone could check it for me)

And it should be noted, that the most I did was add a few tweaks to the .conkyrc and add an installer and uninstaller.

Last edited by profoundWHALE (2013-01-12 21:24:39)

Offline

#4580 2013-01-12 22:31:36

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

Re: Conky v1.9 Thread

Naik wrote:

Hey!

I love the ${if_match ..} tag ever since i found it.
now i want it to run a little script for me (especially for my wife) whenever batterylvel runs low:

${if_match ${battery_percent} < 10}${color FF0000}${blink ${battery}}${exec ~/scripts/.batlow.sh}${color}${else}${battery}${endif}

but i am curious on how to tell conky to only run it once...
or to set the comand to run only ${if_match ${battery_percent} == 10} and to set the script to run only once in lets say 12 minutes ( to make sure ${battery_percent} changes during this intervall)?
or is there a way to force this in the script itself?

#!/bin/bash
#small and easy power notifierscript for #! waldorf

notify-send -i gtk-dialog-info -t 400000 -- "Achtung!" "Akku bald leer!" && cvlc --volume 512 ~/music/batlowsound.mp3

exit

i am really new to bash and don`t know if ther can be used a counter or something.

Thanks in advance!
Naik

edit: cleand up conky line

there is something you can try

check this

:~$ df -h |grep '/run/lock'
tmpfs           5,0M     0  5,0M   0% /run/lock
:~$

if it's "tmpfs" for you too, then we are home.
TMPFS is special filesystem residing in RAM (I've moved my /tmp into it wink ) so it means any operation on it are fast.
If so, making file in it and checking from BASH if it exist shoulden't be a burden to the system (system is doing it all the time).
So, your BASH code should look like that:

#!/bin/bash
#small and easy power notifierscript for #! waldorf

if [ ! -e /run/lock/battalarm ]   #IF NOT EXIST /run/lock/battalarm THEN
then
   touch /run/lock/battalarm   #CREATE /run/lock/battalarm
   notify-send -i gtk-dialog-info -t 400000 -- "Achtung!" "Akku bald leer!" && cvlc --volume 512 ~/music/batlowsound.mp3
fi

exit

and you should add something to clear that file in Conky $else function:

${if_match ${battery_percent} < 10}${color FF0000}${blink ${battery}}${exec ~/scripts/.batlow.sh}${color}${else}${exec bash -c 'if [ -e /run/lock/battalarm ]; then rm -f /run/lock/battalarm; fi'}${battery}${endif}

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

#4581 2013-01-12 23:37:50

7vincent7black7
Member
Registered: 2012-05-20
Posts: 16

Re: Conky v1.9 Thread

[Post Contents Terminated by User]

Last edited by 7vincent7black7 (2013-01-20 00:05:58)


[ I Have No Greeting!]

Offline

#4582 2013-01-12 23:58:27

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

Re: Conky v1.9 Thread

7vincent7black7 wrote:

Hey, I grabbed chunks of conkys from the first few pages of this thread, that summed up the information I wanted to see and it works great. Only thing is the time is a 24 hour clock based instead of 12 a.m. and 12 p.m. Lemme post the conky here and could someone tell me what to replace with what in the area I underline?

Edit: underline and whatnot is not working, just look just under text and date and time is addressed under that header bit, first two lines under that, I think I need to change the code on the second line, but don't know the proper syntax for a 12 hour clock that might also have A.M and P.M as well as a plus. If it could use a sun and/or moon icons as night and day that would be epic but not necessary by any means. tongue

change:

${time %H:%M}

to

${time %l:%M %p}

for a 12-hour clock indicating AM/PM -- use a capital "P" if you want lower case am/pm.

For all options:

man date

in a terminal.

You would have to use another script and/or clock if you want an icon changing with the time.

Last edited by PackRat (2013-01-12 23:59:53)


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

Offline

#4583 2013-01-13 06:37:31

stolid
#! CrunchBanger
Registered: 2012-09-06
Posts: 206

Re: Conky v1.9 Thread

I'd like to share my basic weather script. I just wanted something basic and text-based, so I made one myself using yahoo's API. It just does current weather and two day forecast (limit of the API, I'm afraid, but all I need...). You'll need your location WOEID which you can lookup here: http://woeid.rosselliot.co.nz/lookup/

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, urllib
from xml.dom import minidom

location = '12345678' #WOEID

url = 'http://weather.yahooapis.com/forecastrss?w='+location+'&u=f'
xml = minidom.parse(urllib.urlopen(url))
#forecast = day : (dayname, high, low, description)
current = {'temp':-999, 'desc':'Default description'}
forecast = {} # day : (dayname, high, low, description)

a = xml.getElementsByTagName('channel')[0]
b = a.getElementsByTagName('item')[0]
c = b.getElementsByTagName('yweather:condition')[0]
current['desc'] = c.attributes['text'].value
current['temp'] = c.attributes['temp'].value

d = b.getElementsByTagName('yweather:forecast')
forecast['today'] = d[0].attributes['day'].value, d[0].attributes['high'].value, d[0].attributes['low'].value, d[0].attributes['text'].value
forecast['tomorrow'] = d[1].attributes['day'].value, d[1].attributes['high'].value, d[1].attributes['low'].value, d[1].attributes['text'].value

#Conky formatting (format1 is in front of the line, format2 is after the colon)
format1 = '${color 729FCF}${font Source Sans Pro Regular:bold:size=10}'
format2 = '$font$color ${goto 55}'
conky = '{0}Now:{1} {2}°, {3}\n'.format(format1, format2, current['temp'], current['desc'])
conky += '{0}{1}:{2} {3}° Hi, {4}° Low, {5}\n'.format(format1,forecast['today'][0],format2, forecast['today'][1], forecast['today'][2], forecast['today'][3])
conky += '{0}{1}:{2} {3}° Hi, {4}° Low, {5}\n'.format(format1,forecast['tomorrow'][0],format2, forecast['tomorrow'][1], forecast['tomorrow'][2], forecast['tomorrow'][3])

print conky

I use it like this:

${execpi 900 $HOME/weather.py}

Conky Weather

Last edited by stolid (2013-01-13 06:38:52)


Registered Linux User #555399
crunchbox:     Phenom II X6 1055T | 8GB RAM | OCZ Vertex 4 128GB | Radeon 7870XT | Win7 / #! 11 (i3 WM)
lambdacore:     4x Opteron 8431 | 16GB RAM | 2x1TB mirrored (ZFSoL) | Debian 7 (headless)
crunchtop:     Acer Aspire 1410 11.6" | 2GB RAM | Crucial M4 128GB | #! 11 (i3 WM)

Offline

#4584 2013-01-13 09:25:32

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

dk75 wrote:

check this

:~$ df -h |grep '/run/lock'
tmpfs           5,0M     0  5,0M   0% /run/lock
:~$

df -h |grep '/run/lock'
>>>nothing habbens!!!!

bash: tmpfs: Kommando nicht gefunden.

it should be possible to install and use it ???

@stolid: Thanks for sharing! This is exactly what i was looking for, for all those other  titanic weather scripts with them pix and stuff are way too big for my little 13" screen lol

thanks for your fast repley!!!

Last edited by Naik (2013-01-13 09:56:00)


*kaum macht man es richtig, funktioniert es sofort*

Offline

#4585 2013-01-13 09:33:14

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

Re: Conky v1.9 Thread

OK then, try

df -h

maybe it is not /run/lock but just /run, let's see


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

#4586 2013-01-13 10:10:43

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

ok, this gives me:

tmpfs                                                   202M    632K  201M    1% /run
/dev/disk/by-uuid/590dd45d-781f-4d55-8fb2-756a98157935   97G     48G   44G   53% /
tmpfs                                                   5,0M       0  5,0M    0% /run/lock
tmpfs                                                   1,8G     72K  1,8G    1% /run/shm

is that right so far?


*kaum macht man es richtig, funktioniert es sofort*

Offline

#4587 2013-01-13 11:00:10

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

Re: Conky v1.9 Thread

then proceed


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

#4588 2013-01-13 12:24:54

7vincent7black7
Member
Registered: 2012-05-20
Posts: 16

Re: Conky v1.9 Thread

[Post Contents Terminated by User]

Last edited by 7vincent7black7 (2013-01-20 00:06:17)


[ I Have No Greeting!]

Offline

#4589 2013-01-13 15:25:41

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

if i get this right the process battalarm is created no matter what my script is called, right? so i don`t need to change this...
Thank you man! I will try this and be right bacxk with the full setting if it works...
Thanks again!


*kaum macht man es richtig, funktioniert es sofort*

Offline

#4590 2013-01-13 19:20:04

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

Re: Conky v1.9 Thread

how can i grab an image (webcam) with help of lua?

currently i'm using something similar like this:

${execi 60 /home/alexander/v9000/vlt.sh}

within the vlt.sh i use this code:

wget  -q -O  /tmp/vlt.jpg "http://www.eso.org/public/webcams/vlt.jpg"

Offline

#4591 2013-01-13 19:28:22

JLloyd13
#! Member
Registered: 2012-08-08
Posts: 83

Re: Conky v1.9 Thread

pretty simple stuff.

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual
own_window_argb_value 50
double_buffer yes
minimum_size 150 100
maximum_width 200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color ffffff
default_shade_color black
default_outline_color ffffff
alignment top_left
gap_x 8
gap_y 8
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT
${color ffffff}${font sans-serif:bold:size=8:}SYSTEM ${hr 2}
${font sans-serif:normal:size=8}Type:$alignr$machine
Speed:$alignr${freq_g}GHz
OS:$alignr${pre_exec uname -o}
Kernel$alignr$kernel
Host:$alignr$nodename
Uptime:$alignr$uptime
File System: $alignr${fs_type}
User(s):$alignr${pre_exec whoami}

${font sans-serif:bold:size=8}PROCESSORS ${hr 2}${font sans-serif:normal:size=8}
CPU0: ${cpu cpu0}% ${cpubar cpu0}
CPU1: ${cpu cpu1}% ${cpubar cpu1}
CPU2: ${cpu cpu2}% ${cpubar cpu2}
CPU3: ${cpu cpu3}% ${cpubar cpu3}

${font sans-serif:bold:size=8}MEMORY ${hr 2}
${font sans-serif:normal:size=8}RAM $alignc $mem / $memmax $alignr $memperc%
$membar

#${font sans-serif:bold:size=8}${color FF9900}FOLDING AT HOME ${hr 2}${font #sans-serif:normal:size=8}
#${color yellow}Work Unit:                            ${execi 15 cat /var/ # #lib/fahclient/log.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|
#tail -n 1 | tr -d 'percent' | tr -d '%'} % 
#${execibar 15 cat /var/lib/fahclient/log.txt | tr '(' '\n' |tr ')' '\n' | # #grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'} 
${font sans-serif:bold:size=8}DISKS ${hr 2} 
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr${fs_used_perc /}%
${fs_bar /}
/home $alignc ${fs_used /home} / ${fs_size /home} $alignr${fs_used_perc /home}%
${fs_bar /home}

Disk IO:$alignr${diskio}
${diskiograph}

${font sans-serif:bold:size=8}PROCESSES ${hr 2}
${font sans-serif:normal:size=8}1.${top_mem name 1}${alignr}${top mem 1} %
2.${top_mem name 2}${alignr}${top mem 2} %
3.$font${top_mem name 3}${alignr}${top mem 3} %
4.$font${top_mem name 4}${alignr}${top mem 4} %
5.$font${top_mem name 5}${alignr}${top mem 5} %

${font sans-serif:bold:size=8}DATE ${hr 2}
${alignc 35}${font Arial Black:size=26}${time %H:%M}${font}
${alignc}${time %A %d %B}

${font sans-serif:bold:size=8}NETWORK ${hr 2}
${font sans-serif:normal:size=8}IP address: $alignr ${addr wlan0}
#IF USING WIRELESS CHANGE eth0 to wlan0
ESSID: $alignr ${wireless_essid wlan0}
Connection Quality: $alignr ${wireless_link_qual_perc wlan0}%

Upload:$alignr${upspeed wlan0}
${upspeedgraph wlan0}
Download:$alignr${downspeed wlan0}
${downspeedgraph wlan0}

2013_01_13_102341_180x747_scrot.png

perhaps the only real cool part of mine in the f@h readout.. which is commented out ATM LOL. it was pieced together from a bunch of different sources on the web, but now since I know more about cat, grep, etc. I've been considering rewriting it for lower usage, or making a version for boinc.

Offline

#4592 2013-01-13 19:33:52

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

lionhead wrote:

how can i grab an image (webcam) with help of lua?

currently i'm using something similar like this:

${execi 60 /home/alexander/v9000/vlt.sh}

within the vlt.sh i use this code:

wget  -q -O  /tmp/vlt.jpg "http://www.eso.org/public/webcams/vlt.jpg"

This code

local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, 60) == 0) then
	os.execute('wget  -q -O  /tmp/vlt.jpg "http://www.eso.org/public/webcams/vlt.jpg"')
end --#

will run your command every 60 seconds.
The if statement checks if it is time to run the command.
The os.execute() line runs the command without it being connected to conky so it will not lock up you conky if it runs slow.

Offline

#4593 2013-01-13 20:11:15

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

Re: Conky v1.9 Thread

@arclance

dou have an idea why this won't work?

function webcam(internet,festplatte)

x=nil
x=0
y=nil
y=0
w=nil
w=200
h=nil
h=200
file=nil
file=festplatte
web=internet

local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, 60) == 0) then
	os.execute("wget  -q -O"..file..web)
end --#


if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then 
width=imlib_image_get_width() 
else
width=tonumber(w)
end
if tonumber(h)==0 then 
height=imlib_image_get_height() 
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function webcam ##################################################################

Offline

#4594 2013-01-13 20:21:10

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

I don't know for sure since you did not say how it failed.
Do you get any errors in the terminal?

One thing I see that could cause the wget command to fail is that you did not put any spaces between the variables join on this line.

os.execute("wget  -q -O"..file..web)

so your wget command may not be working unless you are passing the spaces to your function.
You are also leaving out the "" around the web address unless you are passing that to your function

I would recommend you change that line to be.

os.execute("wget  -q -O "..file..' "'..web..'"')

so it will work if you call the function like this.

webcam("http://www.eso.org/public/webcams/vlt.jpg", "/tmp/vlt.jpg")

Last edited by arclance (2013-01-13 20:29:54)

Offline

#4595 2013-01-13 20:28:56

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

Re: Conky v1.9 Thread

hmm, just some quotes. it works smile

Offline

#4596 2013-01-14 06:13:57

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

dk75 wrote:

then proceed

hm... if i do as you told me its like i would have done nothing... the script is called everytime conky updates (wich is twice a second indeed)...
this sucks

${if ...}${exec ~/scripts/.batlow.sh}${else}${exec bash -c 'if [ -e /run/lock/battalarm ]; then rm -f /run/lock/battalarm; fi'}${endif}
#!/bin/bash
#small and easy power notifierscript for #! waldorf

if [ ! -e /run/battalarm ]   #IF NOT EXIST /run/lock/battalarm THEN
then
   touch /run/battalarm   #CREATE /run/lock/battalarm
   notify-send -i gtk-dialog-info -t 400000 -- "Achtung!" "Akku bald leer!" && mocp -s && mocp -c -a ~/music/alarmsound.mp3 && mocp -p 
fi

exit

*kaum macht man es richtig, funktioniert es sofort*

Offline

#4597 2013-01-14 08:19:00

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

Re: Conky v1.9 Thread

And now, look at it, and why do you se /run/battalarm in your code where in comments and in my code there is /run/lock/battalarm?

Hint: /run have no access for normal user, but /run/lock have - use my code instead yours


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

#4598 2013-01-14 09:43:48

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

taDJpYw

Offline

#4599 2013-01-14 10:38:57

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

Re: Conky v1.9 Thread

i want to cut a string out of another string. therefore i need the position of the last appearance of a sign.

here is an example

the main-string:

http://www.eso.org/public/webcams/vlt.jpg

the part i'm looking for:

vlt.jpg

in this case i need the position of the sign / 

i know that it is possible to find the last appearance of a sign (if u use other programming languages). but i do not know how do realize this in lua? does string.find has a parameter to find the necessary position? i can not find something sad

Offline

Help fund CrunchBang, donate to the project!

#4600 2013-01-15 04:36:02

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

Re: Conky v1.9 Thread

Here

s="http://www.eso.org/public/webcams/vlt.jpg"
s=string.gsub(s, ".*/(.*)", "%1")
print("Substring:", s)

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

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