mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 02:38:33 +02:00
lock: use xss-lock instead of xautolock
xss-lock features nice integration with standard X screensaver feature which makes it easy to trigger it or to disable it. Moreover, it also has some logind integration to lock screen before suspend.
This commit is contained in:
parent
2c19d0021f
commit
097e076694
7 changed files with 48 additions and 37 deletions
|
@ -30,9 +30,11 @@ Here some of the things you may be interested in:
|
||||||
the wallpaper per screen and therefore, the script may seem a bit
|
the wallpaper per screen and therefore, the script may seem a bit
|
||||||
useless but I keep it.
|
useless but I keep it.
|
||||||
|
|
||||||
- I am using `xautolock` + `i3lock` as a screensaver. Nothing fancy
|
- I am using `xss-lock` with `i3lock` as a screensaver. It relies on
|
||||||
but I reuse the wallpaper built above. A notification is sent 10
|
standard X screensaver handling (and therefore is easy for
|
||||||
seconds before starting.
|
application to disable) and also supports systemd
|
||||||
|
inhibitors. Nothing fancy but I reuse the wallpaper built above. A
|
||||||
|
notification is sent 10 seconds before starting.
|
||||||
|
|
||||||
- In `rc/apparance.lua`, you may be interested by the way I configure
|
- In `rc/apparance.lua`, you may be interested by the way I configure
|
||||||
GTK2 and GTK3 to have an unified look. It works and it does not
|
GTK2 and GTK3 to have an unified look. It works and it does not
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
exec i3lock -e -n -i $HOME/.cache/awesome/current-wallpaper.png
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
icon="$1"
|
|
||||||
|
|
||||||
exec notify-send "Lock screen" \
|
|
||||||
${icon:+-i $icon} \
|
|
||||||
-t 10000 \
|
|
||||||
"Lock screen will be started in 10 seconds..."
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
icon="$1"
|
|
||||||
notify=$(dirname $(readlink -f "$0"))/notify-lock
|
|
||||||
locker=$(dirname $(readlink -f "$0"))/locker
|
|
||||||
|
|
||||||
exec xautolock \
|
|
||||||
-time 4 \
|
|
||||||
-locker "$locker" \
|
|
||||||
-notify 10 \
|
|
||||||
-notifier "$notify $icon"
|
|
37
bin/xss-lock
Executable file
37
bin/xss-lock
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
me="$(readlink -f "$0")"
|
||||||
|
timeout=240
|
||||||
|
notify=5
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
xset s $timeout $notify
|
||||||
|
xset dpms $(($timeout * 2 + $notify)) $(($timeout * 3 + $notify)) $(($timeout * 4 + $notify))
|
||||||
|
exec xss-lock -n "$me dim" -l $me lock
|
||||||
|
;;
|
||||||
|
dim)
|
||||||
|
trap 'exit 0' TERM INT
|
||||||
|
trap "xbacklight -steps 1 -set $(xbacklight -get); kill %%" EXIT
|
||||||
|
min_brightness=0
|
||||||
|
fade_time=$(($notify * 1000))
|
||||||
|
fade_steps=20
|
||||||
|
fade_step_time=0.05
|
||||||
|
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness
|
||||||
|
sleep 2147483647 &
|
||||||
|
wait
|
||||||
|
;;
|
||||||
|
lock)
|
||||||
|
i3lock_options="-e -i $HOME/.cache/awesome/current-wallpaper.png"
|
||||||
|
if [ -e /proc/self/fd/${XSS_SLEEP_LOCK_FD:--1} ]; then
|
||||||
|
trap 'kill %%' TERM INT
|
||||||
|
i3lock -n $i3lock_options {XSS_SLEEP_LOCK_FD}<&- &
|
||||||
|
exec {XSS_SLEEP_LOCK_FD}<&-
|
||||||
|
wait
|
||||||
|
else
|
||||||
|
trap 'kill %%' TERM INT
|
||||||
|
i3lock -n $i3lock_options &
|
||||||
|
wait
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
15
rc/xlock.lua
15
rc/xlock.lua
|
@ -1,15 +1,7 @@
|
||||||
-- Lockscreen
|
-- Lockscreen
|
||||||
|
|
||||||
local icons = loadrc("icons", "vbe/icons")
|
|
||||||
|
|
||||||
xrun("xautolock",
|
|
||||||
awful.util.getdir("config") ..
|
|
||||||
"/bin/xautolock " ..
|
|
||||||
icons.lookup({name = "system-lock-screen", type = "actions" }))
|
|
||||||
|
|
||||||
local lock = function()
|
local lock = function()
|
||||||
awful.util.spawn(awful.util.getdir("config") ..
|
os.execute("xset s activate")
|
||||||
"/bin/locker", false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.keys.global = awful.util.table.join(
|
config.keys.global = awful.util.table.join(
|
||||||
|
@ -17,5 +9,6 @@ config.keys.global = awful.util.table.join(
|
||||||
awful.key({}, "XF86ScreenSaver", lock),
|
awful.key({}, "XF86ScreenSaver", lock),
|
||||||
awful.key({ modkey, }, "Delete", lock))
|
awful.key({ modkey, }, "Delete", lock))
|
||||||
|
|
||||||
-- Configure DPMS
|
-- Configure xss-lock
|
||||||
os.execute("xset dpms 360 720 1200")
|
os.execute(awful.util.spawn(awful.util.getdir("config") ..
|
||||||
|
"/bin/xss-lock start"))
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
awesome
|
awesome
|
||||||
awesome-extra
|
awesome-extra
|
||||||
i3lock
|
i3lock
|
||||||
xautolock
|
xss-lock
|
||||||
|
xbacklight
|
||||||
libnotify-bin
|
libnotify-bin
|
||||||
xfonts-terminus
|
xfonts-terminus
|
||||||
ttf-dejavu
|
ttf-dejavu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue