【发布时间】:2021-03-06 15:07:37
【问题描述】:
我正在基于 playerctl 为 Awesome 创建一个小部件。 当我使用 awesomeclient 进行测试时,它工作正常。
awesome-client '
local stdout = "Playing;Eurythmics;Miracle of Love;file:///home/mgaber/Workbench/awesome/stags1.7/testing/173308_26.png"
local words = {}
for w in stdout:gmatch("([^;]*)") do
print(w)
table.insert(words, w)
end
mpdstatus = words[1]
current_song = words[2]
artist = words[3]
song_art = words[4]
a,b,c = 1, 2, 3
local song_art = string.sub( song_art,8, -1)
local awful = require("awful");
local gears = require("gears")
local naughty= require("naughty");
local bubble =function(cr, w, h)
return gears.shape.infobubble(cr, w, h, 20, 10, w/2 - 30)
end
naughty.notification(
{
margin = 15,
position = "top_left",
width = 640,
height = 160,
title = mpdstatus,
text=current_song .. " By " .. artist .. a .. c,
image = song_art});
'
但是,当我将代码放入 rc.lua 时,图标没有出现,我进行了测试,我的代码按预期工作,图像文件被传递给 naughty.notification..
local function show_MPD_status()
spawn.easy_async(GET_MPD_CMD, function(stdout, _, _, _)
-- notification = naughty.notification {
naughty.notification {
margin = 10,
timeout = 5,
hover_timeout = 0.5,
width = auto,
height = auto,
title = mpdstatus,
text = current_song .. " by " .. artist,
image = artUr
}
end)
end
很棒的版本
$ awesome --version
awesome v4.3-895-g538586c17-dirty (Too long)
• Compiled against Lua 5.3.6 (running with Lua 5.3)
• API level: 4
• D-Bus support: yes
• xcb-errors support: yes
• execinfo support: yes
• xcb-randr version: 1.6
• LGI version: 0.9.2
• Transparency enabled: yes
• Custom search paths: no
我收到一条显示通知 “状态” 艺术家的歌曲,没有图像或图标。
谢谢
【问题讨论】:
标签: lua notifications awesome-wm