diff --git a/bin/init.lua b/bin/init.lua index 0c1f7bb..9e4c945 100755 --- a/bin/init.lua +++ b/bin/init.lua @@ -10,6 +10,16 @@ return { elseif (string.lower(confirm_prompt) == "r") or (string.lower(confirm_prompt) == "reset") then awful.spawn("shutdown -r now", false) end + end, + + lock = function() + local n = naughty.notify({ + title = "Locking screen", + text = "...", + timeout = 1 + }) + + awful.spawn(script_dir .. "lock " .. beautiful.icons.lockicon, false) end }, diff --git a/bin/scripts/lock b/bin/scripts/lock new file mode 100755 index 0000000..0701bb5 --- /dev/null +++ b/bin/scripts/lock @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +icon=$1 +tmpbg="/tmp/lockscreen.png" +tmpic="/tmp/lockscreenicon.png" +#(( $# )) && { icon=$1; } + +scrot --overwrite "$tmpbg" +convert "$icon" -scale 25% "$tmpic" +convert "$tmpbg" -scale 10% -scale 1000% "$tmpbg" +convert "$tmpbg" "$tmpic" -gravity center -composite -matte "$tmpbg" + +i3lock -u -i "$tmpbg" diff --git a/binds/system/system.lua b/binds/system/system.lua index 8ad95f1..f5da186 100644 --- a/binds/system/system.lua +++ b/binds/system/system.lua @@ -11,5 +11,28 @@ return gears.table.join( description = "Shutdown", group = "System" } + ), + + awful.key( {"Mod4"}, "a", + function () + bin.system.lock() + end, + + { + description = "Lock screen", + group = "System" + } + ), + + awful.key( {"Mod4", "Control"}, "x", + function () + -- requires sudoers rule + awful.spawn("sudo systemctl restart lightdm") + end, + + { + description = "Restart lightdm", + group = "System" + } ) ) diff --git a/theme/resources/icons.lua b/theme/resources/icons.lua index 8d63497..75dc516 100755 --- a/theme/resources/icons.lua +++ b/theme/resources/icons.lua @@ -9,6 +9,9 @@ return { submenu = conf.icon_dir .. "submenu.svg", launcher = conf.icon_dir .. "arch.svg", + -- must be a png for i3lock + lockicon = conf.icon_dir .. "arch.png", + music = { grey = { play = conf.icon_dir .. "music/play-grey.svg", diff --git a/theme/resources/icons/arch.png b/theme/resources/icons/arch.png new file mode 100644 index 0000000..6328fd3 Binary files /dev/null and b/theme/resources/icons/arch.png differ