1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
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)
|