diff options
author | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
---|---|---|
committer | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
commit | f7116d268aff3fae88d8de408e8c807295618a5c (patch) | |
tree | 6f52530d5799769e6af7c63bc5108f16f9aff742 /.config/awesome/ui/statusbar/init.lua | |
parent | f0b32f45746c026d402651013b7e98315d6956a1 (diff) |
restructure and improve config
Diffstat (limited to '.config/awesome/ui/statusbar/init.lua')
-rw-r--r-- | .config/awesome/ui/statusbar/init.lua | 176 |
1 files changed, 133 insertions, 43 deletions
diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua index dfe2868..01d6498 100644 --- a/.config/awesome/ui/statusbar/init.lua +++ b/.config/awesome/ui/statusbar/init.lua @@ -1,10 +1,14 @@ local awful = require "awful" local beautiful = require "beautiful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qui = require "quarrel.ui" +local gcolor = require "gears.color" +local gdebug = require "gears.debug" +local phosphor = require "assets.phosphor" +local qbind = require "quarrel.bind" +local q = require "quarrel" +local rubato = require "lib.rubato" local taglist = require "ui.statusbar.widgets.taglist" local clock = require "ui.statusbar.widgets.clock" @@ -14,62 +18,148 @@ local brightness = require "ui.statusbar.widgets.brightness" local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout" screen.connect_signal("request::desktop_decoration", function(s) - local bar = h.popup { + 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, - -- ontop = true, - minimum_width = vars.bar_size, - maximum_width = vars.bar_size * 20, - minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + vars.border_width * 2), + minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2), widget = { { + nil, { - widget = wibox.container.place, - valign = "top", - { - widget = wibox.widget.textbox, - text = "", - font = h.font(1.5) - } - }, - taglist, - { - widget = wibox.container.place, - valign = "bottom", { + expand_button, + taglist, layout = wibox.layout.fixed.vertical, - spacing = vars.padding * 2, - brightness, - battery, - wifi, - keyboardlayout, - clock + spacing = qvars.padding * 2, }, + nil, + { + widget = wibox.container.place, + valign = "bottom", + { + brightness, + battery, + wifi, + { + widget = wibox.container.place, + keyboardlayout + }, + clock, + layout = wibox.layout.fixed.vertical, + spacing = qvars.padding * 2 + }, + }, + layout = wibox.layout.align.vertical, + expand = "outside", }, - layout = wibox.layout.align.vertical, - expand = "outside", + nil, + layout = wibox.layout.align.horizontal }, - -- { - -- widget = wibox.container.background, - -- bg = vars.colors.fg, - -- fg = vars.colors.bg, - -- visible = false, - -- { - -- widget = wibox.widget.textbox, - -- text = "this is gay" - -- } - -- }, - -- spacing = vars.big_padding, - spacing = nil, - layout = wibox.layout.fixed.horizontal + nil, + nil, + layout = wibox.layout.align.horizontal, } } + local bar_width = bar.width + bar:struts { - left = dpi(16) + vars.big_padding * 2 + beautiful.useless_gap * 4 + -- left = qvars.bar_size + qvars.big_padding * 2 + beautiful.useless_gap * 4 + -- left = qvars.bar_size + qvars.border_width * 2 + beautiful.useless_gap * 4 + left = bar_width + qvars.border_width * 2 + 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 = wibox.widget { + { + widget = wibox.container.margin, + margins = { + left = qvars.big_padding + } + }, + { + widget = wibox.container.constraint, + width = qvars.bar_size * 6, + strategy = "min", + { + { + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "1" + } + }, + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "2" + } + }, + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "3" + } + }, + spacing = qvars.padding, + layout = wibox.layout.flex.horizontal + }, + layout = wibox.layout.fixed.vertical + } + }, + layout = wibox.layout.fixed.horizontal + } + bar.ontop = true + elseif pos == bar_width and not expand_button._expanded then + bar.widget.widget.third = nil + bar.ontop = false + end + + bar.maximum_width = pos + 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) |