Search code examples
luanotificationsawesome-wm

Awesome naughty notifications


I'm creating a widget for Awesome based on playerctl. When i test with awesomeclient it works fine.

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});

'

However when i put the code in rc.lua the icon doesn't appear, I tested and my code works as supposed to and the image file is passed to 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 --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

I get a notification displaying "Status" Song by Artist with no image or icon.

Thanks


Solution

  • I finally managed to sort this out. The problem was caused by a Widget template that shapes the notification and was misconfigured, removing the template fixed it