dotfiles/.config/awesome/ui/top-panel/widgets/systray.lua

65 lines
1.2 KiB
Lua
Raw Normal View History

2024-02-19 19:41:33 -08:00
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
2024-02-19 19:41:33 -08:00
local rubato = require("lib.rubato")
local helpers = require("helpers")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
2024-02-19 19:41:33 -08:00
local arrow = wibox.widget.textbox()
arrow.font = helpers.ui.set_font("13")
arrow.markup = config.icons.arr.r
local systray = wibox.widget.systray()
systray.visible = true
theme.systray_icon_spacing = dpi(4)
local sys = wibox.widget({
2024-02-19 19:41:33 -08:00
widget = wibox.container.constraint,
strategy = "max",
visible = true,
width = 0,
2024-02-19 19:41:33 -08:00
{
widget = wibox.container.margin,
margins = dpi(2),
systray,
2024-02-19 19:41:33 -08:00
},
})
2024-02-19 19:41:33 -08:00
local slide = rubato.timed({
duration = 0.9,
awestore_compat = true,
subscribed = function(pos)
sys.width = pos
2024-02-19 19:41:33 -08:00
end,
})
local value = true
2024-02-19 19:41:33 -08:00
arrow.toggle = function()
if value == false then
arrow.markup = config.icons.arr.r
2024-02-19 19:41:33 -08:00
value = true
slide:set(2)
else
arrow.markup = config.icons.arr.l
2024-02-19 19:41:33 -08:00
slide:set(500)
value = false
end
end
arrow:add_button(awful.button({}, 1, function()
2024-02-19 19:41:33 -08:00
arrow.toggle()
end))
local full = wibox.widget({
2024-02-19 19:41:33 -08:00
layout = wibox.layout.fixed.horizontal,
arrow,
sys,
2024-02-19 19:41:33 -08:00
spacing = dpi(2),
})
return full