aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/signals/naughty.lua
blob: 90594c123506a4d21e82c85bda4f3ee8b0b85523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local awful = require "awful"
local beautiful = require "beautiful"
local naughty = require "naughty"
local qvars = require "quarrel.vars"
local wibox = require "wibox"

naughty.connect_signal("request::display", function(n)
    naughty.layout.box { 
        notification = n,
        placement = function(d)
            return awful.placement.right(d, {
                margins = beautiful.useless_gap * 2
            })
        end,
        widget_template = {
            widget = wibox.container.margin,
            margins = qvars.big_padding,
            {
                {
                    widget = naughty.widget.icon,
                    notification = n
                },
                {
                    widget = wibox.container.place,
                    valign = "center",
                    halign = "center",
                    {
                        {
                            widget = naughty.widget.title,
                            notification = n
                        },
                        {
                            widget = naughty.widget.message,
                            notification = n
                        },
                        -- spacing = 4,
                        layout = wibox.layout.fixed.vertical,
                    }
                },
                fill_space = true,
                spacing = n.icon and qvars.big_padding or 0,
                layout = wibox.layout.fixed.horizontal
            }
        }
    }
end)

naughty.connect_signal("request::display_error", function(message, startup)
    naughty.notification {
        urgency = "critical",
        title   = "Oops, an error happened"..(startup and " during startup!" or "!"),
        message = message
    }
end)