yakunins / mac-lock-screen-background

Simple script that generates pixelized image, sets it as desktop wallpaper, locks Mac, sets walpaper back on unlock.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Put repo's content into $HOME folder
  2. Open terminal
  3. 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
  1. perform test run:
cd ~/.config/
lock.sh
  1. it should lock your Mac with pixelized screenshot,
    and on unlock set back ~/Pictures/Wallpapers/default-wallpaper.png
  2. attach script to the key scroll_lock with karabiner,
    e.g. modify rules 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

  1. replace ~/Pictures/Wallpapers/default-wallpaper.png with your own wallpaper image
  2. setup other than scroll_lock key in karabiner to lock your Mac
  3. set your own lock screen picture, by commentin out a two lines inside generate-lockscreen-image.sh which generates pixelated screenshot

Troubleshooting

  1. set permissions for all the scripts
  2. set permissions for karabiner

Cheers!

About

Simple script that generates pixelized image, sets it as desktop wallpaper, locks Mac, sets walpaper back on unlock.

License:MIT License


Languages

Language:Shell 59.8%Language:AppleScript 40.2%