You are not logged in.
I have a conky script that works fine but I'm trying to load a LUA file and it won't display anything on the desktop. It doesn't output any error messages or anything when loading conky and I'm using the lua_load and lua_draw_hook statements with the lua script.
Here are the two scripts I'm trying to get working together;
conky.conf
conky.config = {
alignment = 'top_right',
background = false,
border_width = 0,
cpu_avg_samples = 5,
default_color = 'white',
color1 = '00008B',
color2 = '2d2d2d',
default_outline_color = 'white',
default_shade_color = 'white',
draw_borders = true,
draw_graph_borders = false,
--[[ draws outlines on text ]]
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'Open Sans:size=12',
gap_x = 5,
gap_y = 60,
minimum_height = 900,
minimum_width = 300,
maximum_width = 350,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
own_window_argb_visual = true,
own_window_transparent = true,
--[[ reduces flickering ]]
double_buffer = true,
stippled_borders = 0,
update_interval = 0.15,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false,
lua_load = '~/.config/conky/lua/solar_system_clock.lua',
lua_draw_hook_pre = conky_OrbitalClock
}
conky.text = [[
${color1}${font 'Open Sans':size=36}$nodename${font 'Open Sans':size=12}
${color1}${font 'Open Sans':size=16}$distribution${alignr}BTC: ---${font 'Open Sans':size=12}
${color grey}Battery: $battery_percent%
${color1}$battery_bar
${color1}System ${hr 2}
${color}$sysname $kernel ${alignr color grey}$machine
${color}Workspace $desktop of $desktop_number
${color}Uptime:$color $uptime
${color1}Processors ${hr 2}
${color}${alignc}${font 'Open Sans':size=16}Intel Core M-5Y10c CPU${font 'Open Sans':size=12}
${color1}$cpugraph
${color1}${cpubar 4}
${color}CPU 1: $color${cpu cpu1}% ${color1}${cpubar cpu1 4}
${color}CPU 2: $color${cpu cpu2}% ${color1}${cpubar cpu2 4}
${color}CPU 3: $color${cpu cpu3}% ${color1}${cpubar cpu3 4}
${color}CPU 4: $color${cpu cpu4}% ${color1}${cpubar cpu4 4}
${color}Processes:$color $processes
${color1}Memory ${hr 2}
${color}RAM Usage:$color $mem / $memmax
${color1}$memperc% ${membar 4}
${color}Swap Usage:$color $swap/ $swapmax
${color1}$swapperc% ${swapbar 4}
${color1}Disks ${hr 2}
${color} /
${color}${fs_used /} / ${fs_size /}
${color1}${fs_bar 6 /}
${color} /var
${color}${fs_used /var} / ${fs_size /var}
${color1}${fs_bar 6 /var}
${color} /tmp
${color}${fs_used /tmp} / ${fs_size /tmp}
${color1}${fs_bar 6 /tmp}
${color} /home
${color}${fs_used /home} / ${fs_size /home}
${color1}${fs_bar 6 /home}
${color1}Networking ${hr 2}
${color}Up: ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
]]LUA Script:
--[[This is a lua script for use in conky.
This script will fit a small solar system into your conky window that can be used to tell time! The outermost planet has a 12 hour orbital period, the middle planet has a 1 hour orbital period, and the innermost planet has a 1 minute orbital period.
(In other words, outermost is the hour hand, then minute hand, then second hand. Just guesstimate where the numbers should be)
You will need to add the following to your .conkyrc before the TEXT section:
lua_load $HOME/.config/conky/LUA/Full_Conky_Orbital_Clock.lua (or wherever you put your luas)
lua_draw_hook_pre conky_OrbitalClock
I am not a programmer, nor am I close to being one. It couldn't have been done without the help of the wonderful guide on the #! forums.
http://crunchbang.org/forums/viewtopic.php?id=17246
]]
require 'oocairo'
function OrbitalClock()
if conky_window == nil then return end
w=conky_window.width
h=conky_window.height
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr = cairo_create(cs)
if w<h then
sm=w
else
sm=h
end
print('Hello Bitches')
---------------------Color Settings
SunRed=256/256
SunGreen=0/256
SunBlue=192/256
SunAlpha=192/256
----------------
HourRed=256/256
HourGreen=256/256
HourBlue=256/256
HourAlpha=192/256
----------------
MinRed=0/256
MinGreen=256/256
MinBlue=0/256
MinAlpha=192/256
----------------
SecRed=256/256
SecGreen=0/256
SecBlue=0/256
SecAlpha=192/256
----------------
LineAlpha=128/256
---------------------Celestial Body Settings
SunR=sm/11
SunPosX=w/2
SunPosY=h/2
PlanetR=sm/26
SecR=sm/6
MinR=(2/7)*sm
HouR=(3/7)*sm
---------------------Time Settings
Hours,Mins,Secs=tonumber(os.date("%l")),tonumber(os.date("%M")),tonumber(os.date("%S"))
---------------------Orbit Calculations
SecPosX=SunPosX-math.sin(-Secs/60*2*math.pi)*SecR
SecPosY=SunPosY-math.cos(-Secs/60*2*math.pi)*SecR
MinPosX=SunPosX-math.sin(-(Mins*60+Secs)/3600*2*math.pi)*MinR
MinPosY=SunPosY-math.cos(-(Mins*60+Secs)/3600*2*math.pi)*MinR
HourPosX=SunPosX-math.sin(-(Hours*60*60+Mins*60+Secs)/43200*2*math.pi)*HouR
HourPosY=SunPosY-math.cos(-(Hours*60*60+Mins*60+Secs)/43200*2*math.pi)*HouR
---------------------Creating Celestial Bodies
StartAngle=(0)
EndAngle=(2*math.pi)
cairo_arc(cr,SunPosX,SunPosY,SunR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,SunRed,SunBlue,SunGreen,SunAlpha)
cairo_fill(cr)
---------------
cairo_arc(cr,SecPosX,SecPosY,PlanetR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,SecRed,SecBlue,SecGreen,SecAlpha)
cairo_fill(cr)
---------------
cairo_arc(cr,MinPosX,MinPosY,PlanetR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,MinRed,MinBlue,MinGreen,MinAlpha)
cairo_fill(cr)
---------------
cairo_arc(cr,HourPosX,HourPosY,PlanetR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,HourRed,HourBlue,HourGreen,HourAlpha)
cairo_fill(cr)
---------------
cairo_arc(cr,SunPosX,SunPosY,SecR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,SecRed,SecBlue,SecGreen,LineAlpha)
cairo_stroke(cr)
---------------
cairo_arc(cr,SunPosX,SunPosY,MinR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,MinRed,MinBlue,MinGreen,LineAlpha)
cairo_stroke(cr)
---------------
cairo_arc(cr,SunPosX,SunPosY,HouR,StartAngle,EndAngle)
cairo_set_source_rgba(cr,HourRed,HourBlue,HourGreen,LineAlpha)
cairo_stroke(cr)
---------------------Finishing up
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main functionThe script I'm trying to get working is a solar system orbital clock that I saw online. I saw on a forum thread that I need to require oocairo instead of cairo so I changed that and installed oocairo alongside cairo-compmgr and still nothing is being displayed. Does the conky package in the extra repository not include LUA support? I've tried installing conky-lua from the AUR but it's having issues with tolua++. It won't compile without it being installed and I've already installed and reinstalled it.
Last edited by Phrost5019 (2016-01-03 04:23:39)
Offline
extra/conky supports Lua, but it does not support Cairo.
Offline
I see, does it support any other composite managers or any other tools that I can use to draw things on my desktop?
Offline