dotfiles/home/private_bin/executable_lock

90 lines
1.6 KiB
Text
Raw Normal View History

#!/usr/bin/env bash
2022-07-06 11:55:14 -05:00
if ! [[ -f /usr/bin/i3lock ]]; then
notify-send "no i3lock...install i3lock-color"
exit
fi
2022-09-29 09:47:40 -05:00
# colors
2022-09-29 09:47:40 -05:00
bg_color=1e1e2ebb
red=f38ba8ff
teal=94e2d5ff
rosewater=f5e0dcff
green=a6e3a1ff
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
2022-07-06 11:55:14 -05:00
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))
2022-09-29 09:47:40 -05:00
# centered
greeter_pos="x+w/2-${greeter_w}/4:y+h/2-${greeter_h}/4"
2022-09-29 09:47:40 -05:00
# left-aligned
greeter_pos="x+50:y+h/2-${greeter_h}/4"
2022-03-17 08:52:43 -05:00
# do the locking
2022-03-17 08:52:43 -05:00
# suspend message display
pkill -u "$USER" -USR1 dunst
sleep 0.1
2022-03-17 08:52:43 -05:00
# lock the screen
i3lock \
2022-07-06 11:55:14 -05:00
-n \
--screen 1 \
--color $bg_color \
2022-07-06 11:55:14 -05:00
--inside-color ffffff00 \
--ring-color $green \
--ringwrong-color $red \
2022-09-29 09:47:40 -05:00
--ringver-color $teal \
--insidewrong-color $bg_color \
--insidever-color $bg_color \
2022-07-06 11:55:14 -05:00
--line-uses-ring \
--separator-color $selection \
2022-09-29 09:47:40 -05:00
--keyhl-color $teal \
--bshl-color $red \
--wrong-color $red \
2022-07-06 11:55:14 -05:00
--ind-pos x+w-5-r:y+h-10-r \
--ring-width 25 \
--radius 100 \
--verif-text "" \
2022-07-06 11:55:14 -05:00
--greeter-text "$(make_figlet)" \
--greeter-font "${font}" \
--greeter-size $font_size \
2022-09-29 09:47:40 -05:00
--greeter-color $rosewater \
2022-07-06 11:55:14 -05:00
--greeter-pos "${greeter_pos}" \
--greeter-align 1
2022-03-17 08:52:43 -05:00
# resume message display
pkill -u "$USER" -USR2 dunst