blob: fc0f13ba5545f79a6b9cb3504460a8bbfe757a04 (
plain)
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
|
widget = {
plugin = 'alsa',
cb = function(t)
local symbol = ''
if t.mute then
return { full_text = ' ', color = '#ed8796' }
else
local percent = (t.vol.cur - t.vol.min) / (t.vol.max - t.vol.min) * 100
if percent <= 30 then
symbol = ''
elseif percent >= 70 then
symbol = ''
if percent >= 99.5 then
return {
full_text = string.format('%s %d%%', symbol, math.floor(0.5 + percent)),
color = '#b7bdf8'
}
end
end
return {
full_text = string.format('%s%3d%%', symbol, math.floor(0.5 + percent)),
color = '#b7bdf8'
}
end
end,
event = [[
local t = ...
if t.button == 1 then
os.execute('pactl set-sink-mute @DEFAULT_SINK@ toggle &')
end
]],
}
|