Add option for time-format (with default-config) from #185 (#205)

* Add an option to change the time format
* Add option to example-config

Co-authored-by: Addison Bean <addisonbean@gmail.com>
This commit is contained in:
Sebastian Sellmeier 2021-05-15 11:36:48 +02:00 committed by GitHub
parent bacc7cea57
commit 3be77f6854
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -29,6 +29,7 @@ init_filenames() {
font="sans-serif" font="sans-serif"
locktext='Type password to unlock...' locktext='Type password to unlock...'
wallpaper_cmd='feh --bg-fill --no-fehbg' wallpaper_cmd='feh --bg-fill --no-fehbg'
time_format='%H:%M:%S'
# override defaults with config # override defaults with config
theme_rc="$HOME/.config/betterlockscreenrc" theme_rc="$HOME/.config/betterlockscreenrc"
@ -90,7 +91,7 @@ lock() {
-t -i "$1" \ -t -i "$1" \
--timepos='x+110:h-70' \ --timepos='x+110:h-70' \
--datepos='x+43:h-45' \ --datepos='x+43:h-45' \
--clock --date-align 1 --datestr "$locktext" \ --clock --date-align 1 --datestr "$locktext" --timestr "$time_format" \
--insidecolor=$insidecolor --ringcolor=$ringcolor --line-uses-inside \ --insidecolor=$insidecolor --ringcolor=$ringcolor --line-uses-inside \
--keyhlcolor=$keyhlcolor --bshlcolor=$bshlcolor --separatorcolor=$separatorcolor \ --keyhlcolor=$keyhlcolor --bshlcolor=$bshlcolor --separatorcolor=$separatorcolor \
--insidevercolor=$insidevercolor --insidewrongcolor=$insidewrongcolor \ --insidevercolor=$insidevercolor --insidewrongcolor=$insidewrongcolor \
@ -408,6 +409,12 @@ usage() {
echo ' to set your custom wallpaper setter' echo ' to set your custom wallpaper setter'
echo ' the default is "feh --bg-fill --no-fehbg"' echo ' the default is "feh --bg-fill --no-fehbg"'
echo ' E.g: betterlockscreen -wc "xwallpaper --zoom" -w' echo ' E.g: betterlockscreen -wc "xwallpaper --zoom" -w'
echo
echo
echo ' -tf --time_format <format>'
echo ' to set the time format used by i3lock-color'
echo ' see the i3lock or strftime man pages for more details.'
echo ' E.g: betterlockscreen -l dim -tf "%I:%M %p"'
} }
@ -474,6 +481,11 @@ for arg in "$@"; do
shift 2 shift 2
;; ;;
-tf | --time_format)
time_format="$2"
shift 2
;;
--) --)
lockargs="$lockargs ${*:2}" lockargs="$lockargs ${*:2}"
break break

View file

@ -16,3 +16,4 @@ loginbox=00000066
font="sans-serif" font="sans-serif"
locktext='Type password to unlock...' locktext='Type password to unlock...'
lock_timeout=5 lock_timeout=5
time_format='%H:%M:%S'