awesomeWM/awesome

`awful.widget.launcher` has weird error when SVG string passed into `image`

Open

#3,835 opened on Aug 9, 2023

View on GitHub
 (4 comments) (1 reaction) (0 assignees)Lua (620 forks)batch import
buggood first issue

Repository metrics

Stars
 (6,882 stars)
PR merge metrics
 (Avg merge 37d 2h) (1 merged PR in 30d)

Description

Output of awesome --version:

$ nix run .\#awesome -- --version
warning: Git tree '/home/nmelzer/Projects/nixos-config' is dirty
awesome 4.3 (Too long)
 • Compiled against Lua 5.2.4 (running with Lua 5.2)
 • API level: 4
 • D-Bus support: yes
 • xcb-errors support: no
 • execinfo support: yes
 • xcb-randr version: 1.6
 • LGI version: [string "return require('lgi.version')"]:1: module 'lgi.version' not found:
        no field package.preload['lgi.version']
        no file './share/lua/5.2/lgi/version.lua'
        no file './lgi/version.lua'
        no file './lgi/version/init.lua'
        no file './lib/lua/5.2/lgi/version.so'
        no file './lgi/version.so'
        no file './lib/lua/5.2/loadall.so'
        no file './lib/lua/5.2/lgi.so'
        no file './lgi.so'
        no file './lib/lua/5.2/loadall.so'
 • Transparency enabled: yes
 • Custom search paths: yes

Build from:

awesome: (git repository)
    repository: https://github.com/awesomewm/awesome.git
    branch: master
    revision: 0e5fc4575ab0adbae75908cb49937d9cf63437ec
    url: https://github.com/awesomewm/awesome/archive/0e5fc4575ab0adbae75908cb49937d9cf63437ec.tar.gz
    hash: 0zkqn5ni4iqwfxyilcnp78l0xan7ksvk1q71wqh1i2fh5hmxhn34

How to reproduce the issue:

In the default config, replace the mylauncher definition with the following:

local mylauncher = awful.widget.launcher({
    image =
    [[<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="#7ebae4" fill-rule="evenodd" d="M13 11.115L6.183 23.76L4.59 20.87l1.839-3.387l-3.651-.01L2 16.029l.8-1.477l5.2.018l1.868-3.447Zm.527 10.108h13.64l-1.541 2.922l-3.658-.011l1.817 3.389l-.779 1.449h-1.593l-2.584-4.825l-3.722-.008Zm7.94-5.541l-6.82-12.645l3.134-.032L19.6 6.4l1.834-3.379h1.557l.795 1.479l-2.612 4.807l1.854 3.455Z"/><path fill="#5277c3" fill-rule="evenodd" d="m10.542 16.324l6.821 12.645l-3.134.031l-1.821-3.4l-1.834 3.38H9.016l-.8-1.476l2.615-4.804l-1.855-3.457Zm7.922-5.573H4.823l1.542-2.922l3.658.011l-1.816-3.389L8.986 3h1.592l2.584 4.825l3.722.008ZM19 20.888l6.817-12.644l1.593 2.89l-1.839 3.386l3.651.01l.778 1.449l-.8 1.477l-5.2-.018l-1.868 3.447Z"/></svg>]],
    menu = mymainmenu
})

Actual result:

I got an error like this:

2023-08-09 20:10:06 E: awesome: Failed to load '<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="#7ebae4" fill-rule="evenodd" d="M13 11.115L6.183 23.76L4.59 20.87l1.839-3.387l-3.651-.01L2 16.029l.8-1.477l5.2.018l1.868-3.447Zm.527 10.108h13.64l-1.541 2.922l-3.658-.011l1.817 3.389l-.779 1.449h-1.593l-2.584-4.825l-3.722-.008Zm7.94-5.541l-6.82-12.645l3.134-.032L19.6 6.4l1.834-3.379h1.557l.795 1.479l-2.612 4.807l1.854 3.455Z"/><path fill="#5277c3" fill-rule="evenodd" d="m10.542 16.324l6.821 12.645l-3.134.031l-1.821-3.4l-1.834 3.38H9.016l-.8-1.476l2.615-4.804l-1.855-3.457Zm7.922-5.573H4.823l1.542-2.922l3.658.011l-1.816-3.389L8.986 3h1.592l2.584 4.825l3.722.008ZM19 20.888l6.817-12.644l1.593 2.89l-1.839 3.386l3.651.01l.778 1.449l-.8 1.477l-5.2-.018l-1.868 3.447Z"/></svg>': Failed to open file “<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="#7ebae4" fill-rule="evenodd" d="M13 11.115L6.183 23.76L4.59 20.87l1.839-3.387l-3.651-.01L2 16.029l.8-1.477l5.2.018l1.868-3.447Zm.527 10.108h13.64l-1.541 2.922l-3.658-.011l1.817 3.389l-.779 1.449h-1.593l-2.584-4.825l-3.722-.008Zm7.94-5.541l-6.82-12.645l3.134-.032L19.6 6.4l1.834-3.379h1.557l.795 1.479l-2.612 4.807l1.854 3.455Z"/><path fill="#5277c3" fill-rule="evenodd" d="m10.542 16.324l6.821 12.645l-3.134.031l-1.821-3.4l-1.834 3.38H9.016l-.8-1.476l2.615-4.804l-1.855-3.457Zm7.922-5.573H4.823l1.542-2.922l3.658.011l-1.816-3.389L8.986 3h1.592l2.584 4.825l3.722.008ZM19 20.888l6.817-12.644l1.593 2.89l-1.839 3.386l3.651.01l.778 1.449l-.8 1.477l-5.2-.018l-1.868 3.447Z"/></svg>”: No such file or directory
stack traceback:
        ...08cb49937d9cf63437ec/share/awesome/lib/gears/surface.lua:103: in function <...08cb49937d9cf63437ec/share/awesome/lib/gears/surface.lua:95>
        (...tail calls...)
        ...937d9cf63437ec/share/awesome/lib/awful/widget/button.lua:54: in function 'set_image'
        ...937d9cf63437ec/share/awesome/lib/awful/widget/button.lua:61: in function <...937d9cf63437ec/share/awesome/lib/awful/widget/button.lua:42>
        (...tail calls...)
        ...7d9cf63437ec/share/awesome/lib/awful/widget/launcher.lua:72: in function <...7d9cf63437ec/share/awesome/lib/awful/widget/launcher.lua:70>
        (...tail calls...)
        /nix/store/99i2bz5h83aq29d8k99dkhmpvz22iv2p-awesomerc.lua:70: in main chunk
2023-08-09 20:10:07 W: awesome: a_glib_poll:477: Last main loop iteration took 0.167526 seconds! Increasing limit for this warning to that value.
2023-08-09 20:10:11 E: awesome: a_xcb_io_cb:441: X server connection broke (error 1)

Expected result:

Two variants:

  1. Display the error also as a notification, not in the terminal
  2. No error message displayed and a nice SVG icon is used for the menu widget.

Preferably 2, as that would reflect what is currently documented: https://awesomewm.org/apidoc/widgets/awful.widget.launcher.html#image

image

Contributor guide