Various notification daemon fixes

This commit is contained in:
elenapan 2020-03-27 01:55:00 +02:00
parent 4edb254910
commit 89b56df783
3 changed files with 10 additions and 5 deletions

View file

@ -29,7 +29,7 @@ awesome.connect_signal("evil::battery", function(battery)
end
else
icon = icons.battery_charging
if battery > 99 and not battery_full_already_notified then
if battery > 96 and not battery_full_already_notified then
battery_full_already_notified = true
message = helpers.colorize_text("Full", x.color10)
timeout = 6

View file

@ -8,7 +8,7 @@ awesome.connect_signal("evil::brightness", function (percentage)
if first_time then
first_time = false
else
if sidebar.visible or dashboard.visible then
if (sidebar and sidebar.visible) or (dashboard and dashboard.visible) then
-- Sidebar and dashboard already show brightness, so
-- destroy notification if it exists
if notif then

View file

@ -6,11 +6,12 @@ local notif
local first_time = true
local timeout = 2
local old_artist, old_song
local send_mpd_notif = function (artist, song, paused)
if first_time then
first_time = false
else
if paused or sidebar.visible then
if paused or (sidebar and sidebar.visible) then
-- Sidebar and already shows mpd info, so
-- destroy notification if it exists
-- Also destroy it if music pauses
@ -18,8 +19,12 @@ local send_mpd_notif = function (artist, song, paused)
notif:destroy()
end
else
-- Send notification
notif = notifications.notify_dwim({ title = "Now playing:", message = "<b>"..song.."</b> by <b>"..artist.."</b>", icon = icons.music, timeout = timeout, app_name = "mpd" }, notif)
-- Since the evil::mpd signal is also emitted when seeking, only send a notification when the song and artist are different than before.
if artist ~= old_artist and song ~=old_song then
notif = notifications.notify_dwim({ title = "Now playing:", message = "<b>"..song.."</b> by <b>"..artist.."</b>", icon = icons.music, timeout = timeout, app_name = "mpd" }, notif)
old_artist = artist
old_song = song
end
end
end
end