Last active
March 20, 2019 09:45
-
-
Save nickrw/063b49e9997bc4d44e0b14fb0a2dda20 to your computer and use it in GitHub Desktop.
i3 screen lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# depends: scrot imagemagick keychain rivalctl | |
# Take a screenshot | |
scrot /tmp/lockshot.png | |
# Apply pixellation effect | |
convert /tmp/lockshot.png -scale 5% -scale 2000% /tmp/lockshot-pixel.png | |
# Set mouse LED colour to red | |
rivalcfg -E 4 -e 4 -c red -C red | |
# Securely delete the unaltered screenshot | |
shred -u /tmp/lockshot.png & | |
( | |
# Lock the screen | |
i3lock -nei /tmp/lockshot-pixel.png | |
# Set mouse LEDs back to normal after i3lock exits | |
rivalcfg -c '#40ffff' -C '#6000ff' -e 1 -E 1 | |
) & | |
# Put screens to sleep after 10 minutes if the lock is still active | |
( | |
sleep 600 | |
pgrep i3lock && xset dpms force off && keychain -k all | |
) & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment