2017-07-02 04:43:26 +02:00
|
|
|
----------------------------------------------------------------------------
|
|
|
|
--- This file hosts the shared constants used by the notification subsystem.
|
|
|
|
--
|
|
|
|
-- [[documented in core.lua]]
|
|
|
|
--
|
|
|
|
-- @author koniu <gkusnierz@gmail.com>
|
|
|
|
-- @author Emmanuel Lepage Vallee <elv1313@gmail.com>
|
|
|
|
-- @copyright 2008 koniu
|
|
|
|
-- @copyright 2017 Emmanuel Lepage Vallee
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
local dpi = beautiful.xresources.apply_dpi
|
|
|
|
|
|
|
|
local ret = {}
|
|
|
|
|
|
|
|
ret.config = {
|
|
|
|
padding = dpi(4),
|
|
|
|
spacing = dpi(1),
|
2019-01-04 23:39:14 +01:00
|
|
|
icon_dirs = { "/usr/share/pixmaps/", "/usr/share/icons/hicolor" },
|
2017-07-02 04:43:26 +02:00
|
|
|
icon_formats = { "png", "gif" },
|
|
|
|
notify_callback = nil,
|
|
|
|
}
|
|
|
|
|
|
|
|
ret.config.presets = {
|
|
|
|
low = {
|
|
|
|
timeout = 5
|
|
|
|
},
|
|
|
|
normal = {},
|
|
|
|
critical = {
|
|
|
|
bg = "#ff0000",
|
|
|
|
fg = "#ffffff",
|
|
|
|
timeout = 0,
|
|
|
|
},
|
|
|
|
ok = {
|
|
|
|
bg = "#00bb00",
|
|
|
|
fg = "#ffffff",
|
|
|
|
timeout = 5,
|
|
|
|
},
|
|
|
|
info = {
|
|
|
|
bg = "#0000ff",
|
|
|
|
fg = "#ffffff",
|
|
|
|
timeout = 5,
|
|
|
|
},
|
|
|
|
warn = {
|
|
|
|
bg = "#ffaa00",
|
|
|
|
fg = "#000000",
|
|
|
|
timeout = 10,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-07-15 06:55:34 +02:00
|
|
|
ret.config._urgency = {
|
|
|
|
low = "\0",
|
|
|
|
normal = "\1",
|
|
|
|
critical = "\2"
|
|
|
|
}
|
|
|
|
|
|
|
|
ret.config.mapping = {
|
|
|
|
{{urgency = ret.config._urgency.low }, ret.config.presets.low}, --compat
|
|
|
|
{{urgency = ret.config._urgency.normal }, ret.config.presets.normal}, --compat
|
|
|
|
{{urgency = ret.config._urgency.critical}, ret.config.presets.critical}, --compat
|
|
|
|
{{urgency = "low" }, ret.config.presets.low},
|
|
|
|
{{urgency = "normal" }, ret.config.presets.normal},
|
|
|
|
{{urgency = "critical"}, ret.config.presets.critical},
|
|
|
|
}
|
|
|
|
|
2017-07-02 04:43:26 +02:00
|
|
|
ret.config.defaults = {
|
|
|
|
timeout = 5,
|
|
|
|
text = "",
|
|
|
|
screen = nil,
|
|
|
|
ontop = true,
|
|
|
|
margin = dpi(5),
|
|
|
|
border_width = dpi(1),
|
2019-07-15 05:52:07 +02:00
|
|
|
position = "top_right",
|
|
|
|
urgency = "normal",
|
2019-07-22 06:10:22 +02:00
|
|
|
message = "",
|
|
|
|
title = "",
|
|
|
|
app_name = "",
|
|
|
|
ignore = false,
|
2017-07-02 04:43:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ret.notification_closed_reason = {
|
2019-01-03 09:09:42 +01:00
|
|
|
too_many_on_screen = -2,
|
2017-07-02 04:43:26 +02:00
|
|
|
silent = -1,
|
|
|
|
expired = 1,
|
|
|
|
dismissedByUser = 2, --TODO v5 remove this undocumented legacy constant
|
|
|
|
dismissed_by_user = 2,
|
|
|
|
dismissedByCommand = 3, --TODO v5 remove this undocumented legacy constant
|
2019-07-17 07:50:57 +02:00
|
|
|
dismissed_by_command = 3,
|
2017-07-02 04:43:26 +02:00
|
|
|
undefined = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Legacy --TODO v5 remove this alias
|
|
|
|
ret.notificationClosedReason = ret.notification_closed_reason
|
|
|
|
|
|
|
|
return ret
|