scootbg CLI reference
Every scootbg command, what it waits for, and how it fails. What scootbg
is and why it exists is in Overview; in scoot, a
[wallpaper] section runs it for you
(The [wallpaper] section).
Commands
Section titled “Commands”scootbg daemon # connect to $WAYLAND_DISPLAY and serve the control socketscootbg daemon --profile sway # restore and save the `sway` profile's state insteadscootbg daemon --no-restore # start with nothing shown (the state is kept)scootbg set '#1e1e2e' # every output, including ones plugged in laterscootbg set '#101014' --output DP-2 # one output, by connector name (as `query` lists them)scootbg set ~/Pictures/hills.jpg # an image, covering every output (--mode fill)scootbg set https://example.com/hills.jpg # a link: downloaded once, cached, then shownscootbg set https://example.com/hills.jpg --sha256 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 # ...pinned: anything else fails instead of showingscootbg set ./#draft.png # a file whose name starts with '#'scootbg set city.png --output DP-2 --mode fit --fill '#101014'scootbg set tile.png --mode tile --filter nearestscootbg set ~/wallpapers --every 30m --shuffle # a slideshow: its files in turn, one every 30 minutesscootbg set '#101014' --transition fade --duration-ms 800scootbg set city.png --transition wipe --angle 90scootbg set grid.png --transition grow --position 0,0 --output DP-1scootbg set dune.jpg --transition bloom --duration-ms 1100 --glow '#fd8c60'scootbg set ~/Pictures/focus.jpg --workspace 2 # one workspace, while it is activescootbg clear # back to the compositor's own backgroundscootbg clear --output DP-2 # ... on one outputscootbg clear --workspace 2 # ... one workspace mapping offscootbg query # each output, its surface and what it shows, one JSON linescootbg version # the running daemon's version and protocolscootbg kill # stop it; returns once a new daemon can startscootbg apply-config --profile scoot '{"color":"#1e1e2e"}' # what scoot runs with its [wallpaper] sectionscootbg check-image ~/Pictures/hills.jpg # validate a file without showing it (exit 0/1)scootbg sample-image ~/Pictures/hills.jpg > hills.ppm # its pixels, at most 256 px a side, as a pixel mapscootbg --help # and `scootbg COMMAND --help`scootbg --help --json # the same content as JSON (see below)The binary documents itself for agents: scootbg help COMMAND prints each
command’s page, and scootbg --help --json emits commands, set’s modes
and filters, exit codes and environment — see
Generated CLI pages for the contract.
scootbg version prints the running daemon’s version and protocol as one
JSON line ({"type":"version","protocol":1,"version":"X.).
When a command returns, and its exit status
Section titled “When a command returns, and its exit status”set and clear return once it is on screen: every targeted output
shows the change and the compositor has processed it (a wl_display.
round trip after the commits), so a screenshot taken straight after shows
it. set --workspace returns once the mapping is preloaded — shown at
once where its workspace is already active, recorded otherwise — or with
why its image cannot be shown. With --transition, that means once the animation has finished: the
reply waits for the last frame, not the first. A newer set
mid-transition starts from the frame showing then (no queue), and the
earlier reply arrives once what replaced it is on screen. A workspace
switch itself answers nothing (no request is in flight): it lands through
the mapping’s transition. An output unplugged meanwhile is left out of that wait; one whose
surface is not configured yet is waited for, but only until a round trip
after scootbg made that surface: one the compositor has not configured
by then no longer holds up the reply (the daemon says so on stderr) and
is drawn when it is; one scootbg has given up on
(gave-up in query, said on stderr) is left out and shows nothing, and
set still exits 0. They print nothing on
success. A transition flag without --transition is refused (exit
2), as is a --transition outside none/fade/wipe/grow/bloom/curtain/dawn/dusk, a
--duration-ms past 60000, a non-number --angle, a --position
outside X,Y fractions, a --feather that is not 0–8192 pixels, a
--glow that is not #rrggbb — and a clear with any of them. How a change
animates is Transitions. An image that cannot be shown (no such file, not a regular
file, not a PNG/JPEG/GIF/WebP, too large, truncated or corrupt — or, for a
link, no curl, no network, an HTTP error, an error page, a file past
32 MiB, or a sha256 mismatch: see
a wallpaper from a link) is an error
saying why, and every output keeps what it showed. An animated GIF, APNG
or animated WebP shows its first frame: at most 64 frames and 64 MiB of
frames, past which the set is refused — pass --no-animate for the
first frame as a still instead.
A workspace-mapped animated image shows its first frame the same way
(caps checked when it is set): --no-animate beside --workspace
stills it; a slideshow cannot be mapped per workspace (usage error).
A --no-animate still is live-only: after a restart the caps are checked
again, so an over-cap animation is refused then and the output loses its
wallpaper until the next set. The newest request
wins: a set or clear sent while an earlier image is still decoding is
never undone when that image finishes; the earlier set changes nothing
and returns 0 once the newer one is on screen, as a replaced color’s set
does. Exit status: 0 done; 1 no daemon running,
unknown output, image that cannot be shown, or drawing failed
(scootbg query’s draw_error says why, as the daemon’s stderr does);
2 usage error, a malformed color, an unknown
--mode/--filter, a refused transition, a directory without --every,
an --every without a directory, a --no-animate with --every, or a
slideshow with --workspace
included. A set that has to scale the image
(fill, fit or stretch when the image’s size differs from the output’s,
with any --filter) first probes the scaler’s whole budget — the output,
each scaled axis’s weight tables, and the row scratch when both axes scale
— and fails here when the
daemon has no room for it (an address-space limit, strict overcommit)
instead of ending the daemon; the outputs keep what they showed and the
next set retries. See
Troubleshooting.
Slideshows
Section titled “Slideshows”scootbg set DIR --every DURATION [--shuffle] cycles a directory’s
regular files, one every DURATION, on a single timer, without polling
the directory: it is listed once, when set, so a file added later starts
showing after the next set of the directory. DURATION is a number and
s, m, h or d, such as 30m: at least 1m, whole minutes, at most
7d. The files go sorted by name, or shuffled once with --shuffle;
--mode, --fill, --filter and --transition apply to every file, as
for one image: each step animates like one image’s set. An animated
file shows its first frame, checked per step like one set: at most 64
frames and 64 MiB of frames, past which that step fails (draw_failed
in query until the next one) — diagnose with scootbg set FILE on the
file itself. --no-animate with --every is a usage error (exit 2):
stilling is per image, so still one file at a time. A slideshow cannot be
mapped per workspace either: set DIR --every DURATION --workspace NAME
is a usage error on the CLI (exit 2) and is refused on the wire — map images or
colors per workspace instead. At most 10,000 files are listed: a larger directory is
refused outright (exit 1, naming the cap) rather than stalling the
daemon’s loop to list it. So is a directory with an entry that cannot be
read (exit 1, naming the entry and the operating system’s reason). The first file shows before set returns, as an image
does — unless the first file itself cannot be shown, which still starts
the slideshow (exit 1 saying so, and query reports the new directory):
that file fails its turns like any file that is not an image, until the
next rotation. A file that is not an image fails to draw when its turn comes (as a
set of it would, draw_failed in query saying why) until the next
rotation. One slideshow runs at a time. A new set, a clear, or a
changed apply-config stops it (an unchanged section leaves it running,
like a set made since); restarting the daemon shows the last image
without resuming it. If the directory itself goes away mid-rotation, the
slideshow stops at the next step — said on the daemon’s stderr, and
query no longer reports a rotation — instead of failing once a
minute until stopped; a re-created directory starts with a fresh set.
With no slideshow the timer does not exist: no file
descriptor, no wakeups. With one, the daemon wakes at most once a minute.
Symptom:
setsays the directory needs--every. A bare directory is only ever a slideshow:scootbg set DIRis a usage error (exit 2) naming--every. Diagnose with the pace it suggests, e.g.scootbg set ~/wallpapers --every 30m.Symptom:
setsays the directory holds no files. An empty directory reaches the daemon, which refuses it (exit 1), changing nothing. Diagnose withls -la DIR— hidden files count, subdirectories do not.Symptom: one step shows nothing /
draw_faileduntil the next step. That file is not an image scootbg reads (told apart by content, not name), so its turn fails like asetof it would and the next file follows on schedule. Diagnose withscootbg query(draw_errorsays why, as the daemon’s stderr does) andscootbg set FILEon the file itself.Symptom:
setsays the directory holds more than 10,000 files. That is the listing cap, refused outright (exit 1) rather than showing a silent subset: what shows is exactly the directory, or nothing. Diagnose withls -la DIR | wc -l— split the directory or point the slideshow at a smaller one.Symptom:
setsays it cannot read an entry in the directory. The directory lists, but one entry does not (a dangling symlink, a symlink loop, a permission): the reply (exit 1) names the entry and the operating system’s reason, and nothing changes. Diagnose withfind DIR -xtype l— dangling links — andls -la DIRon the entry it names.Symptom: the slideshow stopped after the directory moved. That is intended, not a crash: the daemon says so on stderr and
querydropsrotation. Diagnose withscootbg query(norotationobject) and re-setthe new path.
apply-config
Section titled “apply-config”scootbg apply-config [--profile NAME] JSON is how a config, rather
than a person, sets the wallpaper: scoot runs it at start-up and on
every reload with its [wallpaper] section as JSON ({} once the section
is gone). The JSON is one object: image (an absolute path, or an
http(s) URL, downloaded once and cached) or color
(#rrggbb), with mode/fill/filter for an image as set takes them
and sha256 (64 hex digits) for a URL image as --sha256 takes it;
output holding a table of the same keys per connector name (each table
stands alone: an output’s image does not take the top level’s mode);
and command (scoot’s, ignored). Anything else (an unknown key, a key
given twice, null, a relative path, a non-http(s) URL, a bad color,
hash, mode or filter, over
256 outputs or 63 KiB) is refused with exit 2, so a typo is never
silently ignored.
- Whichever you changed last wins. The section is applied only if it
changed since the last
apply-configfor that profile (a SHA-256 fingerprint of it,commandleft out, kept in the profile’s state file). So ascootbg setmade afterwards keeps showing across restarts and reloads until the section itself changes. The one order it cannot see: a section removed while scoot is not running and re-added unchanged before the next start counts as unchanged. - It starts the daemon when none runs, detached (a session of its own,
its stderr
apply-config’s: send that to a file or a log, not a pipe read to its end), starting from the section, so the saved state never flashes first. Two started at once make one daemon, settled by its lock. With no daemon and an empty section it starts none, and records the clear in the profile’s state instead. - A running daemon adopts the profile it is sent, whatever
--profileit started with, so an[autostart]scootbg daemonends up on scoot’s profile too.scootbg queryreports the profile in use ("profile", after"saving"). - Another build is reported: a daemon of another version is a
warning (the section is still sent), one of another protocol or too old
for
apply-configan error. - It returns once every output shows it, as
setdoes, and prints nothing on success. Exit status: 0 applied or unchanged, and shown; 1 no daemon could be started or reached (5 s), no reply (30 s, plus the section’s longest transition, whose last frame the reply waits for), the daemon closed the connection before answering (scootbg kill, a crash), another protocol, a daemon too old forapply-config, an image in the section that is not a file (the rest is applied; reported by everyapply-configuntil the file is back, and then shown), drawing failed, or the state file could not be written; 2 a usage error.
The schema, the fingerprint’s exact encoding, the precedence table and the protocol are in README.md.
check-image
Section titled “check-image”scootbg check-image PATH validates one image file without showing
it: what scoot look apply runs over a look’s wallpaper before a swap.
It checks the byte cap (32 MiB) from the file’s size, then the pixel cap
from the header, then decodes the whole file. The byte cap is a check-image gate: a
swap-time apply enforces the pixel cap and the decode. Prints ok: <format> <WxH>, <bytes> bytes and exits 0. A symlink,
a directory, a FIFO, a device, a missing file, an unknown format and a
corrupt or oversize image refuse with exit 1, naming the reason. Opening
cannot hang: the file is opened without blocking and refused unless it is
a regular file.
sample-image
Section titled “sample-image”scootbg sample-image PATH [--max N] prints an image’s pixels at a
bounded size: what scoot look new --from-image reads to build a look
from a wallpaper, and what scootlaunch’s look picker reads for its
miniatures. The file is checked exactly as check-image checks it (byte
cap, pixel cap, full decode), then area-averaged in its displayed
orientation (EXIF applied) to at most 256 pixels on its long edge, or N
with --max N or --max=N (1 to 1024; anything else exits 2).
Transparency is flattened over black. The output on stdout is a binary
pixel map: P6, the width and height, 255, then three bytes a pixel.
An image already that small is written pixel for pixel. Whatever
check-image refuses exits 1, naming the reason. Both commands take
PATH exactly as given, including a file name that is not valid UTF-8.
scootbg sample-image ~/Pictures/hills.jpg > hills.ppmscootbg sample-image ~/Pictures/hills.jpg --max 512 > hills-512.ppmOutputs are tracked as they come and go: each gets one surface on the
background layer (namespace wallpaper), covering the whole output,
reserving no space and taking no input. With no outputs at all the daemon
simply waits. scootbg query answers, on one line (wrapped here):
{"type":"outputs","outputs":[{"name":"DP-1","description":"...", "mode":{"width":3840,"height":2160},"scale":2,"transform":"normal", "logical":{"width":2560,"height":1440}, "surface":{"state":"configured","size":{"width":2560,"height":1440}, "scale":1.5,"pixels":{"width":3840,"height":2160}}, "draw_failed":false,"draw_error":null,"shows":{"color":"#1e1e2e"}, "workspace":"1","transition":null}], "workspaces":[{"output":null,"workspace":"2","shows":{"color":"#101014"}}], "saving":true,"profile":"default"}Every key is always present, null when not known yet. mode is in
device pixels. scale is wl_output’s integer scale (a fractional one
rounded up), and transform is wl_output’s, counter-clockwise.
logical is the output’s size in logical pixels: exact once the surface is
configured, before that worked out from the mode and the best scale known
(within a pixel). surface. is the scale an image, or a color on the
full-size fallback, is drawn at on that surface (1. from
wp_fractional_scale_v1, else an integer; a color on a single-pixel or
1×1 buffer is always drawn at 1) and surface. the size in device
pixels an image is drawn at, both null until the surface is
configured. surface. is waiting (the
output has not reported itself yet), pending, configured (with size),
closed (the compositor closed it; scootbg makes it again, once) or
gave-up (closed a second time over the output’s life: scootbg has
stopped trying on that output, says so on stderr, and the other outputs
are unaffected; it lasts until that output is unplugged and plugged back
in, which makes it a new output). shows is what the output has on
screen: {"color":"#rrggbb"} (lowercase),
{"image":"/abs/path","mode":"fill","fill":"#rrggbb","filter":"lanczos3"},
with "url":"https://... beside image for a download (the link the
cached file came from),
or null for nothing. draw_failed is true when the last attempt to
draw what the output should show failed (an image that exists but cannot
be decoded, a buffer too large, a scaling draw the daemon had no room
for, a link that would not download), which tells that null apart from a
clear; the next request for the output, or a new size, retries.
draw_error says why while draw_failed is true (the error the
daemon’s stderr gives, such as "no such file", "shared memory: Cannot allocate memory (os error 12)", or "out of memory: cannot allocate ... bytes for scaling"), and is null otherwise; it is
for a person or an agent to read, and its wording may change. transition
is the animation running on the output now (its kind, such as "fade"
or "bloom", else null; none lands at once and is never reported). While a
slideshow runs (scootbg set DIR --every, below), a rotation object
follows profile: {"directory":"/home/me/wallpapers","every_secs":1800, "shuffle":false,"files":12} — what it cycles, every how many seconds, in
what order, and how many files that is. Which file shows now is each
output’s shows, as for a set. Absent while no slideshow runs. workspace names the workspace active on the output now ("1", "2",
… on scoot), or null while unknown — no mapping, no workspace
protocol, or no events yet. After the outputs, workspaces lists the
live per-workspace mappings: each with its output (null for every
output), its workspace, and what it shows while that workspace is
active (see A wallpaper per workspace). saving
(after the list) is false while set and clear are not saved for
the next start (see Restore), and profile is the profile
whose state is restored and saved. New keys
may be added; none changes meaning within protocol 1. If the daemon cannot
accept clients (out of file descriptors, say), it keeps the wallpaper up,
says so once on stderr, and retries every second rather than exit. The
control protocol itself (one JSON object per line, for scripts that skip
the CLI) is in README.md.
scoot’s [wallpaper] section, which runs apply-config, is in
The [wallpaper] section.
