90 lines
1.5 KiB
Bash
90 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
if ! [[ -f /usr/bin/i3lock ]]; then
|
|
notify-send "no i3lock...install i3lock-color"
|
|
exit
|
|
fi
|
|
# colors
|
|
bg_color=22212c88
|
|
red=ff9580ff
|
|
cyan=80ffeaff
|
|
green=8aff80ff
|
|
orange=ffca80ff
|
|
selection=454158ff
|
|
|
|
# greeter config
|
|
font="MonoLisa Nerd Font:style=Bold"
|
|
greeter_msg="LOCKED"
|
|
|
|
ff=(
|
|
"Sub-Zero"
|
|
"3D-ASCII"
|
|
"big"
|
|
"small"
|
|
"lean"
|
|
"JS Bracket Letters"
|
|
"Epic"
|
|
"Fender"
|
|
"Slant"
|
|
"lineblocks"
|
|
"Marquee"
|
|
"Avatar"
|
|
"Contrast"
|
|
"amcrazor"
|
|
"Kban"
|
|
"Calvin S"
|
|
"Dr Pepper"
|
|
)
|
|
|
|
fig_font=${ff[RANDOM % ${#ff[@]}]}
|
|
|
|
make_figlet() {
|
|
figlet -f "$fig_font" "$greeter_msg"
|
|
}
|
|
|
|
font_size=25
|
|
font_to_px=$(( $font_size * 16 / 12 ))
|
|
greeter_h=$(($(make_figlet | wc -l) * $font_to_px))
|
|
greeter_w=$(($(make_figlet | wc -L ) * $font_to_px))
|
|
|
|
greeter_pos="x+w/2-${greeter_w}/4:y+h/2-${greeter_h}/4"
|
|
|
|
# do the locking
|
|
|
|
# suspend message display
|
|
pkill -u "$USER" -USR1 dunst
|
|
sleep 0.1
|
|
|
|
# lock the screen
|
|
i3lock \
|
|
-n \
|
|
--screen 1 \
|
|
\
|
|
--color $bg_color \
|
|
--inside-color ffffff00 \
|
|
--ring-color $green \
|
|
--ringwrong-color $red \
|
|
--ringver-color $cyan \
|
|
--insidewrong-color $bg_color \
|
|
--insidever-color $bg_color \
|
|
--line-uses-ring \
|
|
--separator-color $selection \
|
|
--keyhl-color $cyan \
|
|
--bshl-color $red \
|
|
--wrong-color $red \
|
|
\
|
|
--ind-pos x+w-5-r:y+h-10-r \
|
|
--ring-width 25 \
|
|
--radius 100 \
|
|
--verif-text "" \
|
|
\
|
|
--greeter-text "$(make_figlet)" \
|
|
--greeter-font "${font}" \
|
|
--greeter-size $font_size \
|
|
--greeter-color $cyan \
|
|
--greeter-pos "${greeter_pos}" \
|
|
--greeter-align 1 \
|
|
|
|
# resume message display
|
|
pkill -u "$USER" -USR2 dunst
|
|
|