SEARCH

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

You are not logged in.

#251 2012-04-14 00:30:17

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

Re: interactive conky

@mrpeachy

While adding some buttons to my system conky I found a bug in you button code.
If you have a conky with part of the window outside the x-screen such that its top left corner has a negative postion in X or Y these lines do not work.

s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")

For example this is what

xwininfo -name 'system_Conky' | grep 'Absolute'

reports for my system info conky.

  Absolute upper-left X:  3219
  Absolute upper-left Y:  -2

This happens because the top two pixels of this conky are outside the top of the x-screen.
The negative sign causes

s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")

to return an empty string.

This is what I did to allow for the negative sign and make the script work in again.

s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")
if abstlx == "" then
print ("abstlx empty")
s,f,abstlx=string.find(geometry,"X%p%s*(-%d*)")
abstlx = tonumber(abstlx)
end-- if abstlx == ""
if abstly == "" then
print ("abstly empty")
s,f,abstly=string.find(geometry,"Y%p%s*(-%d*)")
abstly = tonumber(abstly)
end-- if abstly == ""

If you know a better way to do this with lua please let us know.

Offline

Be excellent to each other!

#252 2012-04-14 00:56:09

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

Re: interactive conky

arclance wrote:

@mrpeachy

While adding some buttons to my system conky I found a bug in you button code.
If you have a conky with part of the window outside the x-screen such that its top left corner has a negative postion in X or Y these lines do not work.

s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")

thats because my regex doesnt take into account the - sign
... this should fix it but i would have to test

s,f,abstlx=string.find(geometry,"X%p%s*(%p*%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%p*%d*)")

Offline

#253 2012-04-14 00:58:20

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

Re: interactive conky

falldown wrote:

Peachy On the topic of my untitled windows.
I figured out that one window was a conky window..
and the other is my Tint2 panel.
Both are an easy fix.

Now I am in the process of dividing the two functions.. (Launcher and Window list)
Having them run in separate conkies.

Launcher running across the top as a panel
and the window list running across the bottom as a panel.

how goes?

Offline

#254 2012-04-14 01:04:37

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

Re: interactive conky

mrpeachy wrote:
arclance wrote:

@mrpeachy

While adding some buttons to my system conky I found a bug in you button code.
If you have a conky with part of the window outside the x-screen such that its top left corner has a negative postion in X or Y these lines do not work.

s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")

thats because my regex doesnt take into account the - sign
... this should fix it but i would have to test

s,f,abstlx=string.find(geometry,"X%p%s*(%p*%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%p*%d*)")

Thanks that worked.

Offline

#255 2012-04-14 01:38:14

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

peachy wrote:

how goes?

The fix was simple.. I changed the conky back to panel and I removed Tint2 panel for the time being.. cause your window list script works flawlessly for me so-far big_smile

Offline

#256 2012-04-14 17:20:55

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

Well separating the Launcher from the Window List is turning out to be a bit more challenging then I originally thought.!
I will figure it out! big_smile

Addition
Peachy if you disable your Gnome panel.. does the Window List part of your Conky Panel still function properly?
When I disable my Tint2 on start-up.. Only the Launcher part of my Conky Panel works.

Last edited by falldown (2012-04-14 17:51:20)

Offline

#257 2012-05-12 13:51:11

gmonti
#! CrunchBanger
From: Caracas, Venezuela
Registered: 2011-12-07
Posts: 108

Re: interactive conky

All days are special, but there are special days more special themselves, because it is someone very special birthday. In Venezuela was born long time ago a special person Luis Cruz http://www.noticiasexceso.com/component … nos-felizq who wrote the most beatifull birthday song http://youtu.be/fSsa4oXz4YM i know, and i like to dedicate that song to our friend S11. Happy Birthday.

Last edited by gmonti (2012-05-12 13:54:16)


Giuliano Monti Avellino
Debian/Squeeze
Gnome

