summaryrefslogtreecommitdiff
path: root/utils.lua
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-10-26 19:22:38 +0200
committerAnton Khirnov <anton@khirnov.net>2021-10-26 19:22:38 +0200
commit3d1e5438ada61e406de6dccc0b44e7491bf6561d (patch)
treecddf9aa415c3bad5a71f7a17346b17936b8f5136 /utils.lua
parent8867d417fce527dce7155fb18b26e2ab9a269c6c (diff)
bindings: capture errors from locking the screen
Diffstat (limited to 'utils.lua')
-rw-r--r--utils.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils.lua b/utils.lua
index 01bd70f..3a02c24 100644
--- a/utils.lua
+++ b/utils.lua
@@ -1,6 +1,7 @@
local M = {}
local awful = require("awful")
+local naughty = require("naughty")
-- mapping from logical screen indices to indices corresponding to their
-- physical layout
@@ -43,4 +44,17 @@ function M.spawn_current(command)
awful.spawn(command, {tag = mouse.screen.selected_tag})
end
+function M.screen_lock()
+ awful.spawn.easy_async("xscreensaver-command -lock",
+ function(stdout, stderr, exitreason, exitcode)
+ if exitcode ~= 0 then
+ naughty.notify({ preset = naughty.config.presets.critical,
+ title = "Error locking the screen",
+ text = table.concat({stdout, stderr}, "\n") })
+
+ end
+ end)
+
+end
+
return M