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
106
107
108
109
110
111
112
|
-- TODO: update to the new color format
local qnative = require "quarrel.native"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wibox = require "wibox"
local default_text = "Nothing playing"
local w_title = wibox.widget {
widget = wibox.widget.textbox,
text = "Nothing playing",
}
local w_artist = wibox.widget {
widget = wibox.container.background,
fg = qcolor.palette.dim.fg,
{
widget = wibox.widget.textbox,
text = "",
},
}
local w_progress_bar = wibox.widget {
widget = wibox.widget.progressbar,
max_value = 0,
value = 0,
forced_height = qui.CHAR_HEIGHT / 2,
forced_width = qvars.expanded_bar_size
- (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2)
- (qui.CHAR_HEIGHT / 1.25 + qui.PADDING) * 3,
color = qcolor.palette.yellow,
background_color = qcolor.palette.black,
shape = qui.shape,
}
local music = wibox.widget(qui.styled {
widget = wibox.container.background,
{
widget = wibox.container.margin,
margins = qui.BIG_PADDING,
{
{
{
widget = wibox.container.background,
bg = qcolor.palette.bg,
shape = qui.shape,
{
widget = wibox.container.margin,
margins = qui.PADDING,
{
{
widget = wibox.container.constraint,
width = qvars.expanded_bar_size
- (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2),
height = qui.CHAR_HEIGHT,
{
widget = wibox.container.scroll.horizontal,
speed = 50,
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
w_title,
},
},
{
widget = wibox.container.constraint,
width = qvars.expanded_bar_size
- (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2),
height = qui.CHAR_HEIGHT,
{
widget = wibox.container.scroll.horizontal,
speed = 50,
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
w_artist,
},
},
layout = wibox.layout.fixed.vertical,
},
},
},
nil,
nil,
layout = wibox.layout.align.horizontal,
},
nil,
{
widget = wibox.container.background,
bg = qcolor.palette.bg,
shape = qui.shape,
w_progress_bar,
},
layout = wibox.layout.align.vertical,
},
},
})
awesome.connect_signal("services::playerctl::metadata", function(title, artist, album_path)
w_title.text = title ~= "" and qnative.util.decode_html(title) or default_text
w_artist.widget.text = qnative.util.decode_html(artist)
end)
awesome.connect_signal("services::playerctl::position", function(position, length)
w_progress_bar.value = position
w_progress_bar.max_value = length
end)
awesome.connect_signal("services::playerctl::no_players", function()
w_title.text = default_text
w_artist.text = ""
w_progress_bar.value = 0
w_progress_bar.max_value = 0
end)
return music
|