Offline

#258 2012-05-12 15:55:29

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

Re: interactive conky

gmonti wrote:

All days are special, but there are special days more special themselves, because it is someone very special birthday. In Venezuela was born long time ago a special person Luis Cruz http://www.noticiasexceso.com/component … nos-felizq who wrote the most beatifull birthday song http://youtu.be/fSsa4oXz4YM i know, and i like to dedicate that song to our friend S11. Happy Birthday.

probably best to post this in the monster conky thread
but, seeing as it is here

HAPPY BIRTHDAY SECTOR11!

Offline

#259 2012-05-12 16:00:25

gmonti
#! CrunchBanger
From: Caracas, Venezuela
Registered: 2011-12-07
Posts: 108

Re: interactive conky

mrpeachy wrote:
gmonti wrote:

All days are special, but there are special days more special themselves, because it is someone very special birthday. In Venezuela was born long time ago a special person Luis Cruz http://www.noticiasexceso.com/component … nos-felizq who wrote the most beatifull birthday song http://youtu.be/fSsa4oXz4YM i know, and i like to dedicate that song to our friend S11. Happy Birthday.

probably best to post this in the monster conky thread
but, seeing as it is here

HAPPY BIRTHDAY SECTOR11!

Thank You, you are right, my mistake sorry


Giuliano Monti Avellino
Debian/Squeeze
Gnome

Offline

#260 2012-05-12 20:40:39

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

Re: interactive conky

Awwwwwwwwwww shucks BLUSH Thanks guys!!


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

Offline

#261 2012-05-22 22:52:26

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

Re: interactive conky

@ falldown

I grabbed the archive and then tried to capture an image on YouTube - that didn't work so I installed from the files.

I'm running it, I had to modify the:

minimum_size 850 400
maximum_width 850

Or I only saw half of it ....

Fixed all the /path/to/ things ... and:

aagsqyTI.jpg
It doesn't look the same, did I do something wrong?

It's blue and transparent - normal?
Not tan/brown like in the YouTube video.

Last edited by Sector11 (2012-05-22 22:54:08)


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

Offline

#262 2012-05-23 01:32:29

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

S11 wrote:

It's blue and transparent - normal?
Not tan/brown like in the YouTube video.

Looks spot on S11
The cyan-blue transparent is correct and looks much better on a darker wallpaper.
I do notice that your wind direction png is missing.
I had an issue with youtube videos being colored wrong and had to update my flash player.

Also #1 I'm sorry about the dimensions in the rc being off.. I'm sure at some point I was messing with it and forgot to change it back.
Also #2 I'm pretty sure that I forgot to put the fonts in the dropbox file.

Last edited by falldown (2012-05-23 01:45:58)

Offline

#263 2012-05-23 03:09:00

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

Re: interactive conky

falldown wrote:
S11 wrote:

It's blue and transparent - normal?
Not tan/brown like in the YouTube video.

Looks spot on S11
The cyan-blue transparent is correct and looks much better on a darker wallpaper.
I do notice that your wind direction png is missing.
I had an issue with youtube videos being colored wrong and had to update my flash player.

Also #1 I'm sorry about the dimensions in the rc being off.. I'm sure at some point I was messing with it and forgot to change it back.
Also #2 I'm pretty sure that I forgot to put the fonts in the dropbox file.

OH, OK, blue it is.  Yea, it's best on dark backgrounds.
If you notice I'm using the different images as well, but the direction icons are there.
Mine you, I'm using my original ~/v9000 directory and ~/.v9000_config.lua as well, so that might have something to do with it.

I'll check that out tomorrow.

What fonts?


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

Offline

#264 2012-05-23 18:09:03

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

S11
Here are the fonts..
http://dl.dropbox.com/u/60081679/Fonts.tar.gz

Your .v9000_config.lua might be the reason for not having a Wind.png.

Offline

#265 2012-05-23 19:09:49

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

