summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keybindings.lua9
-rw-r--r--lib/pavolctld.lua9
-rw-r--r--widgets/pavolctld.lua4
3 files changed, 19 insertions, 3 deletions
diff --git a/keybindings.lua b/keybindings.lua
index e731788..b6bd76d 100644
--- a/keybindings.lua
+++ b/keybindings.lua
@@ -85,12 +85,15 @@ globalkeys = gears.table.join(
key(w , "F7", function () awful.spawn("bl set 50") end, { group = "monitor" , description = "set monitor brightness to 50%" }),
key(w , "F8", function () awful.spawn("bl set 100") end, { group = "monitor" , description = "set monitor brightness to 100%" }),
key({}, "XF86MonBrightnessUp", function () awful.spawn("bl inc 10") end, { group = "monitor" , description = "increase monitor brightness by 10%" }),
- key({}, "XF86MonBrightnessDown", function () awful.spawn("bl dec 10") end, { group = "monitor" , description = "decrease monitor brightness by 10%" }),
- -- Volume Controls
+ key({}, "XF86MonBrightnessDown", function () awful.spawn("bl dec 10") end, { group = "monitor" , description = "decrease monitor brightness by 10%" })
+)
+
+-- Volume Controls
+if pavolctld then globalkeys = gears.table.join(globalkeys,
key({}, "XF86AudioRaiseVolume", function () pavolctld.volume_inc(5) end, { group = "volume" , description = "increase volume by 5%" }),
key({}, "XF86AudioLowerVolume", function () pavolctld.volume_dec(5) end, { group = "volume" , description = "decrease volume by 5%" }),
key({}, "XF86AudioMute", pavolctld.mute_toggle , { group = "volume" , description = "toggle audio mute" })
-)
+) end
-- Client protection
diff --git a/lib/pavolctld.lua b/lib/pavolctld.lua
index b6b6237..e14d964 100644
--- a/lib/pavolctld.lua
+++ b/lib/pavolctld.lua
@@ -10,6 +10,15 @@ local Gio = lgi.Gio
-- start subprocess
local p = Gio.Subprocess.new({ "pavolctld" }, Gio.SubprocessFlags.STDIN_PIPE + Gio.SubprocessFlags.STDOUT_PIPE)
+if p == nil then
+ -- TODO see if error should be handled another way
+ naughty.notify({
+ preset = naughty.config.presets.critical,
+ title = "pavolctld error",
+ text = "pavolctld could not be loaded",
+ })
+ return false
+end
local stdout = p:get_stdout_pipe()
local stdin = p:get_stdin_pipe()
diff --git a/widgets/pavolctld.lua b/widgets/pavolctld.lua
index 3697465..fb3c5e5 100644
--- a/widgets/pavolctld.lua
+++ b/widgets/pavolctld.lua
@@ -4,6 +4,10 @@ local wibox = require("wibox")
local beautiful = require("beautiful")
local menubar = require("menubar")
local pavolctld = require("lib.pavolctld")
+local naughty = require("naughty")
+
+-- ensure pavolctld loaded
+if not pavolctld then return wibox.widget.textbox("err") end
-- return table
local widget = {}