Skip to content

[FEATURE REQUEST] Background image: CSS's size, position and repeat - #65

Open
Dararaaaa wants to merge 2 commits into
ELY-Open-Source:mainfrom
Dararaaaa:feat/background-size
Open

Dararaaaa wants to merge 2 commits into
ELY-Open-Source:mainfrom
Dararaaaa:feat/background-size

Conversation

@Dararaaaa

Copy link
Copy Markdown

Type

  • [FEATURE REQUEST]: a new feature or an improvement
  • [BUG REPORT]: a bug fix
  • [Other]: docs, refactoring, CI, dependencies or chores

What and why

The second of the split PRs from #58. After the picture learned where it paints
(PR #1: background_scope, the terminal's column or the window below the title
bar), it now learns how it fills that box: its size, its position and whether
it tiles, in CSS's own words — cover, contain, fill, auto or a width and
a height such as 51% auto; a place such as right top or 125% 100%; and no
repeat, across, down or both.
Three fields sit beside background_image — background_size,
background_position, background_repeat — so an existing settings.json
still loads unchanged; nothing is migrated, and a file without them takes CSS's
defaults (cover, center, no-repeat), which is what the picture did before.

How it was tested

  • cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings pass.
  • cargo test --lib: the picture and the settings' own tests pass —
    settings::picture 13, workspace::wallpaper 6, settings::tests 17 of 19 —
    plus the rest of the suite. The two settings::tests failures and the
    ConPTY/shell failures come from this sandbox denying temp folders and shell
    spawns (拒绝访问。 (os error 5), exit code: 0xc0000142); the same tests pass
    on a machine that can write its temp folder, as CI does.
  • By hand, with the picture at "background_size": "51% auto" and
    "background_position": "125% 100%": it draws at 51% of the box's width,
    shifted right by 125% of the free space and clipped at the window's edge, as
    CSS's background-position: 125% does.
  • The window's ground still paints under the picture at the background opacity;
    a temporary red ground showed the whole window filled by it, with the picture
    over it.

Screenshots

The picture at 51% auto, 125% 100%
image

Checklist

  • The title starts with [FEATURE REQUEST], [BUG REPORT] or [Other]
  • Tests and the build pass locally
  • Docs are updated if behaviour changed

Stacked on the first PR (feat/background-scope): until that one merges, this
PR's compare shows its commit too; once it lands, only this PR's own commit
stays.

Background image gains a Picture scope: the terminal's column, the
default, or the window below the title bar. Settings › Appearance shows
the choice beside the image.

The picture paints behind the workspace from src/workspace/wallpaper.rs,
over the window's ground — the theme's background at the background
opacity — so the columns can leave their glass at 0 while a picture is
set, and the picture keeps its colors. A canvas ruler records the
terminal body's bounds, since a column's header may hold it wider than
its width setting, and asks for another frame when they move; the
window's picture starts below the title bar from those bounds. The old
TerminalView backdrop is gone.

settings.json gains background_scope (terminal or window); a file without
it keeps the terminal. Tests cover the default and round trip, and both
boxes. PRD, AGENTS.md, tasks/acceptance.md and the feature docs say so.
The picture fills its box as CSS's `background-size`, `background-position`
and `background-repeat` say: `cover`, `contain`, `fill`, `auto`, or a width
and a height such as `51% auto`; a place such as `right top` or `125% 100%`;
and no repeat, across, down or both. Settings › Appearance gains Picture
size, Picture position and Picture repeat under Picture scope, and a size or
a place that does not read says why under its field.

`src/settings/picture.rs` holds the model and its parsers; `wallpaper.rs`
sizes the picture against its own pixels at the window's scale, places it,
and tiles it from before the box, at most 400 tiles.
@Dararaaaa Dararaaaa changed the title Feat/background size [FEATURE REQUEST] Background image: CSS's size, position and repeat Nov 3, 2026
@Dararaaaa Dararaaaa closed this Nov 3, 2026
@Dararaaaa Dararaaaa reopened this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants