SEARCH

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

You are not logged in.

#301 2012-07-22 22:25:07

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

Re: interactive conky

ive been fiddling with my clickfunction
you dont need a second xwininfo command to get the window id

i did it like this

if click_start==1 then
click_lines={}
f = io.popen("xwininfo -name '"..conky_name.."'")
    for line in f:lines() do
    table.insert(click_lines,line)
    end
f:close()
    s,f,abstlx=string.find(click_lines[4],"X%p%s*([%p%d]*)")
    s,f,abstly=string.find(click_lines[5],"Y%p%s*([%p%d]*)")
    s,f,winid=string.find(click_lines[2],"Window id:%s*(%d%a[%d%a]*)")
click_start=nil
end

i try and do everything i can using native lue commands rather than "outside" programs like grep or tail
which is why i went for this method

Offline

Be excellent to each other!

#302 2012-07-22 22:34:43

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

Re: interactive conky

if click_start==1 then
click_lines={}
f = io.popen("xwininfo -name '"..conky_name.."'")
    for line in f:lines() do
    table.insert(click_lines,line)
    end
f:close()
    s,f,abstlx=string.find(click_lines[4],"X%p%s*([%p%d]*)")
    s,f,abstly=string.find(click_lines[5],"Y%p%s*([%p%d]*)")
    s,f,winid=string.find(click_lines[2],"Window id:%s*(%d%a[%d%a]*)")
click_start=nil
end

Last edited by arclance (2012-07-22 22:40:14)

Offline

#303 2012-07-22 22:45:51

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

Re: interactive conky

it works for me

xwininfo -name 'conky_name' 

returns a window id eg

0x2a00002

then using

tonumber(0x2a00002)

returns

44040194

which is the same number i get from xdotool

x:864 y:180 screen:0 window:44040194

Last edited by mrpeachy (2012-07-22 22:46:37)

Offline

#304 2012-07-22 23:00:16

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

Re: interactive conky

xwininfo -all -int -tree -name 'conky_name'

Offline

#305 2012-07-22 23:15:39

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

Re: interactive conky

mcdowall@mcdowall-desktop:~/Desktop$ xwininfo -all -int -tree -name 'conky1'
xwininfo: Window id: 41943042 "conky1"

  Root window id: 349 (the root window) (has no name)
  Parent window id: 349 (the root window) (has no name)
     0 children.

  Absolute upper-left X:  825
  Absolute upper-left Y:  0
  Relative upper-left X:  825
  Relative upper-left Y:  0
  Width: 610
  Height: 410
  Depth: 32
  Visual: 0x23
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x2800001 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +825+0  -5+0  -5-490  +825-490
  -geometry 610x410-5+0

  Bit gravity: ForgetGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      ButtonPress
      ButtonRelease
      EnterWindow
      LeaveWindow
      Exposure
      StructureNotify
      FocusChange
      PropertyChange
      ColormapChange
  Do not propagate these events:
  Override redirection?: No

  Window manager hints:
      Client accepts input or input focus: No
      Initial state is Normal State
      Displayed on all desktops
      Window type:
          Normal
      Window state:
          Skip Pager
          Skip Taskbar
          Below
          Sticky
      Process id: (unknown) on host mcdowall-desktop

  No normal window size hints defined
  No zoom window size hints defined

  No window shape defined
  No border shape defined

using gnome... edit - no im not im using cinnamon!

Last edited by mrpeachy (2012-07-23 01:33:06)

Offline

#306 2012-07-22 23:25:16

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

Re: interactive conky

That's what I thought the "  Parent window id: " line is different in mine.

xwininfo -all -int -tree -name 'system_Conky'
xwininfo: Window id: 31457281 "system_Conky"

  Root window id: 634 (the root window) (has no name)
  Parent window id: 14309537 (has no name)
     0 children.

  Absolute upper-left X:  -1
  Absolute upper-left Y:  -2
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 622
  Height: 1102
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +-1+-2  -2979+-2  -2979--20  +-1--20
  -geometry 622x1102+-1+-2

  Bit gravity: ForgetGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      KeyPress
      ButtonPress
      ButtonRelease
      PointerMotion
      Exposure
      StructureNotify
      SubstructureNotify
      FocusChange
      PropertyChange
  Do not propagate these events:
      ButtonPress
      ButtonRelease
      ButtonMotion
  Override redirection?: No

  Window manager hints:
      Client accepts input or input focus: No
      Initial state is Normal State
      Displayed on all desktops
      Window type:
          Normal
      Window state:
          Sticky
          Below
          Skip Taskbar
          Skip Pager
      Process id: (unknown) on host TheForge
      Frame extents: 0, 0, 0, 0

  No normal window size hints defined
  No zoom window size hints defined

  No window shape defined
  No border shape defined

I am using fluxbox.

Maybe we should ask everyone in The New Monster Conky Thread to post the results for their conkys and what window manager they use to see what kind of output they get.

You could add a "get_window_id_from" variable at the top to choose between the two sources.

Offline

#307 2012-07-22 23:34:18

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

Re: interactive conky

stoopid window managers

so you get a different number from

xwininfo -int -tree -name 'system_Conky'

and

xwininfo -name 'system_Conky' 

?

while i get the same from both
seems like

xwininfo -int -tree -name 'system_Conky'

is going to be the more universal

Last edited by mrpeachy (2012-07-22 23:34:40)

Offline

#308 2012-07-22 23:37:22

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

Re: interactive conky

The problem is that for you this command

xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/xdo

returns the the click location with the window id number from this line

xwininfo: Window id: 31457281 "system_Conky"

but for me it returns the window id number from this line.

  Parent window id: 14309537 (has no name)

Here is a way to get the data from one io.popen() call.

    if main_start == 1 then--run at script start 
        --# get xdotool_window_number here
        local f = io.popen("xwininfo -all -int -tree -name '"..conkyWindowTitle.."'")
        local winData = f:read("*a")
        f:close()
        f = nil
        if winID_source = 0 then
            s,f,xdotool_window_number = string.find(winData,"Parent%swindow%sid.%s(%d+)%s")
        elseif winID_source = 1 then
            s,f,xdotool_window_number = string.find(winData,"xwininfo.%swindow%sid.%s(%d+)%s")
        else
            print("error: invalid winID_source")
        end --# if winID_source = 0 then
        s,f,abstlx = string.find(winData,"Absolute%supper.left%sX%p%s*(%p*%d*)")
        s,f,abstly = string.find(winData,"Absolute%supper.left%sY%p%s*(%p*%d*)")
        main_start = nil
    end--if main_start=1 ######################################

winID_source controls which place to get the window id from.
Set it to 1 to make it work on your computer, 0 works on my computer.

Last edited by arclance (2012-07-22 23:50:57)

Offline

#309 2012-07-23 00:08:23

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

Re: interactive conky

Here is my example script with the adjustable window id source worked into it.
I also cleaned up some old lines leftover from a simplification I made before.

require 'cairo'

if tonumber(conky_parse('${updates}')) < 2 then --# don't clear buttons table if reloading lua script
    main_start = 1-- this starts the clickfunction
    buttons = {}--this table initially holds the values from the buttons
    conkyWindowTitle = "button_example" --# the title of the conky window (own_window_title) to make it easier to configure
    tempFileName = "xdo" --# the name of the temporary file to store mouse click locations in (makes configuring for use in more than one conky easier)
    winID_source = 0 --# settings for different window managers (maybe) 0 works for me in fluxbox, 1 works for mrpeachy in gnome
    abstlx = nil
    abstly = nil
    xdotool_window_number = nil
