Update and add bling task_preview, tag_preview and window_switcher Add catppuccin-macchiato Use my weather key Update keybindings Update autorun Fix sliders
147 lines
No EOL
3.1 KiB
Lua
147 lines
No EOL
3.1 KiB
Lua
-- ## Clock ##
|
|
-- ~~~~~~~~~~~
|
|
|
|
-- Requirements :
|
|
-- ~~~~~~~~~~~~~~
|
|
local awful = require("awful")
|
|
local gears = require("gears")
|
|
local wibox = require("wibox")
|
|
local naughty = require("naughty")
|
|
local beautiful = require("beautiful")
|
|
local dpi = beautiful.xresources.apply_dpi
|
|
|
|
local notifbox_layout = wibox.widget {
|
|
layout = wibox.layout.fixed.vertical,
|
|
spacing = dpi(7)
|
|
}
|
|
|
|
local function create_notifcation(n)
|
|
local icon_visibility
|
|
|
|
if n.icon == nil then
|
|
icon_visibility = false
|
|
else
|
|
icon_visibility = true
|
|
end
|
|
|
|
-- Action widget
|
|
local action_widget = {
|
|
{
|
|
{
|
|
id = "text_role",
|
|
align = "center",
|
|
font = "Roboto Mono 10",
|
|
widget = wibox.widget.textbox,
|
|
},
|
|
margins = { left = dpi(6), right = dpi(6) },
|
|
widget = wibox.container.margin,
|
|
},
|
|
widget = wibox.container.background,
|
|
}
|
|
|
|
-- Apply action widget ^
|
|
local actions = wibox.widget {
|
|
notification = n,
|
|
base_layout = wibox.widget {
|
|
spacing = dpi(8),
|
|
layout = wibox.layout.flex.horizontal,
|
|
},
|
|
widget_template = action_widget,
|
|
widget = naughty.list.actions,
|
|
}
|
|
|
|
local function space_h(length, circumstances)
|
|
return wibox.widget {
|
|
forced_width = length,
|
|
visible = circumstances,
|
|
layout = wibox.layout.fixed.horizontal,
|
|
}
|
|
end
|
|
|
|
-- Make other widgets
|
|
local title = wibox.widget.textbox()
|
|
title.font = "Roboto bold 14"
|
|
title.align = 'left'
|
|
title.markup = n.title
|
|
|
|
local message = wibox.widget.textbox()
|
|
message.font = "Roboto Medium 11"
|
|
message.align = 'left'
|
|
message.markup = n.message
|
|
|
|
local icon = wibox.widget {
|
|
nil,
|
|
{
|
|
{
|
|
image = n.icon or n.app_icon,
|
|
visible = icon_visibility,
|
|
widget = wibox.widget.imagebox,
|
|
},
|
|
strategy = "max",
|
|
width = dpi(30),
|
|
height = dpi(30),
|
|
widget = wibox.container.constraint,
|
|
},
|
|
expand = 'none',
|
|
layout = wibox.layout.align.vertical,
|
|
}
|
|
|
|
local container = wibox.widget {
|
|
{
|
|
title,
|
|
{
|
|
icon,
|
|
space_h(dpi(10), icon_visibility),
|
|
message,
|
|
layout = wibox.layout.fixed.horizontal,
|
|
},
|
|
actions,
|
|
spacing = dpi(10),
|
|
layout = wibox.layout.fixed.vertical,
|
|
},
|
|
margins = dpi(20),
|
|
widget = wibox.container.margin,
|
|
}
|
|
|
|
notifbox_layout:insert(
|
|
1,
|
|
container
|
|
)
|
|
end
|
|
|
|
naughty.connect_signal("request::display", function(n)
|
|
create_notifcation(n)
|
|
end)
|
|
|
|
local notif_core = {}
|
|
|
|
notif_core.is_read = true
|
|
|
|
notif_core.widget = wibox.widget {
|
|
{
|
|
{
|
|
text = "Dismiss all",
|
|
halign = "center",
|
|
valign = "center",
|
|
widget = wibox.widget.textbox
|
|
},
|
|
buttons = gears.table.join(
|
|
awful.button({}, 1, function()
|
|
notifbox_layout:reset()
|
|
end)
|
|
),
|
|
forced_width = 75,
|
|
shape = gears.shape.rounded_bar,
|
|
shape_border_width = 1,
|
|
shape_border_color = beautiful.bg_highlight,
|
|
widget = wibox.container.background
|
|
},
|
|
{
|
|
notifbox_layout,
|
|
layout = wibox.layout.flex.vertical
|
|
},
|
|
spacing = dpi(4),
|
|
layout = wibox.layout.fixed.vertical,
|
|
}
|
|
|
|
return notif_core |