-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
as told in IRC here is my patch for naughty. It adds urgency level
(DBUS) and maps them to according presets. I also added support for the
DBUS expire field.
Test with:
# urgency level critical
notify-send -u critical hey joe
# expires in 2 seconds
notify-send -t 2000 hey
Patch is also available via:
http://www.morpgnet.org/~leon/naughty_dbus_urgency_level_and_presets.patch
Thanks to jd for enhancing DBUS support :)
Regards,
Leon Winter
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkktTdQACgkQ3qn9m9SfDYceBwCeNwNQ9t0UyvFWXBqrb7trPxGC
mb4An0Rmc7Y+JZAu19nTiBE4LL45fPaz
=vKen
-END PGP SIGNATURE-
diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index e84a4d8..43c6835 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -25,55 +25,90 @@ module(naughty)
--- Naughty configuration - a table containing common/default popup settings.
-- You can override some of these for individual popups using args to notify().
-- @name config
--- @field timeout Number of seconds after which popups disappear.
--- Set to 0 for no timeout. Default: 5
-- @field screen Screen on which the popups will appear number. Default: 1
-- @field position Corner of the workarea the popups will appear.
-- Valid values: 'top_right', 'top_left', 'bottom_right', 'bottom_left'.
-- Default: 'top_right'
-- @field padding Space between popups and edge of the workarea. Default: 4
--- @field height Height of a single line of text. Default: 16
-- @field width Width of a popup. Default: 300
-- @field spacing Spacing between popups. Default: 1
-- @field ontop Boolean forcing popups to display on top. Default: true
-- @field margin Space between popup edge and content. Default: 10
--- @field font Popup font. Default: beautiful.font or Verdana 8
--- @field icon Popup icon. Default: nil
--- @field icon_size Size of the icon in pixels. Default: nil
-- @field icon_dirs List of directories that will be checked by getIcon()
-- Default: { /usr/share/pixmaps/, }
-- @field icon_formats List of formats that will be checked by getIcon()
-- Default: { png, gif }
--- @field fg Foreground color. Default: beautiful.fg_focus or '#ff'
--- @field bg Background color. Default: beautiful.bg_focus or '#535d6c'
--- @field border_color Border color.
--- Default: beautiful.border_focus or '#535d6c'
-- @field border_width Border width. Default: 1
--- @field hover_timeout Delay in seconds after which hovered popup disappears.
--- Default: nil
-- @class table
config = {}
-config.timeout = 5
-config.screen = 1
-config.position = top_right
config.padding = 4
-config.height = 16
-config.width = 300
config.spacing = 1
config.margin = 10
-config.icon = nil
-config.icon_size = nil
config.icon_dirs = { /usr/share/pixmaps/, }
config.icon_formats = { png, gif }
config.border_width = 1
-config.hover_timeout = nil
+
+--- Notification Presets - a table containing presets for different purposes
+-- You have to pass a reference of a preset in your notify() call to use the preset
+-- At least the default preset named normal has to be defined
+-- The presets low, normal and critical are used for notifications over DBUS
+-- @name config.presets
+-- @field low The preset for notifications with low urgency level
+-- @field normal The default preset for every notification without a preset that will also be used for normal urgency level
+-- @field critical The preset for notifications with a critical urgency level
+-- @class table
+
+--- Default preset for notifications
+-- @name config.presets.normal
+-- @field timeout Number of seconds after which popups disappear.
+-- Set to 0 for no timeout. Default: 5
+-- @field hover_timeout Delay in seconds after which hovered popup disappears.
+-- Default: nil
+-- @field border_color Border color.
+-- Default: beautiful.border_focus or '#535d6c'
+-- @field fg Foreground color. Default: beautiful.fg_focus or '#ff'
+-- @field bg Background color. Default: beautiful.bg_focus or '#535d6c'
+-- @field font Popup font. Default: beautiful.font or Verdana 8
+-- @field height Height of a single line of text. Default: 16
+-- @field icon Popup icon. Default: nil
+-- @field icon_size Size of the icon in pixels. Default: nil
+
+config.presets = {
+low = {
+timeout = 5
+},
+normal = {
+timeout = 8,
+hover_timeout = nil,
+position = top_right,
+screen = 1,
+width = 300,
+height = 16,
+icon = nil,
+icon_size = nil
+},
+critical = {
+bg = #ff,
+fg = #ff,
+timeout = 0,
+height = 25
+}
+}
-- Counter for the notifications
-- Required for later access via DBUS
local counter = 1
+-- DBUS Notification constants
+local urgency = {
+low = \0,
+normal = \1,
+critical = \2
+}
+
--- Index of notifications. See config