Skip to content
Draft
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,21 @@ features = [
"Devices_Radios",
"Foundation",
"Foundation_Collections",
"Graphics_Capture",
"Graphics_DirectX",
"Graphics_DirectX_Direct3D11",
"Media_Control",
"Win32_Devices_Display",
"Win32_Devices_FunctionDiscovery",
"Win32_Foundation",
"Win32_Globalization",
"Win32_Graphics_Direct2D",
"Win32_Graphics_Direct2D_Common",
"Win32_Graphics_Direct3D",
"Win32_Graphics_DirectWrite",
"Win32_Graphics_Direct3D11",
"Win32_Graphics_Dwm",
"Win32_Graphics_Dxgi",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Gdi",
"Win32_Media_Audio",
Expand All @@ -61,6 +67,7 @@ features = [
"Win32_Networking_WinSock",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_Storage_Xps",
"Win32_System_Com",
"Win32_System_Console",
"Win32_System_Com_StructuredStorage",
Expand All @@ -71,6 +78,8 @@ features = [
"Win32_System_Ole",
"Win32_System_Power",
"Win32_System_Registry",
"Win32_System_WinRT_Direct3D11",
"UI_WindowManagement",
"Win32_System_Search",
"Win32_System_Shutdown",
"Win32_System_SystemInformation",
Expand Down
14 changes: 11 additions & 3 deletions settings/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ impl Config {
let position = string("position")?;
choice(&position, &["center", "bottom"], "position")?;
let window_list = string("window_list")?;
choice(&window_list, &["always", "multiple", "off"], "window_list")?;
choice(
&window_list,
&["always", "multiple", "thumbnails", "off"],
"window_list",
)?;
let dock_icon_size = get("dock_icon_size")
.as_integer()
.filter(|value| *value >= 0)
Expand Down Expand Up @@ -319,8 +323,8 @@ fn validate_edit(key: &str, value: &Value) -> Result<(), String> {
| "dock_icon_size"
| "dock_screen"
| "hide_taskbar" => {}
"window_list" if !matches!(value.as_str(), Some("always" | "multiple" | "off")) => {
return Err("window_list must be always, multiple or off.".into());
"window_list" if !matches!(value.as_str(), Some("always" | "multiple" | "thumbnails" | "off")) => {
return Err("window_list must be always, multiple, thumbnails or off.".into());
}
"window_list" => {}
_ => return Err(format!("Unknown setting: {key}")),
Expand Down Expand Up @@ -494,6 +498,10 @@ mod tests {
assert!(store.set(key, value).is_err(), "{key}");
}
assert!(!store.path.exists());
assert_eq!(
store.set("window_list", "thumbnails".into()).unwrap().window_list,
"thumbnails"
);
assert!(validate_url("https://example.com/?q={query}").is_ok());
assert!(validate_url("https://example.com/?q={QUERY}").is_err());
assert_eq!(store.set("max_results", 20.into()).unwrap().max_results, 20);
Expand Down
3 changes: 2 additions & 1 deletion settings/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const ICON_SVG: &[u8] = include_bytes!("../../assets/icon.svg");
/// Config values and the labels the dropdowns show for them.
const THEMES: [(&str, &str); 3] = [("system", "System"), ("dark", "Dark"), ("light", "Light")];
const BACKDROPS: [(&str, &str); 3] = [("acrylic", "Acrylic"), ("mica", "Mica"), ("solid", "Solid")];
const WINDOW_LISTS: [(&str, &str); 3] = [
const WINDOW_LISTS: [(&str, &str); 4] = [
("multiple", "Only for multiple windows"),
("always", "Always"),
("thumbnails", "Previews for every app"),
("off", "Off"),
];
const ONBOARDING_STEPS: usize = 3;
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub enum WindowListMode {
#[default]
Multiple,
Always,
Thumbnails,
Off,
}

Expand Down Expand Up @@ -276,6 +277,7 @@ mod tests {
for (value, expected) in [
("multiple", super::WindowListMode::Multiple),
("always", super::WindowListMode::Always),
("thumbnails", super::WindowListMode::Thumbnails),
("off", super::WindowListMode::Off),
] {
let config = Config::parse(&format!("window_list = '{value}'")).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion src/default-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ dock_screen = "pointer"
dock_search_button = true

# App window list shown when hovering a running app icon:
# "multiple" (only when the app has multiple windows), "always", or "off".
# "multiple" (only when the app has multiple windows), "always", "thumbnails"
# (live previews of the app's windows), or "off".
window_list = "multiple"

# App icons in the dock, in DIPs (24 to 40).
Expand Down
Loading
Loading