6
6
7
7
--]]
8
8
9
- local helpers = require (" lain.helpers" )
10
- local awful = require (" awful" )
11
- local naughty = require (" naughty" )
12
- local wibox = require (" wibox" )
13
- local math = { modf = math.modf }
14
- local string = { format = string.format ,
15
- match = string.match ,
16
- rep = string.rep }
17
- local type , tonumber = type , tonumber
9
+ local helpers = require (" lain.helpers" )
10
+ local awful = require (" awful" )
11
+ local naughty = require (" naughty" )
12
+ local wibox = require (" wibox" )
13
+
14
+ local math , string , type , tonumber = math , string type , tonumber
18
15
19
16
-- ALSA volume bar
20
17
-- lain.widget.alsabar
@@ -36,11 +33,8 @@ local function factory(args)
36
33
local settings = args .settings or function () end
37
34
local width = args .width or 63
38
35
local height = args .height or 1
39
- local margins = args .margins or 1
40
- local paddings = args .paddings or 1
41
36
local ticks = args .ticks or false
42
37
local ticks_size = args .ticks_size or 7
43
- local step = args .step or ' 5%'
44
38
45
39
alsabar .cmd = args .cmd or " amixer"
46
40
alsabar .channel = args .channel or " Master"
@@ -54,13 +48,10 @@ local function factory(args)
54
48
alsabar .notification_preset .font = " Monospace 10"
55
49
end
56
50
57
- local format_get_cmd = string.format (" %s get %s" , alsabar .cmd , alsabar .channel )
58
- local format_inc_cmd = string.format (" %s sset %s %s+" , alsabar .cmd , alsabar .channel , step )
59
- local format_dec_cmd = string.format (" %s sset %s %s-" , alsabar .cmd , alsabar .channel , step )
60
- local format_tog_cmd = string.format (" %s sset %s toggle" , alsabar .cmd , alsabar .channel )
51
+ local format_cmd = string.format (" %s get %s" , alsabar .cmd , alsabar .channel )
61
52
62
53
if alsabar .togglechannel then
63
- format_get_cmd = { awful .util .shell , " -c" , string.format (" %s get %s; %s get %s" ,
54
+ format_cmd = { awful .util .shell , " -c" , string.format (" %s get %s; %s get %s" ,
64
55
alsabar .cmd , alsabar .channel , alsabar .cmd , alsabar .togglechannel ) }
65
56
end
66
57
@@ -69,8 +60,8 @@ local function factory(args)
69
60
forced_width = width ,
70
61
color = alsabar .colors .unmute ,
71
62
background_color = alsabar .colors .background ,
72
- margins = margins ,
73
- paddings = paddings ,
63
+ margins = 1 ,
64
+ paddings = 1 ,
74
65
ticks = ticks ,
75
66
ticks_size = ticks_size ,
76
67
widget = wibox .widget .progressbar
@@ -79,7 +70,7 @@ local function factory(args)
79
70
alsabar .tooltip = awful .tooltip ({ objects = { alsabar .bar } })
80
71
81
72
function alsabar .update (callback )
82
- helpers .async (format_get_cmd , function (mixer )
73
+ helpers .async (format_cmd , function (mixer )
83
74
local vol , playback = string.match (mixer , " ([%d]+)%%.*%[([%l]*)" )
84
75
85
76
if not vol or not playback then return end
@@ -152,14 +143,6 @@ local function factory(args)
152
143
153
144
helpers .newtimer (string.format (" alsabar-%s-%s" , alsabar .cmd , alsabar .channel ), timeout , alsabar .update )
154
145
155
- alsabar .bar :connect_signal (" button::press" , function (_ ,_ ,_ ,button )
156
- if (button == 4 ) then awful .spawn (format_inc_cmd )
157
- elseif (button == 5 ) then awful .spawn (format_dec_cmd )
158
- elseif (button == 1 ) then awful .spawn (format_tog_cmd )
159
- end
160
- alsabar .update ()
161
- end )
162
-
163
146
return alsabar
164
147
end
165
148
0 commit comments