awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.34k stars 597 forks source link

Showing FreeDesktop app names or icons in naughty notifications #2998

Open judemille opened 4 years ago

judemille commented 4 years ago

I can't seem to get app icons to show in naughty notifications triggered by D-Bus. The relevant part of my config follows.

naughty.config.icon_dirs = { "/usr/share/icons/Papirus-Dark", "/usr/share/pixmaps" }
naughty.config.icon_formats = { "png", "gif", "svg" }

If I can't get app icons next to notifications, can I at least show app names in notifications somehow?

ghost commented 4 years ago

Same problem. /usr/lib/notification-daemon-1.0/notification-daemon is running perfectly but naughty does not show the icons.

can I at least show app names in notifications somehow?

naughty.connect_signal("request::display", function(n)
naughty.layout.box{
  notification = n,
  widget_template = {  
    markup = n.app_name,
    font = 'Comic sans bold 28',
    align = 'center',
    widget = wibox.widget.textbox
  }
}
end)

This is only an example. Will not obviously work out of the box

actionless commented 4 years ago

/usr/lib/notification-daemon-1.0/notification-daemon

if you have GNOME Notification Daemon running your notifications are handled by it, not by naughty (actually it depends who of them started up first and claimed the dbus interface for notifications)

Elv13 commented 4 years ago

I am quite convinced app_icon works properly. App name is not a primary source for the icons right now. With AwesomeWM git-master, if the notification is created by a client in the same PID, the icon will show up.

With the notification rules, you can probably do something like (untested):

    ruled.notification.append_rule {
        rule       = { icon = "" },
        properties = { 
             icon = function(n) return n.app_name end
        }
    }

Note that this will need to be tweaked a bit to work and requires AwesomeWM git-master from yesterday or later.

edit: As @actionless says, make sure you are using naughty, of course.