Re: interactive conky

falldown wrote:

S11
Here are the fonts..
http://dl.dropbox.com/u/60081679/Fonts.tar.gz

Your .v9000_config.lua might be the reason for not having a Wind.png.

Quite possibly is, I haven't checked the difference, been a bit busy.  big_smile

mrpeachy - for you too: check it out: Conky PitStop: Interactive Weather v9000
Fonts included.

cyber-v9000.tar.gz was too large to be hosted at CPS so it is in my DropBox.  Just falldown's images was too big for CPS with a 2MB file limit. big_smile

Last edited by Sector11 (2012-05-23 19:10:15)


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

Offline

#266 2012-05-23 21:29:12

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

WOW S11.. Thank you!!
Very nice presentation!
It's pretty cool being in the Tips and Tricks section of ConkyPS!!

Offline

#267 2012-05-23 22:41:41

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

Re: interactive conky

falldown wrote:

WOW S11.. Thank you!!
Very nice presentation!
It's pretty cool being in the Tips and Tricks section of ConkyPS!!

Actually, I have to "dress it up" a bit, but wanted to get it up and running, it's just too awesome to get lost on page xxx of a thread.  big_smile


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

Offline

#268 2012-05-23 23:35:14

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

Re: interactive conky

looks great

thanks sector11!

Offline

#269 2012-05-24 02:28:22

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

Re: interactive conky

mrpeachy wrote:

looks great

thanks sector11!

Don't thank me you did the script, falldown that art, I just gave it a home.  big_smile

You're welcome.

Last edited by Sector11 (2012-06-14 15:05:01)


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

Offline

#270 2012-06-20 02:07:40

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

Re: interactive conky

trying to streamline the button making process
this script sets up buttons through entering settings into a table
then all the calculations/drawing are done in a separate function and returns 1 or 0 if the button is on or off

need to incorporate some setting for mouseover and make an "execute" type button function

--[[click tutorial lua by mrpeachy - thanks to barrybarrykelly for the xdotool method and gmonti for finding the deb files for the xdotool
in conkyrc, in addition to regular settings:

own_window_title clicky
lua_load ~/lua/clicky.lua
lua_draw_hook_pre main
TEXT
]]

require 'cairo'

click_start=1-- this starts the clickfunction
buttons={}--this table ini9tially holds the values from the buttons

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}'))
--get click data
local localx,localy,localnowx,localnowy=clickfunction()
--[[
options 
button_name="test_button",--name must be unique
blx=300.5,--bottom left x of button
bly=200.5,--bottom left y of button
height=60,--height
width=60,--width
draw=1,--want button drawn? 1==yes, 0==no
fill_off=0,--fill type when off, 1=filled in, 0=outline
color_off={1,1,1,1},--color of button when off- red, green, blue, alpha
line_width_off=1,--if outline, then set line width
turn_off={}, --list other buttons that this button should turn off
fill_on=0,--fill type when on
color_on={1,0,0,1},--color of button when on
line_width_on=1,--if outline, then set line width
turn_on={}, --list other buttons that this button should turn on
localx=localx,--send function click data
localy=localy,--send function click data
]]
local test=onoff({
button_name="B1",
blx=300.5,
bly=200.5,
height=60,
width=60,
draw=1,
--when button is off
fill_off=0,
color_off={1,1,1,1},
line_width_off=1,
turn_off={"B2",},
--when button is on
fill_on=1,
color_on={1,0,0,1},
line_width_on=0,
turn_on={},
--click data
localx=localx,
localy=localy,
})
--perform if query on result
if test==1 then
print ("B1 ON")
else
print ("B1 OFF")
end

