mirror of
https://git.adityakumar.xyz/betterlockscreen-openrc.git
synced 2024-11-14 20:29:44 +00:00
Add ability to set custom lockscreen text, tabs (#65)
This commit is contained in:
parent
33b7763283
commit
031140d5c4
1 changed files with 26 additions and 8 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
# find your resolution so images can be resized to match your screen resolution
|
# find your resolution so images can be resized to match your screen resolution
|
||||||
res=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
|
res=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
|
||||||
|
locktext="Type password to unlock..."
|
||||||
|
|
||||||
init_filenames() {
|
init_filenames() {
|
||||||
#$1 resolution
|
#$1 resolution
|
||||||
|
@ -44,9 +45,9 @@ init_filenames() {
|
||||||
init_filenames $res
|
init_filenames $res
|
||||||
|
|
||||||
prelock() {
|
prelock() {
|
||||||
if [ ! -z "$(pidof dunst)" ] ; then
|
if [ ! -z "$(pidof dunst)" ] ; then
|
||||||
pkill -u "$USER" -USR1 dunst
|
pkill -u "$USER" -USR1 dunst
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
lock() {
|
lock() {
|
||||||
|
@ -60,8 +61,8 @@ lock() {
|
||||||
i3lock \
|
i3lock \
|
||||||
-t -i "$1" \
|
-t -i "$1" \
|
||||||
--timepos="x+110:h-70" \
|
--timepos="x+110:h-70" \
|
||||||
--datepos="x+135:h-45" \
|
--datepos="x+43:h-45" \
|
||||||
--clock --datestr "Type password to unlock..." \
|
--clock --date-align 1 --datestr "$locktext" \
|
||||||
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
|
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
|
||||||
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
|
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
|
||||||
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
|
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
|
||||||
|
@ -72,9 +73,9 @@ lock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
postlock() {
|
postlock() {
|
||||||
if [ ! -z "$(pidof dunst)" ] ; then
|
if [ ! -z "$(pidof dunst)" ] ; then
|
||||||
pkill -u "$USER" -USR2 dunst
|
pkill -u "$USER" -USR2 dunst
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
rec_get_random() {
|
rec_get_random() {
|
||||||
|
@ -179,8 +180,25 @@ usage() {
|
||||||
echo " used to set blur intensity. Default to 1."
|
echo " used to set blur intensity. Default to 1."
|
||||||
echo " E.g: betterlockscreen -u path/to/image.png -b 3"
|
echo " E.g: betterlockscreen -u path/to/image.png -b 3"
|
||||||
echo " E.g: betterlockscreen -u path/to/image.png --blur 0.5"
|
echo " E.g: betterlockscreen -u path/to/image.png --blur 0.5"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo " -t --text"
|
||||||
|
echo " to set custom lockscreen text (max 31 chars)"
|
||||||
|
echo " E.g: betterlockscreen -l dim -t \"Don't touch my machine!\""
|
||||||
|
echo " E.g: betterlockscreen --text \"Hi, user!\" -s blur"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if --text argument is given
|
||||||
|
if [ $# -gt 2 ] ; then
|
||||||
|
if [ "$1" == "-t" -o "$1" == "--text" ] ; then
|
||||||
|
locktext="$2"
|
||||||
|
# delete first 2 arguments and reset numbering ( 3 -> 1, 4 -> 2, ...)
|
||||||
|
set -- "${@:3}"
|
||||||
|
elif [ \( "$3" == "-t" -o "$3" == "--text" \) -a $# -gt 3 ] ; then
|
||||||
|
locktext="$4"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"")
|
"")
|
||||||
|
|
Loading…
Reference in a new issue