local awful = require "awful" local beautiful = require "beautiful" local panel = require "ui.statusbar.panel" local phosphor = require "assets.phosphor" local qstore = require "quarrel.store" local qui = require "quarrel.ui" local qvars = require "quarrel.vars" local rubato = require "lib.rubato" local wibox = require "wibox" local clock = require "ui.statusbar.widgets.clock" local displays = require "ui.statusbar.widgets.displays" local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout" local taglist = require "ui.statusbar.widgets.taglist" local tasklist = require "ui.statusbar.widgets.tasklist" screen.connect_signal("request::desktop_decoration", function(s) local bar = qui.popup { placement = function(d) return awful.placement.left(d, { margins = beautiful.useless_gap * 2, }) end, minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2), widget = { { { taglist(s), layout = wibox.layout.fixed.vertical, spacing = qvars.padding * 2, id = "top", }, nil, -- tasklist(s), { widget = wibox.container.place, valign = "bottom", { displays.brightness, displays.audio, displays.battery, displays.wifi, { widget = wibox.container.place, { widget = wibox.container.constraint, height = qvars.char_height, width = qvars.char_height, keyboardlayout, }, }, clock, 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 panel_width local panel_toggle = { toggled = false } -- hacky but it works local timed = rubato.timed { duration = qvars.anim_duration, intro = qvars.anim_intro, pos = bar_width, subscribed = function(pos) if pos ~= bar_width and panel_toggle.toggled then bar.widget.widget.third = panel if panel_width == nil then panel_width = bar.widget.widget.third.width end bar.ontop = true elseif pos == bar_width and not panel_toggle.toggled then bar.widget.widget.third = nil bar.ontop = false end bar.shape = function(cr, _, h) qvars.shape(cr, pos, h) end end, } panel_toggle = qui.toggle { off = phosphor.arrows_out_simple_fill, on = phosphor.arrows_in_simple_fill, press = function(self) if not self.toggled then timed.target = bar_width else timed.target = bar_width + qvars.expanded_bar_size end end, } bar.widget:get_children_by_id("top")[1]:insert(1, panel_toggle) qstore.panel_toggle = panel_toggle end)