aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui/statusbar/init.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/ui/statusbar/init.lua')
-rw-r--r--.config/awesome/ui/statusbar/init.lua68
1 files changed, 31 insertions, 37 deletions
diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua
index 77a28f7..137ffb8 100644
--- a/.config/awesome/ui/statusbar/init.lua
+++ b/.config/awesome/ui/statusbar/init.lua
@@ -1,18 +1,17 @@
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 qanim = require "quarrel.animation"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
-local rubato = require "lib.rubato"
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"
-local tasklist = require "ui.statusbar.widgets.tasklist"
+local taglist = require "ui.statusbar.widgets.taglist_new"
screen.connect_signal("request::desktop_decoration", function(s)
local bar = qui.popup {
@@ -21,17 +20,16 @@ screen.connect_signal("request::desktop_decoration", function(s)
margins = beautiful.useless_gap * 2,
})
end,
- minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2),
+ minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qui.BORDER_WIDTH * 2),
widget = {
{
{
taglist(s),
layout = wibox.layout.fixed.vertical,
- spacing = qvars.padding * 2,
+ spacing = qui.PADDING * 2,
id = "top",
},
nil,
- -- tasklist(s),
{
widget = wibox.container.place,
valign = "bottom",
@@ -44,14 +42,14 @@ screen.connect_signal("request::desktop_decoration", function(s)
widget = wibox.container.place,
{
widget = wibox.container.constraint,
- height = qvars.char_height,
- width = qvars.char_height,
+ height = qui.CHAR_HEIGHT,
+ width = qui.CHAR_HEIGHT,
keyboardlayout,
},
},
clock,
layout = wibox.layout.fixed.vertical,
- spacing = qvars.padding * 2,
+ spacing = qui.PADDING * 2,
},
},
layout = wibox.layout.align.vertical,
@@ -61,51 +59,47 @@ screen.connect_signal("request::desktop_decoration", function(s)
nil,
layout = wibox.layout.align.horizontal,
},
+
+ toggled = false,
}
- local bar_width = bar.width + qvars.border_width * 2
+ 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,
}
- local panel_width
- local panel_toggle = { toggled = false } -- hacky but it works
+ bar.widget.widget.third = panel
- local timed = rubato.timed {
+ local timed = qanim:new {
duration = qvars.anim_duration,
- intro = qvars.anim_intro,
pos = bar_width,
+ easing = qvars.easing,
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
+ if pos ~= bar_width and bar.toggled then
bar.ontop = true
- elseif pos == bar_width and not panel_toggle.toggled then
- bar.widget.widget.third = nil
+ elseif pos == bar_width and not bar.toggled then
bar.ontop = false
end
bar.shape = function(cr, _, h)
- qvars.shape(cr, pos, h)
+ qui.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,
- }
+ 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
- bar.widget:get_children_by_id("top")[1]:insert(1, panel_toggle)
- qstore.panel_toggle = panel_toggle
+ s.bar = bar
end)