aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui/wicked/init.lua
blob: 5687b812c1bca0299c4f2d52c21b84903723dbb4 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
local awful = require "awful"
local vars = require "misc.vars"
local wibox = require "wibox"
local debug = require "gears.debug"
local gtimer = require "gears.timer"
local naughty = require "naughty"
-- local rubato = require "lib.rubato"
local default = require "ui.wicked._default"
local h = require "misc.helpers"

local beautiful = require "beautiful"
local xresources = require "beautiful.xresources"
local dpi = xresources.apply_dpi

local wicked = {}

wicked._active_notififcations = {}

function wicked:notify(n)
    -- local notif = wibox.widget {
    local notif = h.popup {
        -- widget = {
        --     {
        --         {
        --             widget = naughty.widget.icon,
        --             notification = n,
        --             forced_height = 0,
        --             forced_width = 0,
        --             clip_shape = vars.shape,
        --             id = "icon_role"
        --         },
        --         {
                    -- {
                    --     widget = naughty.widget.title,
                    --     notification = n
                    -- },
                    -- {
                    --     widget = naughty.widget.message,
                    --     notification = n
                    -- },
        --             layout = wibox.layout.fixed.vertical
        --         },
        --         layout = wibox.layout.fixed.horizontal,
        --         spacing = vars.padding
        --     },
        --     widget = wibox.container.margin,
        --     margins = vars.padding
        -- },
        widget = {
            -- {
                {
                    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    = 4,
                layout     = wibox.layout.fixed.horizontal
            -- },
            -- actionlist,
            -- spacing = 10,
            -- layout  = wibox.layout.fixed.vertical,
        },
        placement = awful.placement.centered,
        ontop = true
    }

    gtimer {
        timeout = vars.notif_timeout,
        autostart = true,
        callback = function()
            notif.visible = false
            notif = nil
        end
    }

    -- local icon = notif.widget:get_children_by_id("icon_role")[1]

    -- if n.image then
    --     icon.forced_height = dpi(32)
    --     icon.forced_width = dpi(32)
    -- end
end

return wicked