aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui/statusbar/widgets/dnd.lua
blob: 37d96b75827f8f0a66e8963ba8727d6aa76ffa1c (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
local qvars = require "quarrel.vars"
local wibox = require "wibox"
local dnd   = require "services.dnd"
local qcolor = require "quarrel.color"
local phosphor = require "assets.phosphor"
local qui = require "quarrel.ui"
local qdebug = require "quarrel.debug"

local w = wibox.widget {
    widget = wibox.container.background,
    shape = qui.shape,
    qui.padded {
        widget = wibox.container.place,
        qui.icon {
            icon = phosphor.bell_simple_slash_fill,
            color = qcolor.palette.bg(),
            widget = {
                forced_height = qui.CHAR_HEIGHT - qui.PADDING * 2,
                forced_width = qui.CHAR_HEIGHT - qui.PADDING * 2
            }
        }
    },
    -- visible = false
}

dnd:connect_signal("dnd", function (_, value)
    -- this is a giant hack
    -- why is it here? cause otherwise the align layout freaks out 
    -- and counts the hidden widget when reserving space *and* when drawing, offsetting the rest of the widgets in the process
    -- w.visible = value
    w.bg = qcolor.palette[value and "yellow" or "bg"]()
end)

return w