dotfiles/home/private_bin/executable_lock

81 lines
1.4 KiB
Text
Raw Normal View History

#!/usr/bin/env bash
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=(
"big"
"small"
"lean"
2024-01-04 12:23:02 -06:00
"epic"
"fender"
"slant"
"lineblocks"
2024-01-04 12:23:02 -06:00
"marquee"
"avatar"
"contrast"
"amcrazor"
2024-01-04 12:23:02 -06:00
"kban"
)
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