local test=onoff({
button_name="B2",
blx=300.5,
bly=300.5,
height=60,
width=60,
draw=1,
color_off={1,1,1,1},
fill_off=0,
line_width_off=1,
turn_off={},
color_on={1,0,0,1},
fill_on=1,
line_width_on=0,
turn_on={"B1"},
localx=localx,
localy=localy,
})
--perform if query on result
if test==1 then
print ("B2 ON")
else
print ("B2 OFF")
end
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function onoff(oftab)
local button_name=oftab.button_name
if button_name==nil then print ("button needs a name") end
local blx=oftab.blx or 20
local bly=oftab.bly or 20
local height=oftab.height or 20
local width=oftab.width or 20
local localx=oftab.localx
local localy=oftab.localy
local turn_off=oftab.turn_off
local turn_on=oftab.turn_on
if localx>=blx and localx<=blx+width and localy<=bly and localy>=bly-height and buttons[tostring(button_name)]~=1 then
buttons[tostring(button_name)]=1
--turn on other buttons as set
    for i=1,#turn_on do
    buttons[tostring(turn_on[i])]=1
    end
elseif localx>=blx and localx<=blx+width and localy<=bly and localy>=bly-height and buttons[tostring(button_name)]==1 then
buttons[tostring(button_name)]=0
--turn off other buttons as set
    for i=1,#turn_off do
    buttons[tostring(turn_off[i])]=0
    end
elseif localx<blx and localx>blx+width and localy<bly and localy>bly-height and buttons[tostring(button_name)]~=1 then
buttons[tostring(button_name)]=0
--turn off other buttons as set
    for i=1,#turn_off do
    buttons[tostring(turn_off[i])]=0
    end
end
--draw bpx in requested
local draw=oftab.draw or 0
if draw==1 and buttons[tostring(button_name)]==0 or buttons[tostring(button_name)]==nil then
local color=oftab.color_off or {1,1,1,1}
local fill=oftab.fill_off or 0
local line_width=oftab.line_width_off or 1
buttondraw(blx,bly,height,width,color,fill,line_width)
elseif draw==1 and buttons[tostring(button_name)]==1 then
local color=oftab.color_on or {1,0,0,1}
local fill=oftab.fill_on or 0
local line_width=oftab.line_width_on or 1
buttondraw(blx,bly,height,width,color,fill,line_width)
end
--return if button is on,1 or off 0
return buttons[tostring(button_name)]
end
--button drawing function
function buttondraw(blx,bly,height,width,color,fill,line_width)
cairo_set_line_width (cr,line_width)
cairo_set_source_rgba (cr,color[1],color[2],color[3],color[4])
cairo_rectangle (cr,blx,bly,width,-height)
if fill==0 then
cairo_stroke (cr)
elseif fill==1 then
cairo_fill (cr)
end
end--of buttondraw function

--clickfunction, this runs xdotool and xwininfo and reads the coordinates of clicks
function clickfunction()
--start click logging and calculations ##########################################
if click_start==1 then
xdot=conky_parse("${if_running xdotool}1${else}0${endif}")
if tonumber(xdot)==1 then
os.execute("killall xdotool && echo 'xdo killed' &")
end
os.execute("xdotool search --name 'conky' behave %@ mouse-click getmouselocation >> /tmp/xdo &")
local f = io.popen("xwininfo -name 'conky' | grep 'Absolute'")
geometry = f:read("*a")
f:close()
local geometry=string.gsub(geometry,"[\n]","")
s,f,abstlx=string.find(geometry,"X%p%s*(%p*%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%p*%d*)")
click_start=nil
end--if click_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
--print (click)
local s,f,mousex=string.find(click,"x%p(%d*)%s")
local s,f,mousey=string.find(click,"y%p(%d*)%s")
localx=tonumber(mousex)-abstlx
localy=tonumber(mousey)-abstly
--get now location
os.execute("xdotool getmouselocation > /tmp/xdonow ")
local f=io.open("/tmp/xdonow")
mousenow=f:read()
f:close()
local s,f,mousenowx=string.find(mousenow,"x%p(%d*)%s")
local s,f,mousenowy=string.find(mousenow,"y%p(%d*)%s")
localnowx=tonumber(mousenowx)-abstlx
localnowy=tonumber(mousenowy)-abstly
--END CLICK CALCULATIONS #################################
return localx,localy,localnowx,localnowy
end--function

