Sweets

Configuration

The sweetlock config file

sweetlock reads $XDG_CONFIG_HOME/sweetlock/config.toml (~/.config/sweetlock/config.toml when it is unset), or another file with --config <path>. --no-config skips it. The file is optional. Without it, the defaults apply.

[background]
mode = "image"

[background.image]
path = "~/Pictures/wallpaper.jpg"
dim = 20
blur = 12

[clock]
format = "%H:%M"

[screen_off]
timeout = 60

The example config lists every key at its default.

Check it, and draw the lock screen to a PNG to see how it looks:

sweetlock --check
sweetlock --preview lock.png

A bad config is ignored as a whole. The lock still works with the defaults and shows config ignored: ... under the field.

Examples

Wallpaper

[background]
mode = "image"

[background.image]
path = "~/Pictures/wallpaper.png"
fit = "fill"
blur = 20

Soft blobs

[background]
mode = "layered"

[background.layered]
base = "radial"

[[background.layered.blob]]
color = "#6a5a9e59"
x = 30
y = 35
size = 45

Up to three blobs. Their alpha is their strength. A blob list in your config replaces the default two, and blob = [] removes them.

Blob keyDefaultDescription
color"#ffffff2e"Color. Alpha is the strength
x50Center, 0 to 100 percent of the width
y50Center, 0 to 100 percent of the height
size36Radius, 1 to 100 percent of the output

Clock only

[avatar]
enabled = false

[username]
enabled = false

With both off, the clock and date move down above the field.

UI on one monitor

[ui]
output = "DP-1"

Other outputs show only the background.

[background]

KeyDefaultDescription
mode"solid"solid, gradient, radial, layered, or image
color"#1f1b2e"Solid color, and the first frame in every mode
gradient.top_left"#2b2342"Corner color
gradient.top_right"#1f1b2e"Corner color
gradient.bottom_left"#1f1b2e"Corner color
gradient.bottom_right"#2b2342"Corner color
radial.center"#373057"Center color
radial.edge"#1f1b2e"Edge color
radial.center_x50Center, 0 to 100 percent of the width
radial.center_y50Center, 0 to 100 percent of the height
radial.radius801 to 200, percent of the distance to the farthest corner
layered.base"radial"solid, gradient, or radial
layered.blobtwo blobsUp to three tables with color, x, y, size
image.path""PNG or JPEG. Absolute or ~/
image.fit"fill"fill, fit, center, or stretch
image.dim0Darken, 0 to 100 percent
image.blur0Blur in logical pixels, 0 to 100

Colors are #rrggbb or #rrggbbaa. Backgrounds are opaque, so alpha is ignored except for blobs.

Anything but solid is drawn once per output size and cached in $XDG_CACHE_HOME/sweetlock (~/.cache/sweetlock). A missing or broken image keeps color.

[clock] and [date]

KeyDefaultDescription
clock.enabledtrueShow the clock
clock.format"%H:%M"strftime(3) format. Seconds make it tick every second
date.enabledtrueShow the date
date.format"%A, %B %-d"strftime(3) format. Names follow LC_TIME

On short screens, the clock and date can move closer to the top edge to make room for the centred login stack.

[avatar] and [username]

KeyDefaultDescription
avatar.enabledtrueShow the avatar
avatar.path""PNG or JPEG. Empty tries the AccountsService icon, then ~/.face
username.enabledtrueShow the name
username.text""Empty uses your full name, then your login name

Sweetlock closes the gaps left by disabled rows and centres the remaining login stack. With both the avatar and name disabled, any enabled clock or date moves just above the password field.

[input]

KeyDefaultDescription
placeholder"Password"Text in the empty field
reveal_toggletrueShow the eye that reveals the typed text
layout"status"status shows the keyboard layout under the field, corner in a badge at the top right
hide_after0Seconds without input before the avatar, name, and field hide, up to 3600. 0 never

The layout shows only when your keymap has more than one.

[ui]

KeyDefaultDescription
output""The one output that shows the clock and login. Empty means every output

[screen_off]

KeyDefaultDescription
timeout0Seconds without input before every output powers off, up to 3600. 0 never

A key or click turns them back on and is not typed. Unlocking turns them on too. If another tool turns them on, the timeout starts over.

Keep sweetidle's after_resume_command or on_resume with sweets msg output-power '*' on. It wakes the screens if the locker dies while they're off.

[theme]

KeyDefaultDescription
font"Noto Sans"Fontconfig family, or a comma-separated list. Without Noto Sans installed, your default sans-serif is used
clock_font""Font for the clock and date. Empty uses font
clock_weight700Clock weight, 100 to 1000. The date is 100 lighter
foreground"#e8e6f0"Username, avatar outline, field text, Caps Lock is on, layout badge text
muted"#a9a4bd"Clock, date, eye, Checking…, PAM messages, layout name
field"#ffffff1a"Password field, avatar circle, layout badge
error"#e06c75"Wrong password, PAM errors, config ignored: ...

Flags

Every key except blobs can be set from the command line. Flags win over the file.

sweetlock --set background.mode=radial --set clock.format=%H:%M:%S
sweetlock --image ~/Pictures/wallpaper.jpg --blur 20 --no-avatar
FlagSame as
--color <hex>--set background.color=<hex>
--image <path>background.mode=image and background.image.path=<path>
--fit <mode>--set background.image.fit=<mode>
--dim <n>--set background.image.dim=<n>
--blur <n>--set background.image.blur=<n>
--no-clock--set clock.enabled=false
--no-date--set date.enabled=false
--no-avatar--set avatar.enabled=false
--no-username--set username.enabled=false

On this page