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")
|
module("vbe/volume")
|
||||||
|
|
||||||
local volid = nil
|
local volid = nil
|
||||||
local function change(what)
|
local function change(what, how)
|
||||||
os.execute("amixer -q -D pulse sset Master " .. what, false)
|
os.execute("amixer -q -D pulse sset " .. what .. " " .. how, false)
|
||||||
-- Read the current value
|
-- 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]*)")
|
local vol, mute = out:match("([%d]+)%%.*%[([%l]*)")
|
||||||
if not mute or not vol then return end
|
if not mute or not vol then return end
|
||||||
|
|
||||||
|
@ -29,7 +29,11 @@ local function change(what)
|
||||||
elseif vol < 60 then
|
elseif vol < 60 then
|
||||||
icon = "medium"
|
icon = "medium"
|
||||||
end
|
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"})
|
type = "status"})
|
||||||
|
|
||||||
volid = naughty.notify({ text = string.format("%3d %%", vol),
|
volid = naughty.notify({ text = string.format("%3d %%", vol),
|
||||||
|
@ -38,20 +42,16 @@ local function change(what)
|
||||||
replaces_id = volid }).id
|
replaces_id = volid }).id
|
||||||
end
|
end
|
||||||
|
|
||||||
function increase()
|
function increase(what)
|
||||||
change("5%+")
|
change(what, "5%+")
|
||||||
end
|
end
|
||||||
|
|
||||||
function decrease()
|
function decrease(what)
|
||||||
change("5%-")
|
change(what, "5%-")
|
||||||
end
|
end
|
||||||
|
|
||||||
function toggle()
|
function toggle(what)
|
||||||
change("toggle")
|
change(what, "toggle")
|
||||||
end
|
|
||||||
|
|
||||||
function mictoggle()
|
|
||||||
os.execute("amixer -q -D pulse sset Capture toggle", false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- run pavucontrol
|
-- run pavucontrol
|
||||||
|
|
|
@ -250,10 +250,10 @@ config.keys.global = awful.util.table.join(
|
||||||
-- Multimedia keys
|
-- Multimedia keys
|
||||||
awful.key({ }, "XF86MonBrightnessUp", brightness.increase),
|
awful.key({ }, "XF86MonBrightnessUp", brightness.increase),
|
||||||
awful.key({ }, "XF86MonBrightnessDown", brightness.decrease),
|
awful.key({ }, "XF86MonBrightnessDown", brightness.decrease),
|
||||||
awful.key({ }, "XF86AudioRaiseVolume", volume.increase),
|
awful.key({ }, "XF86AudioRaiseVolume", function() volume.increase("Master") end),
|
||||||
awful.key({ }, "XF86AudioLowerVolume", volume.decrease),
|
awful.key({ }, "XF86AudioLowerVolume", function() volume.decrease("Master") end),
|
||||||
awful.key({ }, "XF86AudioMute", volume.toggle),
|
awful.key({ }, "XF86AudioMute", function() volume.toggle("Master") end),
|
||||||
awful.key({ }, "XF86AudioMicMute", volume.mictoggle),
|
awful.key({ }, "XF86AudioMicMute", function() volume.toggle("Capture") end),
|
||||||
|
|
||||||
awful.key({ }, "XF86AudioPlay", music.playpause),
|
awful.key({ }, "XF86AudioPlay", music.playpause),
|
||||||
awful.key({ }, "XF86AudioPause", music.pause),
|
awful.key({ }, "XF86AudioPause", music.pause),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue