116 lines
3.6 KiB
Lua
116 lines
3.6 KiB
Lua
local awful = require "awful"
|
|
local beautiful = require "beautiful"
|
|
local gcolor = require "gears.color"
|
|
local panel = require "ui.statusbar.panel"
|
|
local phosphor = require "assets.phosphor"
|
|
local qbind = require "quarrel.bind"
|
|
local qui = require "quarrel.ui"
|
|
local qvars = require "quarrel.vars"
|
|
local rubato = require "lib.rubato"
|
|
local wibox = require "wibox"
|
|
|
|
local battery = require "ui.statusbar.widgets.battery"
|
|
local brightness = require "ui.statusbar.widgets.brightness"
|
|
local clock = require "ui.statusbar.widgets.clock"
|
|
local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout"
|
|
local taglist = require "ui.statusbar.widgets.taglist"
|
|
local wifi = require "ui.statusbar.widgets.wifi"
|
|
|
|
screen.connect_signal("request::desktop_decoration", function(s)
|
|
local expand_button = wibox.widget {
|
|
widget = wibox.container.place,
|
|
valign = "center",
|
|
halign = "center",
|
|
{
|
|
widget = wibox.widget.imagebox,
|
|
image = gcolor.recolor_image(phosphor.caret_right_fill, qvars.colors.fg),
|
|
forced_width = qvars.icon_size,
|
|
forced_height = qvars.icon_size
|
|
},
|
|
_expanded = false
|
|
}
|
|
|
|
local bar = qui.popup {
|
|
placement = function(d)
|
|
local place = awful.placement.left
|
|
return place(d, {
|
|
margins = beautiful.useless_gap * 2
|
|
})
|
|
end,
|
|
minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2),
|
|
widget = {
|
|
{
|
|
{
|
|
expand_button,
|
|
taglist,
|
|
layout = wibox.layout.fixed.vertical,
|
|
spacing = qvars.padding * 2,
|
|
},
|
|
nil,
|
|
{
|
|
widget = wibox.container.place,
|
|
valign = "bottom",
|
|
{
|
|
{
|
|
widget = wibox.container.place,
|
|
keyboardlayout
|
|
},
|
|
clock,
|
|
wifi,
|
|
brightness,
|
|
battery,
|
|
layout = wibox.layout.fixed.vertical,
|
|
spacing = qvars.padding * 2
|
|
},
|
|
},
|
|
layout = wibox.layout.align.vertical,
|
|
expand = "outside",
|
|
},
|
|
nil,
|
|
nil,
|
|
layout = wibox.layout.align.horizontal,
|
|
}
|
|
}
|
|
|
|
local bar_width = bar.width + qvars.border_width * 2
|
|
|
|
bar:struts {
|
|
left = bar_width + beautiful.useless_gap * 4
|
|
}
|
|
|
|
local timed = rubato.timed {
|
|
duration = qvars.anim_duration,
|
|
intro = qvars.anim_intro,
|
|
pos = bar_width,
|
|
subscribed = function(pos)
|
|
if pos ~= bar_width and expand_button._expanded then
|
|
bar.widget.widget.third = panel
|
|
bar.ontop = true
|
|
elseif pos == bar_width and not expand_button._expanded then
|
|
bar.widget.widget.third = nil
|
|
bar.ontop = false
|
|
end
|
|
|
|
bar.shape = function(cr, _, h)
|
|
qvars.shape(cr, pos, h)
|
|
end
|
|
end
|
|
}
|
|
|
|
expand_button.buttons = {
|
|
qbind:new {
|
|
triggers = qvars.btns.left,
|
|
press = function()
|
|
if expand_button._expanded then
|
|
timed.target = bar_width
|
|
else
|
|
timed.target = bar_width + qvars.bar_size * 6
|
|
end
|
|
|
|
expand_button._expanded = not expand_button._expanded
|
|
end,
|
|
hidden = true
|
|
}
|
|
}
|
|
end)
|