fix(settings): make background images findable from the settings search

"background image" is a headline feature — the README sells solid,
gradient and image backgrounds — and searching for it found nothing.
Worse than nothing: typing it walked the page to About, because
"background" on its own matches Download updates in the background, and
the last two words then dropped the count to zero and left the reader
stranded there with no badge and nothing dimmed.

Background image and Image opacity now carry index entries, and the
Custom themes intro gains the same keywords so the query has something
to light in the state where those two rows do not exist yet — which is
the state you are in before you duplicate a theme, next to the button
that gets you there.

The badge counts index entries, not rendered rows, so it can read (3)
while one is on screen. That is how the already-indexed ANSI colors
entry behaves too; not changed here.
This commit is contained in:
l0ng-ai
2026-08-08 20:44:43 +07:00
parent 80a61aa494
commit 02f556d597
5 changed files with 40 additions and 3 deletions
+7 -1
View File
@@ -607,6 +607,12 @@ pub fn translate_en(key: L10nKey) -> &'static str {
"proxy http https socks socks5 clash v2ray network download update"
}
L10nKey::SettingsSearchAnsiColorsKeywords => "palette 16 terminal colours theme",
L10nKey::SettingsSearchBackgroundImageKeywords => {
"background image wallpaper picture photo backdrop theme"
}
L10nKey::SettingsSearchImageOpacityKeywords => {
"background image opacity strength fade wallpaper"
}
L10nKey::SettingsSearchArgumentsKeywords => "shell flags login args",
L10nKey::SettingsSearchBlurKeywords => {
"transparency translucent frosted vibrancy window background"
@@ -626,7 +632,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
L10nKey::SettingsSearchCursorBlinkKeywords => "caret blinking flash",
L10nKey::SettingsSearchCursorShapeKeywords => "caret block bar underline beam",
L10nKey::SettingsSearchCustomThemesKeywords => {
"theme duplicate edit colors folder yaml import"
"theme duplicate edit colors folder yaml import background image wallpaper"
}
L10nKey::SettingsSearchDetectUrlsKeywords => "links hyperlink clickable open",
L10nKey::SettingsSearchDiffPreviewFromCountsKeywords => {
+7 -1
View File
@@ -608,6 +608,12 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsSearchAnsiColorsKeywords => {
"パレット 16 ANSI カラー ターミナル テーマ ansi colors palette terminal theme colours"
}
L10nKey::SettingsSearchBackgroundImageKeywords => {
"背景画像 壁紙 画像 写真 テーマ background image wallpaper picture theme"
}
L10nKey::SettingsSearchImageOpacityKeywords => {
"背景画像 不透明度 透明度 強さ 壁紙 background image opacity strength fade"
}
L10nKey::SettingsSearchArgumentsKeywords => {
"シェル フラグ ログイン 引数 arguments shell flags login args"
}
@@ -639,7 +645,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
"カーソル 形状 ブロック バー アンダーライン ビーム cursor shape caret block bar underline beam"
}
L10nKey::SettingsSearchCustomThemesKeywords => {
"テーマ 複製 編集 色 フォルダ yaml インポート custom themes duplicate edit colors folder import"
"テーマ 複製 編集 色 フォルダ 背景画像 壁紙 yaml インポート custom themes duplicate edit colors folder import background image wallpaper"
}
L10nKey::SettingsSearchDetectUrlsKeywords => {
"リンク ハイパーリンク クリック可能 開く detect urls links hyperlink clickable open"
+2
View File
@@ -509,6 +509,8 @@ l10n_keys! {
SettingsSearchCheckUpdatesOnLaunchKeywords,
SettingsSearchUpdateChannelKeywords,
SettingsSearchAnsiColorsKeywords,
SettingsSearchBackgroundImageKeywords,
SettingsSearchImageOpacityKeywords,
SettingsSearchArgumentsKeywords,
SettingsSearchBlurKeywords,
SettingsSearchBoldFontKeywords,
+7 -1
View File
@@ -539,6 +539,12 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsSearchAnsiColorsKeywords => {
"ANSI颜色 调色板 终端颜色 主题 ansi colors palette terminal theme"
}
L10nKey::SettingsSearchBackgroundImageKeywords => {
"背景图片 背景图 壁纸 图片 照片 主题 background image wallpaper picture theme"
}
L10nKey::SettingsSearchImageOpacityKeywords => {
"背景图片 不透明度 透明度 强度 壁纸 background image opacity strength fade"
}
L10nKey::SettingsSearchArgumentsKeywords => {
"参数 shell 启动参数 登录参数 arguments shell flags login args"
}
@@ -568,7 +574,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
"光标形状 光标 块 竖线 下划线 cursor shape caret block bar underline beam"
}
L10nKey::SettingsSearchCustomThemesKeywords => {
"自定义主题 复制 编辑 颜色 文件夹 yaml 导入 theme custom edit duplicate colors import"
"自定义主题 复制 编辑 颜色 文件夹 背景图片 壁纸 yaml 导入 theme custom edit duplicate colors import background image wallpaper"
}
L10nKey::SettingsSearchDetectUrlsKeywords => {
"检测URL 链接 超链接 可点击 打开 detect urls links hyperlink open"
+17
View File
@@ -199,6 +199,16 @@ fn settings_search_entries() -> &'static [SearchEntry] {
title: SettingsAnsiColors,
keywords: SettingsSearchAnsiColorsKeywords,
},
SearchEntry {
section: Appearance,
title: SettingsBackgroundImage,
keywords: SettingsSearchBackgroundImageKeywords,
},
SearchEntry {
section: Appearance,
title: SettingsImageOpacity,
keywords: SettingsSearchImageOpacityKeywords,
},
SearchEntry {
section: Terminal,
title: SettingsProgram,
@@ -5754,6 +5764,13 @@ mod tests {
("channel", About),
("metered", About),
("automatic", About),
// A headline feature the index had never heard of: "background
// image" matched nothing, and typing it walked the page to About
// because "background" alone hits Download updates in the
// background.
("background image", Appearance),
("wallpaper", Appearance),
("image opacity", Appearance),
];
for (query, expected) in cases {
assert_eq!(