Added volume step

master
Mark 2022-11-05 09:54:25 -07:00
parent bb27fcfaa0
commit e5b253411f
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
5 changed files with 21 additions and 15 deletions

View File

@ -137,9 +137,13 @@ config.mpc = {
config.volume = {
enabled = true,
-- How much % to change volume by
scroll_step = 2,
button_step = 5,
-- The pulse sink volume widgets and keybinds should use.
-- To use the default, keep this value an empty string.
-- Applies the --sink option to pamixer in wrapper.volume
-- Applies the --sink option to pamixer
pamixer_sink = ""
}

View File

@ -3,7 +3,7 @@ local volume = req_rel(..., "util")
return gears.table.join(
awful.key( {}, "XF86AudioRaiseVolume",
function ()
volume.volume_up()
volume.volume_up(config.volume.button_step)
awesome.emit_signal("module::volume_popup:show")
end,
{
@ -14,7 +14,7 @@ return gears.table.join(
awful.key( {}, "XF86AudioLowerVolume",
function ()
volume.volume_down()
volume.volume_down(config.volume.button_step)
awesome.emit_signal("module::volume_popup:show")
end,
{

View File

@ -213,11 +213,11 @@ return function(s)
-- Scroll up
elseif (button == 4) then
volume.volume_up()
volume.volume_up(config.volume.scroll_step)
-- Scroll down
elseif (button == 5) then
volume.volume_down()
volume.volume_down(config.volume.scroll_step)
end
end
)

View File

@ -9,9 +9,10 @@ if (config.volume.pamixer_sink ~= "") then
end
volume.commands = {
up = function(callback)
up = function(value, callback)
awful.spawn.easy_async(
"pamixer --increase 5 " .. volume.pamixer_options,
"pamixer --increase " .. value .. " "
.. volume.pamixer_options,
function(stdout, stderr, exitreason, exitcode)
awesome.emit_signal("module::volume:update_read")
if (callback ~= nil) then
@ -21,9 +22,10 @@ volume.commands = {
)
end,
down = function(callback)
down = function(value, callback)
awful.spawn.easy_async(
"pamixer --decrease 5 " .. volume.pamixer_options,
"pamixer --decrease " .. value .. " "
.. volume.pamixer_options,
function(stdout, stderr, exitreason, exitcode)
awesome.emit_signal("module::volume:update_read")
if (callback ~= nil) then
@ -116,22 +118,22 @@ awesome.connect_signal("module::volume:update_read",
end
)
volume.volume_up = function()
volume.volume_up = function(value)
if volume.muted then
volume.unmute()
end
volume.commands.up(function()
volume.commands.up(value, function()
core.sound.play("volume_up")
end)
end
volume.volume_down = function()
volume.volume_down = function(value)
if volume.muted then
volume.unmute()
end
volume.commands.down(function()
volume.commands.down(value, function()
core.sound.play("volume_down")
end)
end

View File

@ -87,11 +87,11 @@ widget.widget:connect_signal("button::press",
-- Scroll up
elseif (button == 4) then
volume.volume_up()
volume.volume_up(config.volume.scroll_step)
-- Scroll down
elseif (button == 5) then
volume.volume_down()
volume.volume_down(config.volume.scroll_step)
end
awesome.emit_signal("module::volume_popup:update")
end