Last edited by mrpeachy (2012-06-20 02:10:50)

Offline

#271 2012-06-20 20:48:57

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: interactive conky

big_smile

peachy wrote:

trying to streamline the button making process
this script sets up buttons through entering settings into a table
then all the calculations/drawing are done in a separate function and returns 1 or 0 if the button is on or off

need to incorporate some setting for mouseover and make an "execute" type button function

Works good Peachy.
I did have to change

own_window_title clicky

to this

own_window_title conky

big_smile

Offline

#272 2012-06-20 21:04:33

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

Re: interactive conky

@mrpeachy
Now that you have time to work on this again I have a couple of suggestions for you.

First you can kill only the xdotool started by your script like this.

os.execute("pkill -f \"xdotool search --name clicky\"")

This will let you have buttons in more than one conky and prevents interference with any other programs that may be using xdotool.

I see you added

xdot=conky_parse("${if_running xdotool}1${else}0${endif}")
if tonumber(xdot)==1 then

to your new button function script.
There is a way to make that check specific to the xdotool started by the script.
I will post an example here after I look up something in the conky manual.
Here you go, I had to check if it could be done with if_running or not.

xdot=conky_parse("${cmdline_to_pid xdotool search --name 'clicky'}")
if xdot ~= " " then

You may need to change

xdot ~= " "

to check for whatever cmdline_to_pid returns when it does not find a matching process.


Second you can add this to make sure there are no xdotool processes left running if you stop conky.

function conky_button_shutdown() -- stops xdotool when conky is closed or the configuration is reloaded
os.execute("pkill -f \"xdotool search --name clicky\"")
return ""
end--function

If you add it to your .conkyrc like this

lua_shutdown_hook button_shutdown

it will run when you kill the conky process to ensure that all xdotool processes that are started by the script are killed if conky is not running.

Last edited by arclance (2012-06-20 21:21:55)

Offline

#273 2012-06-20 23:43:09

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

Re: interactive conky

@falldown - oops.. yeah, that was probabkly something i shiuld have mentioned in the post big_smile
@arclance - i will take a look at your code
ive been looking into having the conkyrc be responsible for running the xdotool
i tried using pre-exec (with a sleep command prior so that conky actually starts up before xdotool is run)
but i just get an extremely unhelpful

Alarm clock

error whn i launch conky

Offline

#274 2012-06-21 00:00:32

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

Re: interactive conky

mrpeachy wrote:

@arclance - i will take a look at your code
ive been looking into having the conkyrc be responsible for running the xdotool
i tried using pre-exec (with a sleep command prior so that conky actually starts up before xdotool is run)
but i just get an extremely unhelpful

Alarm clock

error whn i launch conky

If pre-exec waits until the command ends before it creates the window xdotool would not work but I have not tested it so I cannot say for sure.

Executes a shell command one time before conky displays anything and puts output as text.

Also since it only runs once I don't think you can continue to get output from the command or it won't work with conky_parse() since it likely only works before the first window update.
I have never used it though, does it produce any text output in conky if you put it in a .conkyrc?

Last edited by arclance (2012-06-21 03:11:34)

Offline

Be excellent to each other!

#275 2012-06-25 03:05:48

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

Re: interactive conky

I just figured out how to get rid of all the "findclient:" terminal spam from xdotool.
I turns out that those are from some leftover debug code that prints to stderr.

The answer is to dump the stderr output to /dev/null like this.

os.execute("xdotool search --name 'system_Conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/xdo &")
    local f = io.popen("xdotool getmouselocation 2> /dev/null")

There is more recent code here that you might want to look at.

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