From 3d1e5438ada61e406de6dccc0b44e7491bf6561d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 26 Oct 2021 19:22:38 +0200 Subject: bindings: capture errors from locking the screen --- utils.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'utils.lua') 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 -- cgit v1.2.3