Custom background for macOS lock screen
Simple script that:
- generates pixelized image of current screen,
- puts
lock-screen.png
into~/Pictures/Wallpapers/
, - sets it as desktop wallpaper,
- locks Mac,
- start waiting for unlock, then...
- ...sets back
default-wallpaper.png
as a desktop wallpaper.
Based on Hund's recommendations.
Installation
- Put repo's content into
$HOME
folder - Open terminal
- Install required tools:
# makes pixelized image with `convert` command
brew install imagemagick
# to create shortcut for launching ~/.config/lock.sh
brew install karabiner
# prevents lock screen from turning display off
brew install --cask keepingyouawake
- perform test run:
cd ~/.config/
lock.sh
- it should lock your Mac with pixelized screenshot,
and on unlock set back~/Pictures/Wallpapers/default-wallpaper.png
- attach script to the key
scroll_lock
with karabiner,
e.g. modifyrules
section of~/.config/karabiner/karabiner.json
with:
"manipulators": [
{
"description": "scroll_lock to run ~/.config/lock.sh",
"from": {
"key_code": "scroll_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"shell_command": "/bin/zsh ~/.config/lock.sh"
}
],
"type": "basic"
}
]
Configuration
- replace
~/Pictures/Wallpapers/default-wallpaper.png
with your own wallpaper image - setup other than
scroll_lock
key in karabiner to lock your Mac - set your own lock screen picture, by commentin out a two lines inside
generate-lockscreen-image.sh
which generates pixelated screenshot
Troubleshooting
- set permissions for all the scripts
- set permissions for karabiner
Cheers!