Skip to content

Commit be69daf

Browse files
committed
util.markup: fixed typos
1 parent c02fcdb commit be69daf

3 files changed

Lines changed: 27 additions & 13 deletions

File tree

util/markup.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,37 @@ function markup.small(text) return format("<small>%s</small>", text) end
2525

2626
-- Set the font
2727
function markup.font(font, text)
28-
return format("<span font='%s'>%s</span>", font, text)
28+
return format("<span font='%s'>%s</span>", font, text)
2929
end
3030

3131
-- Set the foreground
3232
function markup.fg.color(color, text)
33-
return format("<span foreground='%s'>%s</span>", fg, bg, text)
33+
return format("<span foreground='%s'>%s</span>", color, text)
3434
end
3535

3636
-- Set the background
3737
function markup.bg.color(color, text)
38-
return format("<span background='%s'>%s</span>", fg, bg, text)
38+
return format("<span background='%s'>%s</span>", color, text)
3939
end
4040

4141
-- Set foreground and background
4242
function markup.color(fg, bg, text)
43-
return format("<span foreground='%s' background='%s'>%s</span>", fg, bg, text)
43+
return format("<span foreground='%s' background='%s'>%s</span>", fg, bg, text)
4444
end
4545

4646
-- Set font and foreground
4747
function markup.fontfg(font, fg, text)
48-
return format("<span font='%s' foreground='%s'>%s</span>", font, fg, text)
48+
return format("<span font='%s' foreground='%s'>%s</span>", font, fg, text)
4949
end
5050

5151
-- Set font and background
5252
function markup.fontbg(font, bg, text)
53-
return format("<span font='%s' background='%s'>%s</span>", font, bg, text)
53+
return format("<span font='%s' background='%s'>%s</span>", font, bg, text)
5454
end
5555

5656
-- Set font, foreground and background
5757
function markup.fontcolor(font, fg, bg, text)
58-
return format("<span font='%s' foreground='%s' background='%s'>%s</span>", font, fg, bg, text)
58+
return format("<span font='%s' foreground='%s' background='%s'>%s</span>", font, fg, bg, text)
5959
end
6060

6161
-- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...)

widget/alsabar.lua

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ local function factory(args)
3636
local settings = args.settings or function() end
3737
local width = args.width or 63
3838
local height = args.height or 1
39+
local margins = args.margins or 1
40+
local paddings = args.paddings or 1
3941
local ticks = args.ticks or false
4042
local ticks_size = args.ticks_size or 7
43+
local step = args.step or '5%'
4144

4245
alsabar.cmd = args.cmd or "amixer"
4346
alsabar.channel = args.channel or "Master"
@@ -51,10 +54,13 @@ local function factory(args)
5154
alsabar.notification_preset.font = "Monospace 10"
5255
end
5356

54-
local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel)
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)
5561

5662
if alsabar.togglechannel then
57-
format_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s",
63+
format_get_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s",
5864
alsabar.cmd, alsabar.channel, alsabar.cmd, alsabar.togglechannel) }
5965
end
6066

@@ -63,8 +69,8 @@ local function factory(args)
6369
forced_width = width,
6470
color = alsabar.colors.unmute,
6571
background_color = alsabar.colors.background,
66-
margins = 1,
67-
paddings = 1,
72+
margins = margins,
73+
paddings = paddings,
6874
ticks = ticks,
6975
ticks_size = ticks_size,
7076
widget = wibox.widget.progressbar
@@ -73,7 +79,7 @@ local function factory(args)
7379
alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } })
7480

7581
function alsabar.update(callback)
76-
helpers.async(format_cmd, function(mixer)
82+
helpers.async(format_get_cmd, function(mixer)
7783
local vol, playback = string.match(mixer, "([%d]+)%%.*%[([%l]*)")
7884

7985
if not vol or not playback then return end
@@ -146,6 +152,14 @@ local function factory(args)
146152

147153
helpers.newtimer(string.format("alsabar-%s-%s", alsabar.cmd, alsabar.channel), timeout, alsabar.update)
148154

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+
149163
return alsabar
150164
end
151165

wiki

Submodule wiki updated from 0d9b19b to 1acb69e

0 commit comments

Comments
 (0)