From d13d4bb389f321f9fa178d13ca7b03d1080a51be Mon Sep 17 00:00:00 2001 From: Andrei Pavlenko <44530365+hellkitten9@users.noreply.github.com> Date: Mon, 2 Mar 2020 11:12:59 +0200 Subject: [PATCH] Make lock screen work with multiple monitors (#75) * Make lockscreen work with multiple screens * Small refactoring * Fix function declaration Former-commit-id: de707acbb915f74d04e6ee5879f0b04c2d211ef5 Former-commit-id: fdba6451bade511547a7e9bb5c4183053073a098 Former-commit-id: 06a3b4328a5a51fc8bf98b52b21d07bf8b6bbf4f Former-commit-id: 7eadd93fe796535683f90622767e4fe6bd8fd657 --- config/awesome/noodle/lock_screen.lua | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/config/awesome/noodle/lock_screen.lua b/config/awesome/noodle/lock_screen.lua index 1b5ec32..9abe8be 100644 --- a/config/awesome/noodle/lock_screen.lua +++ b/config/awesome/noodle/lock_screen.lua @@ -28,15 +28,40 @@ local lock_animation_icon = wibox.widget { -- It will not be visible anywhere. local some_textbox = wibox.widget.textbox() +-- This function adds blurry mask to a screen +local function screen_mask(s) + local mask = wibox({visible = false, ontop = true, type = "splash", screen = s}) + awful.placement.maximize(mask) + mask.bg = beautiful.lock_screen_bg or "#21252b" + mask.fg = beautiful.lock_screen_fg or "#abb2bf" + return mask +end + -- Create the lock screen wibox -- Set the type to "splash" and set all "splash" windows to be blurred in your -- compositor configuration file -lock_screen = wibox({visible = false, ontop = true, type = "splash"}) +lock_screen = wibox({visible = false, ontop = true, type = "splash", screen = screen.primary}) awful.placement.maximize(lock_screen) lock_screen.bg = beautiful.lock_screen_bg or beautiful.exit_screen_bg or beautiful.wibar_bg or "#111111" lock_screen.fg = beautiful.lock_screen_fg or beautiful.exit_screen_fg or beautiful.wibar_fg or "#FEFEFE" +-- Add lockscreen to each screen +for s in screen do + if s == screen.primary then + s.mylockscreen = lock_screen + else + s.mylockscreen = screen_mask(s) + end +end + +-- Set visibility for lock screen on each monitor +local function set_visibility(v) + for s in screen do + s.mylockscreen.visible = v + end +end + -- Items local day_of_the_week = wibox.widget { -- Fancy font @@ -202,7 +227,7 @@ local function grab_password() if input == password then -- YAY reset() - lock_screen.visible = false + set_visibility(false) else -- NAY fail() @@ -214,7 +239,7 @@ local function grab_password() end function lock_screen_show() - lock_screen.visible = true + set_visibility(true) grab_password() end