52 lines
3.0 KiB
Diff
52 lines
3.0 KiB
Diff
diff --git a/widget/pulse.lua b/widget/pulse.lua
|
|
index 69f4d70..d485d97 100644
|
|
--- a/widget/pulse.lua
|
|
+++ b/widget/pulse.lua
|
|
@@ -22,14 +22,17 @@ local function factory(args)
|
|
local settings = args.settings or function() end
|
|
|
|
pulse.devicetype = args.devicetype or "sink"
|
|
- pulse.cmd = args.cmd or "pacmd list-" .. pulse.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
|
|
+ pulse.cmd = args.cmd or "pacmd list-" .. pulse.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p' -e '/device\\.description/p'"
|
|
|
|
function pulse.update()
|
|
helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() },
|
|
function(s)
|
|
+ local description = string.match(s, "device.description = \"(.-)\"")
|
|
+ local devicestring = string.match(s, "device.string = \"(%S+)\"")
|
|
+ local device = string.len(description) < string.len(devicestring) and description or devicestring
|
|
volume_now = {
|
|
index = string.match(s, "index: (%S+)") or "N/A",
|
|
- device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
|
|
+ device = device or "N/A",
|
|
muted = string.match(s, "muted: (%S+)") or "N/A"
|
|
}
|
|
|
|
diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua
|
|
index 19e73b9..b1dbc1c 100644
|
|
--- a/widget/pulsebar.lua
|
|
+++ b/widget/pulsebar.lua
|
|
@@ -51,7 +51,7 @@ local function factory(args)
|
|
pulsebar.followtag = args.followtag or false
|
|
pulsebar.notification_preset = args.notification_preset
|
|
pulsebar.devicetype = args.devicetype or "sink"
|
|
- pulsebar.cmd = args.cmd or "pacmd list-" .. pulsebar.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
|
|
+ pulsebar.cmd = args.cmd or "pacmd list-" .. pulsebar.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p' -e '/device\\.description/p'"
|
|
|
|
if not pulsebar.notification_preset then
|
|
pulsebar.notification_preset = {
|
|
@@ -76,9 +76,12 @@ local function factory(args)
|
|
function pulsebar.update(callback)
|
|
helpers.async({ awful.util.shell, "-c", type(pulsebar.cmd) == "string" and pulsebar.cmd or pulsebar.cmd() },
|
|
function(s)
|
|
+ local description = string.match(s, "device.description = \"(.-)\"")
|
|
+ local devicestring = string.match(s, "device.string = \"(%S+)\"")
|
|
+ local device = string.len(description) < string.len(devicestring) and description or devicestring
|
|
volume_now = {
|
|
index = string.match(s, "index: (%S+)") or "N/A",
|
|
- device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
|
|
+ device = device or "N/A",
|
|
muted = string.match(s, "muted: (%S+)") or "N/A"
|
|
}
|
|
|