mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 02:38:33 +02:00
volume: don't make the microphone a special case
This commit is contained in:
parent
02e16874c9
commit
7c58bff7d1
2 changed files with 18 additions and 18 deletions
|
@ -13,10 +13,10 @@ local icons = package.loaded["vbe/icons"]
|
|||
module("vbe/volume")
|
||||
|
||||
local volid = nil
|
||||
local function change(what)
|
||||
os.execute("amixer -q -D pulse sset Master " .. what, false)
|
||||
local function change(what, how)
|
||||
os.execute("amixer -q -D pulse sset " .. what .. " " .. how, false)
|
||||
-- Read the current value
|
||||
local out = awful.util.pread("amixer -D pulse sget Master")
|
||||
local out = awful.util.pread("amixer -D pulse sget " .. what)
|
||||
local vol, mute = out:match("([%d]+)%%.*%[([%l]*)")
|
||||
if not mute or not vol then return end
|
||||
|
||||
|
@ -29,7 +29,11 @@ local function change(what)
|
|||
elseif vol < 60 then
|
||||
icon = "medium"
|
||||
end
|
||||
icon = icons.lookup({name = "audio-volume-" .. icon,
|
||||
local prefix = "audio-volume"
|
||||
if what == "Capture" then
|
||||
prefix = "microphone-sensitivity"
|
||||
end
|
||||
icon = icons.lookup({name = prefix .. "-" .. icon,
|
||||
type = "status"})
|
||||
|
||||
volid = naughty.notify({ text = string.format("%3d %%", vol),
|
||||
|
@ -38,20 +42,16 @@ local function change(what)
|
|||
replaces_id = volid }).id
|
||||
end
|
||||
|
||||
function increase()
|
||||
change("5%+")
|
||||
function increase(what)
|
||||
change(what, "5%+")
|
||||
end
|
||||
|
||||
function decrease()
|
||||
change("5%-")
|
||||
function decrease(what)
|
||||
change(what, "5%-")
|
||||
end
|
||||
|
||||
function toggle()
|
||||
change("toggle")
|
||||
end
|
||||
|
||||
function mictoggle()
|
||||
os.execute("amixer -q -D pulse sset Capture toggle", false)
|
||||
function toggle(what)
|
||||
change(what, "toggle")
|
||||
end
|
||||
|
||||
-- run pavucontrol
|
||||
|
|
|
@ -250,10 +250,10 @@ config.keys.global = awful.util.table.join(
|
|||
-- Multimedia keys
|
||||
awful.key({ }, "XF86MonBrightnessUp", brightness.increase),
|
||||
awful.key({ }, "XF86MonBrightnessDown", brightness.decrease),
|
||||
awful.key({ }, "XF86AudioRaiseVolume", volume.increase),
|
||||
awful.key({ }, "XF86AudioLowerVolume", volume.decrease),
|
||||
awful.key({ }, "XF86AudioMute", volume.toggle),
|
||||
awful.key({ }, "XF86AudioMicMute", volume.mictoggle),
|
||||
awful.key({ }, "XF86AudioRaiseVolume", function() volume.increase("Master") end),
|
||||
awful.key({ }, "XF86AudioLowerVolume", function() volume.decrease("Master") end),
|
||||
awful.key({ }, "XF86AudioMute", function() volume.toggle("Master") end),
|
||||
awful.key({ }, "XF86AudioMicMute", function() volume.toggle("Capture") end),
|
||||
|
||||
awful.key({ }, "XF86AudioPlay", music.playpause),
|
||||
awful.key({ }, "XF86AudioPause", music.pause),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue