Reworked loginbox (#249)

* Redesigned loginbox, theme errors, add keylayout

    See #225 and #229
    Always display --keylayout
    Wrong, verif, and modif messages are displayed
    Added all pass-thru keys options

* Adjust positioning of verif/wrong-pos according feedback

Co-authored-by: Sebastian Sellmeier <mail@sebastian-sellmeier.de>
This commit is contained in:
Jeff M. Hubbard 2021-06-30 15:43:49 -05:00 committed by Sebastian Sellmeier
parent 17bf536969
commit 7c1f480a4d
No known key found for this signature in database
GPG key ID: 51E2BE0CCC826F98
2 changed files with 136 additions and 39 deletions

View file

@ -30,13 +30,15 @@ init_config () {
insidevercolor=00000000 insidevercolor=00000000
ringwrongcolor=ffffffff ringwrongcolor=ffffffff
insidewrongcolor=d23c3dff insidewrongcolor=d23c3dff
timecolor=ffffffff
time_format="%H:%M:%S"
greetercolor=ffffffff
layoutcolor=ffffffff
keyhlcolor=d23c3dff keyhlcolor=d23c3dff
bshlcolor=d23c3dff bshlcolor=d23c3dff
verifcolor=ffffffff verifcolor=ffffffff
timecolor=ffffffff wrongcolor=d23c3dff
datecolor=ffffffff modifcolor=d23c3dff
layoutcolor=ffffffff
nocolor=00000000
bgcolor=000000ff bgcolor=000000ff
wallpaper_cmd="feh --bg-fill" wallpaper_cmd="feh --bg-fill"
time_format="%H:%M:%S" time_format="%H:%M:%S"
@ -107,23 +109,68 @@ lock() {
echof act "Locking screen..." echof act "Locking screen..."
local image="$1" local image="$1"
local fontlg=32
local fontmd=16
local fontsm=12
$i3lockcolor_bin \ $i3lockcolor_bin \
-i "$image" \ --image "$image" \
-c "$bgcolor" \ --color "$bgcolor" \
--screen "$display_on" \ --screen "$display_on" \
--time-pos="ix-240:iy-0" --time-align 1 --time-str "$time_format" \ --ind-pos="x+310:y+h-80" \
--date-pos="ix-240:iy+25" \ --radius=25 \
--layout-pos="ix-90:iy-0" --layout-align 1 --layout-color="$layoutcolor" "$keylayout" \ --ring-width=5 \
--clock --date-align 1 --date-str "$locktext" \ --inside-color="$insidecolor" \
--inside-color="$insidecolor" --ring-color="$ringcolor" --line-uses-inside \ --ring-color="$ringcolor" \
--keyhl-color="$keyhlcolor" --bshl-color="$bshlcolor" --separator-color=$separatorcolor \ --separator-color=$separatorcolor \
--insidever-color="$insidevercolor" --insidewrong-color="$insidewrongcolor" \ --insidever-color="$insidevercolor" \
--ringver-color="$ringvercolor" --ringwrong-color="$ringwrongcolor" --ind-pos="x+280:y+h-70" \ --insidewrong-color="$insidewrongcolor" \
--radius=20 --ring-width=4 --verif-text="" --wrong-text="" --wrong-color="$nocolor" \ --ringver-color="$ringvercolor" \
--verif-color="$verifcolor" --time-color="$timecolor" --date-color="$datecolor" \ --ringwrong-color="$ringwrongcolor" \
--time-font="$font" --date-font="$font" --layout-font="$font" --verif-font="$font" --wrong-font="$font" \ --line-uses-inside \
--noinput-text="" --force-clock --pass-media-keys --pass-screen-keys --pass-power-keys \ --keyhl-color="$keyhlcolor" \
--bshl-color="$bshlcolor" \
--clock --force-clock \
--time-pos="ix-265:iy-10" \
--time-align 1 \
--time-str "$time_format" \
--time-color="$timecolor" \
--time-font="$font" \
--time-size="$fontlg" \
--date-str "" \
--greeter-pos="ix-265:iy+12" \
--greeter-align 1 \
--greeter-text "$locktext" \
--greeter-color="$greetercolor" \
--greeter-font="$font" \
--greeter-size="$fontmd" \
--layout-pos="ix-265:iy+32" \
--layout-align 1 \
--layout-color="$layoutcolor" \
--layout-font="$font" \
--layout-size="$fontsm" \
--keylayout "${keylayout:-0}" \
--verif-pos="ix+35:iy-34" \
--verif-align 2 \
--verif-text="Verifying..." \
--verif-color="$verifcolor" \
--verif-font="$font" \
--verif-size="$fontsm" \
--wrong-pos="ix+24:iy-34" \
--wrong-align 2 \
--wrong-text="Failure!" \
--wrong-color="$wrongcolor" \
--wrong-font="$font" \
--wrong-size="$fontsm" \
--modif-pos="ix+45:iy+43" \
--modif-align 2 \
--modif-size="$fontsm" \
--modif-color="$modifcolor" \
--noinput-text="" \
--pass-media-keys \
--pass-screen-keys \
--pass-volume-keys \
--pass-power-keys \
"${lockargs[@]}" "${lockargs[@]}"
} }
@ -132,21 +179,66 @@ failsafe() {
echof act "Locking screen... (FAILSAFE MODE)" echof act "Locking screen... (FAILSAFE MODE)"
local bgcolor="000000" local fontlg=32
local text="ffffffff" local fontmd=16
local error="ff0000" local fontsm=12
$i3lockcolor_bin \ $i3lockcolor_bin \
-c "$bgcolor" \ --color "$bgcolor" \
--screen "$display_on" \ --ind-pos="x+310:y+h-80" \
--time-pos="ix-170:iy-0" \ --radius=25 \
--date-pos="ix-240:iy+25" \ --ring-width=5 \
--clock --date-align 1 --date-str "$locktext" \ --inside-color="$insidecolor" \
--ind-pos="x+280:y+h-70" \ --ring-color="$ringcolor" \
--radius=20 --ring-width=4 --verif-text="" --wrong-text="" --wrong-color="$error" \ --separator-color=$separatorcolor \
--verif-color="$text" --time-color="$text" --date-color="$text" \ --insidever-color="$insidevercolor" \
--time-font="$font" --date-font="$font" --layout-font="$font" --verif-font="$font" --wrong-font="$font" \ --insidewrong-color="$insidewrongcolor" \
--noinput-text="" --force-clock --ringver-color="$ringvercolor" \
--ringwrong-color="$ringwrongcolor" \
--line-uses-inside \
--keyhl-color="$keyhlcolor" \
--bshl-color="$bshlcolor" \
--clock --force-clock \
--time-pos="ix-265:iy-10" \
--time-align 1 \
--time-str "$time_format" \
--time-color="$timecolor" \
--time-font="$font" \
--time-size="$fontlg" \
--date-str "" \
--greeter-pos="ix-265:iy+12" \
--greeter-align 1 \
--greeter-text "$locktext" \
--greeter-color="$greetercolor" \
--greeter-font="$font" \
--greeter-size="$fontmd" \
--layout-pos="ix-265:iy+32" \
--layout-align 1 \
--layout-color="$layoutcolor" \
--layout-font="$font" \
--layout-size="$fontsm" \
--keylayout "${keylayout:-0}" \
--verif-pos="ix+45:iy-35" \
--verif-align 2 \
--verif-text="Verifying..." \
--verif-color="$verifcolor" \
--verif-font="$font" \
--verif-size="$fontsm" \
--wrong-pos="ix+45:iy-35" \
--wrong-align 2 \
--wrong-text="Failure!" \
--wrong-color="$wrongcolor" \
--wrong-font="$font" \
--wrong-size="$fontsm" \
--modif-pos="ix+45:iy+43" \
--modif-align 2 \
--modif-size="$fontsm" \
--modif-color="$modifcolor" \
--noinput-text="" \
--pass-media-keys \
--pass-screen-keys \
--pass-volume-keys \
--pass-power-keys
} }
@ -428,8 +520,8 @@ create_loginbox () {
RECTANGLE="$CUR_DIR/rectangle.png" RECTANGLE="$CUR_DIR/rectangle.png"
local shadow="$CUR_DIR/shadow.png" local shadow="$CUR_DIR/shadow.png"
local width height local width height
width=$(logical_px 300 1) width=$(logical_px 340 1)
height=$(logical_px 80 2) height=$(logical_px 100 2)
convert -size "$width"x"$height" xc:\#"$loginbox" -fill none "$RECTANGLE" convert -size "$width"x"$height" xc:\#"$loginbox" -fill none "$RECTANGLE"
convert "$RECTANGLE" \ convert "$RECTANGLE" \
\( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \ \( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \
@ -444,7 +536,7 @@ create_loginbox () {
create_description () { create_description () {
DESCRECT="$CUR_DIR/description.png" DESCRECT="$CUR_DIR/description.png"
local shadow="$CUR_DIR/shadow.png" local shadow="$CUR_DIR/shadow.png"
convert -background none -family "$(fc-match "$font" family)" -style Normal -pointsize 14 -fill \#"$datecolor" label:"\ $description\ " -bordercolor \#"$loginbox" -border 10 "$DESCRECT" convert -background none -family "$(fc-match "$font" family)" -style Normal -pointsize 14 -fill \#"$greetercolor" label:"\ $description\ " -bordercolor \#"$loginbox" -border 10 "$DESCRECT"
convert "$DESCRECT" \ convert "$DESCRECT" \
\( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \ \( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \
-background none -layers merge +repage "$shadow" -background none -layers merge +repage "$shadow"
@ -518,7 +610,7 @@ update () {
pos_y="${sym[1]}${val[1]}" pos_y="${sym[1]}${val[1]}"
rect_x=$((pos_x + $(logical_px 15 1))) rect_x=$((pos_x + $(logical_px 15 1)))
rect_y=$((pos_y + res_y - $(logical_px 120 2))) rect_y=$((pos_y + res_y - $(logical_px 140 2)))
positions+=("+$((rect_x))+$((rect_y))") positions+=("+$((rect_x))+$((rect_y))")
descrect_x=$((pos_x + res_x - descwidth - $(logical_px 15 1))) descrect_x=$((pos_x + res_x - descwidth - $(logical_px 15 1)))
@ -788,8 +880,8 @@ for arg in "$@"; do
;; ;;
--show-layout) --show-layout)
keylayout="--keylayout 2"; keylayout="$2";
shift 1 shift 2
;; ;;
--fx) --fx)

View file

@ -24,8 +24,13 @@ ringvercolor=ffffffff
insidevercolor=00000000 insidevercolor=00000000
ringwrongcolor=ffffffff ringwrongcolor=ffffffff
insidewrongcolor=d23c3dff insidewrongcolor=d23c3dff
timecolor=ffffffff
time_format="%H:%M:%S"
greetercolor=ffffffff
layoutcolor=ffffffff
keyhlcolor=d23c3dff keyhlcolor=d23c3dff
bshlcolor=d23c3dff bshlcolor=d23c3dff
verifcolor=ffffffff verifcolor=ffffffff
timecolor=ffffffff wrongcolor=d23c3dff
datecolor=ffffffff modifcolor=d23c3dff
bgcolor=000000ff