-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnd.lua
46 lines (40 loc) · 921 Bytes
/
dnd.lua
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
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local normal_bg = beautiful.bg_normal
local suspended_bg = beautiful.fg_normal
local suspended = naughty.is_suspended()
local moon_bg = beautiful.bg_normal
if suspended then
moon_bg = suspended_bg
else
moon_bg = normal_bg
end
local dnd = wibox.widget({
{
{
widget = wibox.widget.imagebox,
image = gears.filesystem.get_configuration_dir() .. "icons/moon.svg",
resize = true,
valign = "center",
halign = "center",
},
widget = wibox.container.margin,
margins = 4,
},
widget = wibox.container.background,
bg = moon_bg,
})
dnd:buttons(awful.button({}, 1, function()
if suspended then
dnd.bg = normal_bg
naughty.resume()
else
dnd.bg = suspended_bg
naughty.suspend()
end
suspended = not suspended
end))
return dnd