end --# if tonumber(conky_parse('${updates}')) < 2 then

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)
    local localx,localy,localnowx,localnowy = clickfunction()--this line activates the clickfunction and sets the click coordinates
    --#################################
    --###### Setup Buttons Here #######
    --#################################
    cairo_destroy(cr)
    cairo_surface_destroy(cs)
    cr = nil
    cs = nil
    local gcollect = collectgarbage ("collect") --# memory police
end --# function conky_main()

function clickfunction()
    --start click logging and calculations ##########################################
    local s = nil
    if main_start == 1 then--run at script start 
        --# get xdotool_window_number here
        local f = io.popen("xwininfo -all -int -tree -name '"..conkyWindowTitle.."'")
        local winData = f:read("*a")
        f:close()
        f = nil
        if winID_source = 0 then
            s,f,xdotool_window_number = string.find(winData,"Parent%swindow%sid.%s(%d+)%s")
        elseif winID_source = 1 then
            s,f,xdotool_window_number = string.find(winData,"xwininfo.%swindow%sid.%s(%d+)%s")
        else
            print("error: invalid winID_source")
        end --# if winID_source = 0 then
        s,f,abstlx = string.find(winData,"Absolute%supper.left%sX%p%s*(%p*%d*)")
        s,f,abstly = string.find(winData,"Absolute%supper.left%sY%p%s*(%p*%d*)")
        main_start = nil
    end--if main_start == 1 ######################################
    --click calculations #################################
    local f = io.popen("tail --lines=1 /tmp/"..tempFileName)
    local click = f:read("*a")
    f:close()
    f = nil
    local reset_xdotool_log = false
    local mousex = nil
    local mousey = nil
    if ((click == nil) or (click == "")) then
        print("error: could not read xdotool logfile")
        mousex = "0"
        mousey = "0"
    elseif (click:gsub("\n","") == "Command failed.") then
        print("error: xdotool error")
        mousex = "0"
        mousey = "0"
    else
        if string.find(click, xdotool_window_number) ~= nil then
            print("debug: click was in this window")
            s,f,mousex = string.find(click,"x%p(%d*)")
            s,f,mousey = string.find(click,"y%p(%d*)")
            reset_xdotool_log = true
        else
            --print("debug: click was not in this window")
            mousex = "0"
            mousey = "0"
        end --# if string.find(click, xdotool_window_number) ~= nil then
    end --# if ((click == nil) or (click == "")) then
    local localx = tonumber(mousex)-abstlx
    local localy = tonumber(mousey)-abstly
    --get now location
    local f = io.popen("xdotool getmouselocation 2> /dev/null")
    local mousenow = f:read("*a")
    f:close()
    f = nil
    local mousenowx = nil
    local mousenowy = nil
    if ((mousenow == nil) or (mousenow == "")) then
        print("error: could not get mouse location")
        mousenowx = "0"
        mousenowy = "0"
    else
        s,f,mousenowx = string.find(mousenow,"x%p(%d*)%s")
        s,f,mousenowy = string.find(mousenow,"y%p(%d*)%s")
    end --# if ((mousenow == nil) or (mousenow == "")) then
    local localnowx = tonumber(mousenowx)-abstlx
    local localnowy = tonumber(mousenowy)-abstly
    button_run_last(reset_xdotool_log)
    --END CLICK CALCULATIONS #################################
    return localx,localy,localnowx,localnowy
end --# function clickfunction()

function button_run_last(reset_xdotool_log)
    if reset_xdotool_log == true then
        local f = io.open("/tmp/"..tempFileName,"w")
        f:write("x:0 y:0 screen:0 window:0\n")
        f:close()
        f = nil
    end --# if reset_xdotool_log == true then
end --# function conky_run_last()

You might think about including this started with "lua_startup_hook" to reset xdotool every time you have to kill and restart a conky.

function conky_start_xdotool()
    os.execute("pkill -f \"xdotool search --sync --classname conky behave %@ mouse-click getmouselocation\"")
    os.execute("xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/xdo &")
end --# function conky_start_xdotool()

That way you won't have to manually kill and restart xdotool to make the conky window visible to xdotool again.

Last edited by arclance (2012-07-23 00:20:10)

Offline

#310 2012-07-23 01:08:05

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

Re: interactive conky

Not sure if this is of any help, but...

falldown@vaio:~$ xwininfo -all -int -tree -name 'conky'

xwininfo: Window id: 48234497 "conky"

  Root window id: 787 (the root window) (has no name)
  Parent window id: 12583215 (has no name)
     0 children.

  Absolute upper-left X:  1182
  Absolute upper-left Y:  5
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 253
  Height: 560
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +1182+5  -5+5  -5-335  +1182-335
  -geometry 253x560-5+5

  Bit gravity: ForgetGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      ButtonPress
      ButtonRelease
      Exposure
      StructureNotify
      SubstructureNotify
      PropertyChange
      ColormapChange
  Do not propagate these events:
      ButtonPress
      ButtonRelease
      ButtonMotion
  Override redirection?: No

  Window manager hints:
      Client accepts input or input focus: No
      Initial state is Normal State
      Displayed on all desktops
      Window type:
          Desktop
      Window state:
          Skip Taskbar
          Skip Pager
          Below
      Process id: (unknown) on host vaio
      Frame extents: 0, 0, 0, 0

  No normal window size hints defined
  No zoom window size hints defined

  No window shape defined
  No border shape defined

Using openbox.

Offline

#311 2012-07-23 01:13:13

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

Re: interactive conky

falldown@vaio:~$ xwininfo -all -int -tree -name 'conky'

xwininfo: Window id: 48234497 "conky"

  Root window id: 787 (the root window) (has no name)
  Parent window id: 12583215 (has no name)

Offline

#312 2012-07-23 01:16:58

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

Re: interactive conky

Here you go..

falldown@vaio:~$ xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null
x:1280 y:51 screen:0 window:12585826

Offline

#313 2012-07-23 01:26:14

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

Re: interactive conky

instead of asking the user to pick a setting ive gotten both xwininfo numbers, window id and parent window id and compared them both to the xdotool number
like this

--blank file ####################################################################
if tonumber(xwin_winid)==tonumber(xdowinid) or tonumber(xwin_parentwinid)==tonumber(xdowinid) then
local f = io.open(click_data_file,"w")
f:write("")
f:close() 
end
--get now location #############################################################

that should cover both window manager types

Last edited by mrpeachy (2012-07-23 01:27:12)

Offline

#314 2012-07-23 01:26:20

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

Re: interactive conky

falldown@vaio:~$ xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null
x:1280 y:51 screen:0 window:12585826

Offline

#315 2012-07-23 01:29:28

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

Re: interactive conky

Yep running 2 conkys with window titles.. sorry.

Offline

#316 2012-07-23 01:31:09

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

Re: interactive conky

^ It's okay I was about to change my post to say that but you answered to fast for me to do it.

If you kill all but one of the conkys and repeat both tests again you should get good data.

@ mrpeachy
Looks good, that is a more user friendly solution.

Last edited by arclance (2012-07-23 01:39:04)

Offline

#317 2012-07-23 19:41:28

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

Re: interactive conky

--get now location and window id #############################################################
local f = io.popen("xdotool getmouselocation")
mousenow=string.lower(f:read())
f:close()
local s,f,xwinid=string.find(mousenow,"window%p(%d*)")
--read file if windowid matches
if tonumber(parentid)==tonumber(xwinid) or tonumber(windowid)==tonumber(xwinid) then
local f=io.open(click_data_file)
click=f:read()
f:close()
--blank file
local f = io.open(click_data_file,"w")
f:write("")
f:close() 
end--window id matching

Last edited by mrpeachy (2012-07-23 19:49:41)

Offline

#318 2012-07-23 19:55:38

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

Re: interactive conky

xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/xdo &

Last edited by arclance (2012-07-23 19:56:21)

Offline

#319 2012-07-23 20:23:25

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

Re: interactive conky

if tonumber(conky_parse('${updates}')) < 2 then --# don't reset these global variables when changes are made to the lua script
    --#### Setup Buttons ####
    conkyWindowTitle = "system_Conky" --# the title of the conky window (own_window_title) to make it easier to configure
    tempFileName = "xdo" --# the name of the temporary file to store mouse click locations in (makes configuring for use in more than one conky easier)
    buttons = {} --# this table initially holds the values from the buttons
    --###### End Setup Buttons ######
end --# if tonumber(conky_parse('${updates}')) < 2 then

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)
    local localx,localy,localnowx,localnowy = clickfunction()--this line activates the clickfunction and sets the click coordinates
    --#################################
    --###### Setup Buttons Here #######
    --#################################
    cairo_destroy(cr)
    cairo_surface_destroy(cs)
    cr = nil
    cs = nil
    local gcollect = collectgarbage ("collect")
end

function clickfunction()
    --################################################################################################
    if tonumber(conky_parse('${updates}')) < 2 then
        local s = nil
        local f = io.popen("xwininfo -all -int -tree -name '"..conkyWindowTitle.."'")
        local winData = f:read("*a")
        f:close()
        f = nil
        s,f,xdotool_window_number = string.find(winData,"Parent%swindow%sid.%s(%d+)%s")
        s,f,abstlx = string.find(winData,"Absolute%supper.left%sX%p%s*(%p*%d*)")
        s,f,abstly = string.find(winData,"Absolute%supper.left%sY%p%s*(%p*%d*)")
        print("abstlx: "..tostring(abstlx).." abstly: "..tostring(abstly).." winNum: "..tostring(xdotool_window_number))
    end --# if tonumber(conky_parse('${updates}')) == 1 then
    --#################################################################################################
    --# start click logging and calculations ##########################################
    local s = nil
    --## Get Current Mouse Location
    local f = io.popen("xdotool getmouselocation 2> /dev/null")
    local mousenow = f:read("*a")
    f:close()
    f = nil
    local mousenowx = nil
    local mousenowy = nil
    local mousex = nil
    local mousey = nil
    if ((mousenow == nil) or (mousenow == "")) then --# check for failure of xdotool getmouselocation command (crashes script but usually only lasts one or two updates)
        print("error: could not get mouse location")
        mousenowx = "0"
        mousenowy = "0"
        mousex = "0"
        mousey = "0"
    elseif string.find(mousenow, xdotool_window_number) ~= nil then --# check if mouse is in this conky window
        print("debug: mouse is in this window")
        s,f,mousenowx = string.find(mousenow,"x%p(%d*)%s")
        s,f,mousenowy = string.find(mousenow,"y%p(%d*)%s")
        --#### Get Click Location
        f = io.popen("tail --lines=1 /tmp/"..tempFileName)
        local click = f:read("*a")
        f:close()
        f = nil
        if ((click == nil) or (click == "")) then --# xdotool log file does not exist or is empty (prevents crash before first click or if you specify the wrong file)
            print("error: could not read xdotool logfile")
            mousex = "0"
            mousey = "0"
        elseif (click:gsub("\n","") == "Command failed.") then --# this is does not crash xdotool (probably a communication error between xdotool and some part of the system)
            print("error: xdotool error")
            mousex = "0"
            mousey = "0"
        else --# no problems reading the xdotool log file
            if string.find(click, xdotool_window_number) ~= nil then --# last click was in this window
                print("debug: click was in this window")
                s,f,mousex = string.find(click,"x%p(%d*)")
                s,f,mousey = string.find(click,"y%p(%d*)")
                --### Reset xdotool log file
                f = io.open("/tmp/"..tempFileName,"w")
                f:write("x:0 y:0 screen:0 window:0\n")
                f:close()
                f = nil
            else --# last click was not in this window
                --print("debug: click not in this window")
                mousex = "0"
                mousey = "0"
            end --# if string.find(click, xdotool_window_number) ~= nil then
        end --# if ((click == nil) or (click == "")) then
    else --# mouse not in this window
        mousenowx = "0"
        mousenowy = "0"
        mousex = "0"
        mousey = "0"
    end --# if string.find(mousenow, xdotool_window_number) then
    local localx = tonumber(mousex) - abstlx
    local localy = tonumber(mousey) - abstly
    local localnowx = tonumber(mousenowx) - abstlx
    local localnowy = tonumber(mousenowy) - abstly
    --END CLICK CALCULATIONS #################################
    return localx,localy,localnowx,localnowy
