aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/components/signals/naughty.lua
blob: bab47129c0c3d22c195fd43d1842f03b16648a5d (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
55
56
57
58
59
60
61
62
63
64
local awful = require "awful"
local vars = require "themes.prismite.vars"
local wibox = require "wibox"
local naughty = require "naughty"
local xresources = require "beautiful.xresources"
local dpi = xresources.apply_dpi

function build_notification(n)
    

    local popup = awful.popup {
        widget = {
            {
                {
                    widget = naughty.widget.icon,
                    image = n.image,
                    forced_height = 64,
                    forced_width = 64,
                    clip_shape = vars.shape
                },
                {
                    {
                        widget = wibox.widget.textbox,
                        text = n.title
                    },
                    {
                        widget = wibox.widget.textbox,
                        text = n.message
                    },
                    layout = wibox.layout.fixed.vertical
                },
                layout = wibox.layout.fixed.horizontal
            },
            widget = wibox.container.margin,
            margins = dpi(4)
        },
        border_color =  vars.colors.bright.black,
        border_width = vars.border_width,
        ontop = true,
        placement = function(d)
            return awful.placement.bottom_right(d, {
                honor_padding = true
            })
        end,
        bg = vars.colors.bg,
        shape = vars.shape,
    }

    -- popup.y = screen[1].tiling_area.height -  - dpi(4)
end

-- naughty.connect_signal("request::display", build_notification)

naughty.connect_signal("request::display", function(n)
    naughty.layout.box { notification = n }
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)