Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Merga189 opened this issue Jan 17, 2025 · 3 comments
Labels
lua related to Lua integration in conky question issue where reporter seeks information about conky or a problem they encounter while running it svg related to SVG drawing functionality

Comments

@Merga189
Copy link

Merga189 commented Jan 17, 2025

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 Merga189 added bug related to incorrect existing implementation of some functionality triage issue that hasn't been verified, categorized or acknowledged yet labels Jan 17, 2025
@brndnmtthws
Copy link
Owner

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.

@Caellian Caellian added question issue where reporter seeks information about conky or a problem they encounter while running it lua related to Lua integration in conky svg related to SVG drawing functionality and removed bug related to incorrect existing implementation of some functionality triage issue that hasn't been verified, categorized or acknowledged yet labels Jan 18, 2025
@Merga189
Copy link
Author

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

@brndnmtthws
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lua related to Lua integration in conky question issue where reporter seeks information about conky or a problem they encounter while running it svg related to SVG drawing functionality
Projects
None yet
Development

No branches or pull requests

3 participants