summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2015-05-16 13:57:19 +0200
committerNicolas Schodet2015-05-16 13:57:19 +0200
commit41b0043a3f320f76cb9bd129ed3158ef785d743b (patch)
tree71916b662edc11551f8e3e68766027b5c8cf8de9
parentcf23577d79be00b87bc90a3f5fe91d484305f854 (diff)
widgets/volume: use default card
-rw-r--r--widgets/volume.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/volume.lua b/widgets/volume.lua
index 80d170f..a9a6437 100644
--- a/widgets/volume.lua
+++ b/widgets/volume.lua
@@ -10,12 +10,16 @@ local beautiful = require ("beautiful")
module("widgets.volume")
-local cardid = 0
+local cardid = nil
local channel = "Master"
-- command must start with a space!
local function mixercommand(w, command)
- local fd = io.popen("amixer -c " .. cardid .. command)
+ cmd = "amixer"
+ if cardid then
+ cmd = cmd .. " -c " .. cardid
+ end
+ local fd = io.popen(cmd .. command)
local status = fd:read("*all")
fd:close()
local volume = string.match(status, "(%d?%d?%d)%%")