end --# function clickfunction()

function conky_start_xdotool()
    os.execute("pkill -f \"xdotool search --sync --classname conky behave %@ mouse-click getmouselocation\"")
    os.execute("xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/xdo &")
end --# function conky_start_xdotool()

Last edited by arclance (2012-07-23 21:16:21)

Offline

#320 2012-07-25 18:28:30

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

Re: interactive conky

conky_gradbar

Offline

#321 2012-07-25 19:10:36

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

Re: interactive conky

@falldown
im not sure if that would cause a problem
they are set up to be called from the conkyrc so they all have function names beginning with conky_
and they all have the conky setup/exit lines

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)

other stuff

cairo_destroy(cr)
cairo_surface_destroy (cs)
cr=nil

however, it would be simple enough to copy the functions into the weather template file, probably put them after the template itself
then remove those conky related lines

it may not even matter at all that those lines are there
you could just copy the functions over and set them up in the template without any modification

--template file

conky_luacal({settings})

Offline

#322 2012-07-27 02:28:07

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

Re: interactive conky

function conky_start_xdo(rc_info)--######################################################################################################################
click_data_file=rc_info or click_data_file
os.execute("pkill -f 'xdotool search --sync --classname conky behave %@ mouse-click getmouselocation'")
os.execute("xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> "..click_data_file.." &")
rc_info=nil
end--of function ##################################################################################################################################

Last edited by mrpeachy (2012-09-13 21:51:44)

Offline

#323 2012-07-27 02:29:49

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

Re: interactive conky

############################################
## Set the path to button_script.lua here ##
############################################
lua_load /home/mcdowall/Dropbox/Public/interactive_conky/button_script.lua
##################################
## activate mouse click logging ##
##################################
lua_draw_hook_pre get_mouse {"interactiveconkyrc","/tmp/xdo"} 
## after function call, table containing window title and path to click log file
## before running script create a blank log file first.  In the example above "/tmp/xdo" credate a blank file called xdo in your /tmp directory 
###################################################
## restart click logging on conkyrc save/startup ##
###################################################
lua_startup_hook start_xdo /tmp/xdo
## send click file location following function call if not set up in lua script
###################################################
## kill xdotool process on conkyrc save/shutdown ##
###################################################
lua_shutdown_hook stop_xdo
#######################################################
## Set the path to lua_functions.lua here (optional) ##
#######################################################
lua_load /home/mcdowall/Dropbox/Public/interactive_conky/lua_functions.lua

Last edited by mrpeachy (2012-08-20 22:09:54)

Offline

#324 2012-07-27 02:31:15

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

Re: interactive conky

 
button1=do_button({btype=1,bname="conkybutton1",blx_off=5,bly_off=50,bw_off=70,bh_off=30,draw=1,dtype_off=2})

Last edited by mrpeachy (2012-08-07 03:40:51)

Offline

Help fund CrunchBang, donate to the project!

#325 2012-07-27 04:28:14

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

Re: interactive conky

if button==1 then
--do button 1 stuff\
elseif button==2 then
--do button 2 stuff
elseif button==3 then
--do button 3 stuff
end

Last edited by mrpeachy (2012-07-30 18:19:49)

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