conky icon indicating copy to clipboard operation
conky copied to clipboard

rsvg option results in call a nil value (global 'rsvg_handle_get_dimensions')

Open Merga189 opened this issue 11 months ago • 4 comments

What happened?

I am trying to get https://github.com/hseliger/conky-themed-clock/blob/master/themed-clock.lua working.

~$ conky --version
conky 1.22.1-pre-7fd5dcb7 compiled for Linux x86_64

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/local/lib/conky


 General:
  * math
  * hddtemp
  * portmon
  * IPv6
  * support for IBM/Lenovo notebooks
  * builtin default configuration
  * old configuration syntax
  * Imlib2
  * OSS mixer support
  * apcupsd
  * iostats
  * ncurses
  * Internationalization support

 Lua bindings:
  * Cairo
  * RSVG
 X11:
  * Xdamage extension
  * Xinerama extension (virtual display)
  * Xshape extension (click through)
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual
  * Own window
  * Mouse events

 Music detection:
  * CMUS
  * MPD
  * MOC

 Default values:
  * Netdevice: eno1
  * Local configfile: $HOME/.conkyrc
  * Localedir: /usr/local/share/locale
  * Maximum netdevices: 256
  * Maximum text size: 16384
  * Size text buffer: 256

Renamed 'themed-clock' to 'conky.conf' and modified path to 'lua_load = '/home/user/.config/conky/themed-clock.lua','

In 'themed-clock.lua' added

require 'cairo_xlib' require 'rsvg'

Trying to start conky gets me

conky: llua_do_call: function conky_main execution failed: /home/user/.config/conky/themed-clock.lua:35: attempt to call a nil value (global 'rsvg_handle_get_dimensions')

pointing to that line >> local rh = rsvg_create_handle_from_file(f_path)

A conky -D

DEBUG(0) [/home/user/conky/src/conky.cc:1980]: reading contents from config file '/home/user/.config/conky/conky.conf'
DEBUG(0) [/home/user/conky/src/output/x11.cc:247]: enter init_x11()
DEBUG(0) [/home/user/conky/src/output/x11.cc:368]: Fixed xinerama area to: 0 0 1600 900
DEBUG(0) [/home/user/conky/src/output/x11.cc:291]: leave init_x11()
DEBUG(0) [/home/user/conky/src/output/x11.cc:486]: enter x11_init_window()
DEBUG(0) [/home/user/conky/src/output/x11.cc:368]: Fixed xinerama area to: 0 0 1600 900
conky: desktop window (0x140002c) is subwindow of root window (0x233)
DEBUG(0) [/home/user/conky/src/output/x11.cc:463]: Found ARGB Visual
conky: window type - desktop
DEBUG(0) [/home/user/conky/src/output/x11.cc:693]: hint - undecorated
DEBUG(0) [/home/user/conky/src/output/x11.cc:704]: hint - below
DEBUG(0) [/home/user/conky/src/output/x11.cc:748]: hint - sticky
DEBUG(0) [/home/user/conky/src/output/x11.cc:770]: hint - skip taskbar
DEBUG(0) [/home/user/conky/src/output/x11.cc:783]: hint - skip pager
conky: drawing to created window (0x1a00002)
DEBUG(0) [/home/user/conky/src/output/x11.cc:902]: leave x11_init_window()
conky: drawing to double buffer
DEBUG(0) [/home/user/conky/src/output/display-output.cc:39]: Wayland display output disabled. Enable by recompiling with 'BUILD_WAYLAND' flag enabled.
DEBUG(0) [/home/user/conky/src/output/display-output.cc:39]: HTTP display output disabled. Enable by recompiling with 'BUILD_HTTP' flag enabled.
conky: FOUND: x11
conky: FOUND: file
conky: FOUND: ncurses
conky: FOUND: console
DEBUG(0) [/home/user/conky/src/output/display-output.cc:111]: Initialized display output 'x11'... 
conky: 'lightdm-xsession' x11 session running 'XFCE' desktop
conky: llua_do_call: function conky_main execution failed: /home/user/.config/conky/themed-clock.lua:35: attempt to call a nil value (global 'rsvg_handle_get_dimensions')

br KH

Version

--

Which OS/distro are you seeing the problem on?

Debian

Conky config

-- Conky, a system monitor https://github.com/brndnmtthws/conky
--
-- This configuration file is Lua code. You can write code in here, and it will
-- execute when Conky loads. You can use it to generate your own advanced
-- configurations.
--
-- Try this (remove the `--`):
--
--   print("Loading Conky config")
--
-- For more on Lua, see:
-- https://www.lua.org/pil/contents.html
--
-- Conky Lua API: https://conky.cc/lua

-- Configuration settings: https://conky.cc/config_settings
conky.config = {
    alignment = 'top_left',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'DejaVu Sans Mono:size=12',
    gap_x = 60,
    gap_y = 60,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_wayland = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'normal',
    own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

-- Variables: https://conky.cc/variables
conky.text = [[
${color grey}Info:$color ${scroll 32 Conky $conky_version - $sysname $nodename $kernel $machine}
$hr
${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
 / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed} ${color grey} - Down:$color ${downspeed}
$hr
${color grey}Name              PID     CPU%   MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]

Stack trace


Relevant log output


Merga189 avatar Jan 17 '25 16:01 Merga189

There's no rsvg_handle_get_dimensions() anymore, but you can use RsvgDimensionData:create(), RsvgDimensionData:get(), RsvgDimensionData:set(x, y, width, height), and RsvgDimensionData:destroy() instead.

You can do something like this:

-- create dimension data struct
local rd = RsvgDimensionData:create()

-- set some dimensions
rd:set(0, 0, 100, 100)

-- get the dimensions
local x, y, w, h = rd:get()
print(x, y, w, h)

-- destroy the structure
rd:destroy()

You'll have to update the script accordingly, but it should be fairly straight forward.

brndnmtthws avatar Jan 18 '25 14:01 brndnmtthws

Thank you for explication the cause here, but I have to admit, I don't have the background or knowledge to rewrite the lua script..

Regards KH

Merga189 avatar Jan 18 '25 21:01 Merga189

You can try this: https://gist.github.com/brndnmtthws/0e8f25d03437e9dade181f82dacaa4a5

Based on https://github.com/brndnmtthws/conky/wiki/Rendering-an-SVG-with-librsvg-and-Cairo

Didn't test it, but it should work in theory.

brndnmtthws avatar Jan 18 '25 21:01 brndnmtthws

Thank you for your proposals.

Project is based on https://github.com/hseliger/conky-themed-clock/blob/master/themed-clock.lua

Tried to set the correct path in conky.conf

Those are the line in conky.conf I modified 'Timex' is the folder with the svg files

lua_load = '/home/user/.config/conky/themed-clock.lua',
lua_draw_hook_post = 'main',
-- lua_load = "svg.lua",
lua_draw_hook_pre = "conky_draw_svg_file /home/user/.config/conky/Timex/file.svg 0 0 100 100",  (? you omitted the comma) 

Activated I get a stop 'conky: llua_load: specified script file 'svg.lua' doesn't exist'

Deactivated conky stops in a loop at line 43.

Issue conky: llua_do_call: function conky_main execution failed: /home/user/.config/conky/themed-clock.lua:43: attempt to call a nil value (global 'rsvg_handle_render_cairo')

Please see attached pic

Left: the original, right your modifications.

Image

Merga189 avatar Jan 19 '25 20:01 Merga189