all repos — dotfiles-extra @ e7b4874516df8a3f5886c29fff1d1ae88e86607a

extra configs that may be extraneous and/or may be platform specific

.config/i3/set-screenlocking-for-sleep.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
#!/usr/bin/env bash

sleep_lock_service_file="/etc/systemd/system/screenlocker.service"

screenlocker_file_contents="[Unit]
Description=Starts i3lock on suspend
Before=sleep.target

[Service]
User=$USER
Type=forking
Environment=DISPLAY=:0
ExecStart=/home/$USER/.config/i3/screenlocker.sh

[Install]
WantedBy=sleep.target"


if [ "$1" = "set" ]; then
    touch "$sleep_lock_service_file"
    echo "$screenlocker_file_contents" > "$sleep_lock_service_file"
    systemctl enable screenlocker.service
    printf "Screenlocking upon closed lid enabled.\n"
elif [ "$1" = "unset" ]; then
    systemctl disable screenlocker.service
    rm "$sleep_lock_service_file"
    printf "Screenlocking upon closed lid disabled.\n"

else
    printf "Invalid arguments. Use 'set' or 'unset'.\n"
fi