local awful = require "awful" local beautiful = require "beautiful" local panel = require "ui.statusbar.panel" local qanim = require "quarrel.animation" local qui = require "quarrel.ui" local qvars = require "quarrel.vars" local wibox = require "wibox" local M = require "ui.statusbar.consts" 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_new" 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 + qui.BORDER_WIDTH * 2), widget = { { { taglist(s), layout = wibox.layout.fixed.vertical, spacing = qui.PADDING * 2, id = "top", }, nil, { widget = wibox.container.place, valign = "bottom", { displays.brightness, displays.audio, displays.battery, displays.wifi, { widget = wibox.container.place, { widget = wibox.container.constraint, height = qui.CHAR_HEIGHT, width = qui.CHAR_HEIGHT, keyboardlayout, }, }, clock, layout = wibox.layout.fixed.vertical, spacing = qui.PADDING * 2, }, }, layout = wibox.layout.align.vertical, expand = "outside", }, nil, nil, layout = wibox.layout.align.horizontal, }, toggled = false, } local bar_width = bar.width + qui.BORDER_WIDTH * 2 bar.shape = function(cr, _, h) qui.shape(cr, bar_width, h) end bar:struts { left = bar_width + beautiful.useless_gap * 4, } bar.widget.widget.third = panel local timed = qanim:new { duration = qvars.anim_duration, pos = bar_width, easing = qvars.easing, subscribed = function(pos) if pos ~= bar_width and bar.toggled then bar.ontop = true elseif pos == bar_width and not bar.toggled then bar.ontop = false end bar.shape = function(cr, _, h) qui.shape(cr, pos, h) end end, } function bar:toggle() self.toggled = not self.toggled if self.toggled then timed:set(bar_width + M.EXPANDED_BAR_SIZE) else timed:set(bar_width) end end s.bar = bar end)