diff --git a/release/0.1.10/RELEASE_NOTES.md b/release/0.1.10/RELEASE_NOTES.md index 6400c85..34d34d2 100644 --- a/release/0.1.10/RELEASE_NOTES.md +++ b/release/0.1.10/RELEASE_NOTES.md @@ -29,6 +29,12 @@ Squid 0.1.10 更新说明 左键也会弹菜单)。 调整 +- 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存 + 垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装 + 包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常 + 项合并成一次清理。深度扫描目录、文件年龄(3/7/30 天)、Git 保护收进页面 + 顶部设置栏;扫描与删除全程有步骤条与实时进度;侧边栏与托盘菜单同步精简, + 快捷键重排(Ctrl+2 = 空间清理)。 - 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面 (窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠 不会把它叫回来)。 diff --git a/release/0.1.10/SHA256SUMS.txt b/release/0.1.10/SHA256SUMS.txt index 00c9281..09712bc 100644 --- a/release/0.1.10/SHA256SUMS.txt +++ b/release/0.1.10/SHA256SUMS.txt @@ -1,2 +1,2 @@ -f259188d2d7f3d1e7fbc4f5851e01a0c9b174f88cb7fb4f95d524aec24437014 *Squid-Setup-0.1.10-win-x64.exe -0525b2225d790001be2f13ff240317b16562b3cce63a2edf9ae889086a7fcfc0 *Squid-0.1.10-portable-win-x64.zip +9ccb814e0e5b59847d650581f2707e7c392b12910e134f0320dac4665d98ce19 *Squid-Setup-0.1.10-win-x64.exe +c0908cb68b9e4b91b5901199217a5fa28624ec7588931f53a2e9318b72f9382e *Squid-0.1.10-portable-win-x64.zip diff --git a/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe b/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe index b47b149..b598062 100644 Binary files a/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe and b/release/0.1.10/Squid-Setup-0.1.10-win-x64.exe differ diff --git a/release/0.1.10/squid-update.json b/release/0.1.10/squid-update.json index 27d4303..1b64785 100644 --- a/release/0.1.10/squid-update.json +++ b/release/0.1.10/squid-update.json @@ -2,12 +2,12 @@ "schema": 1, "version": "0.1.10", "date": "2026-11-19", - "notes": "Squid 0.1.10\n\n新增\n- 清理新增「升级安装包」分类:找出应用升级完成后留在 AppData 里的安装包\n (微信、企业微信、WPS、网易邮箱等已知应用精确规则 + AppData 启发式扫描)。\n 只匹配安装包形态(exe/msi/zip/7z 等)且放置超过 7 天的文件,微信运行库组件\n 不会被误删;应用正在运行时相关安装包自动锁定。删除确认时会提示升级包数量\n 与大小,可一键「跳过升级包,只删其余」。\n- 桌面小工具新增「CPU」面板:总体占用率历史曲线 + 整行渐变占用柱,一根柱对应\n 一个逻辑核心;柱色随占用率在绿→黄→橙→红之间连续渐变(含柱内纵向微渐变),\n 悬停显示「核心 N: xx%」(编号与任务管理器一致从 0 开始);核心较多时柱宽自动\n 收窄。管理页与桌面设置弹层可独立开关该面板。\n\n优化\n- 桌面常驻 CPU 占用大幅下降(实测本机构从约 8.5% 全机总占用降至 0.2%):\n 小工具改用轻量采样(跳过全机逐进程枚举,那是旧版每秒最贵的一步)、两个\n 窗口共享同一次采样、小工具折叠或主窗口收进托盘后完全停止采样。实时监控\n 页打开时才有完整进程表,功能不受影响。\n- 修复小工具窗口自身的自适应尺寸回环(尺寸→重锚定→再触发自适应无限循环),\n 该回环会让主进程与小工具渲染进程空转互叫并频繁写配置文件;修复后小工具\n 开着时 Squid 全家 CPU 占用接近 0%。\n\n修复\n- 深度清理:默认检查目录(~/code 等 macOS 风格)在本机全都不存在时不再报\n 「请先选择目录」,自动回退到用户主目录扫描;「要检查的项目目录」旁新增\n 「浏览…」按钮可直接多选文件夹;扫描出错信息此前会被静默吞掉,现在会以\n 红色横幅显示。\n- 托盘交互:左键单击/双击图标 = 直接打开主界面,右键 = 弹出菜单(原先\n 左键也会弹菜单)。\n\n调整\n- 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面\n (窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠\n 不会把它叫回来)。\n- Windows 上所有「废纸篓」文案改为「回收站」(清理、卸载、历史、设置等随系统\n 名称联动);macOS 仍为「废纸篓」。", + "notes": "Squid 0.1.10\n\n新增\n- 清理新增「升级安装包」分类:找出应用升级完成后留在 AppData 里的安装包\n (微信、企业微信、WPS、网易邮箱等已知应用精确规则 + AppData 启发式扫描)。\n 只匹配安装包形态(exe/msi/zip/7z 等)且放置超过 7 天的文件,微信运行库组件\n 不会被误删;应用正在运行时相关安装包自动锁定。删除确认时会提示升级包数量\n 与大小,可一键「跳过升级包,只删其余」。\n- 桌面小工具新增「CPU」面板:总体占用率历史曲线 + 整行渐变占用柱,一根柱对应\n 一个逻辑核心;柱色随占用率在绿→黄→橙→红之间连续渐变(含柱内纵向微渐变),\n 悬停显示「核心 N: xx%」(编号与任务管理器一致从 0 开始);核心较多时柱宽自动\n 收窄。管理页与桌面设置弹层可独立开关该面板。\n\n优化\n- 桌面常驻 CPU 占用大幅下降(实测本机构从约 8.5% 全机总占用降至 0.2%):\n 小工具改用轻量采样(跳过全机逐进程枚举,那是旧版每秒最贵的一步)、两个\n 窗口共享同一次采样、小工具折叠或主窗口收进托盘后完全停止采样。实时监控\n 页打开时才有完整进程表,功能不受影响。\n- 修复小工具窗口自身的自适应尺寸回环(尺寸→重锚定→再触发自适应无限循环),\n 该回环会让主进程与小工具渲染进程空转互叫并频繁写配置文件;修复后小工具\n 开着时 Squid 全家 CPU 占用接近 0%。\n\n修复\n- 深度清理:默认检查目录(~/code 等 macOS 风格)在本机全都不存在时不再报\n 「请先选择目录」,自动回退到用户主目录扫描;「要检查的项目目录」旁新增\n 「浏览…」按钮可直接多选文件夹;扫描出错信息此前会被静默吞掉,现在会以\n 红色横幅显示。\n- 托盘交互:左键单击/双击图标 = 直接打开主界面,右键 = 弹出菜单(原先\n 左键也会弹菜单)。\n\n调整\n- 「日常清理」与「深度清理」合并为一个「空间清理」页:一次扫描同时检查缓存\n 垃圾与项目构建目录,结果汇总为一份清单。默认只勾选日常清理项,「升级安装\n 包 / 项目产物 / 开发文件」三类为可选(虚线卡片 + 可选角标),勾选后与日常\n 项合并成一次清理。深度扫描目录、文件年龄(3/7/30 天)、Git 保护收进页面\n 顶部设置栏;扫描与删除全程有步骤条与实时进度;侧边栏与托盘菜单同步精简,\n 快捷键重排(Ctrl+2 = 空间清理)。\n- 桌面小工具 Win+D 常驻:按下「显示桌面」后小工具约 2 秒内自动回到桌面\n (窗口保持桌面层:在壁纸与图标之上、其他软件窗口之下;自己关闭/折叠\n 不会把它叫回来)。\n- Windows 上所有「废纸篓」文案改为「回收站」(清理、卸载、历史、设置等随系统\n 名称联动);macOS 仍为「废纸篓」。", "artifacts": { "windows": { "file": "Squid-Setup-0.1.10-win-x64.exe", - "sha256": "f259188d2d7f3d1e7fbc4f5851e01a0c9b174f88cb7fb4f95d524aec24437014", - "size": 3569772 + "sha256": "9ccb814e0e5b59847d650581f2707e7c392b12910e134f0320dac4665d98ce19", + "size": 3568622 } } } \ No newline at end of file diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 7f5601b..dd1d7fb 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -31,9 +31,8 @@ fn navigate_to(app: &AppHandle, page: &'static str) { fn create_tray(app: &AppHandle) -> tauri::Result<()> { let open = MenuItem::with_id(app, "open", "打开 Squid", true, None::<&str>)?; - let cleanup = MenuItem::with_id(app, "cleanup", "日常清理", true, None::<&str>)?; + let space = MenuItem::with_id(app, "space", "空间清理", true, None::<&str>)?; let apps = MenuItem::with_id(app, "applications", "应用卸载", true, None::<&str>)?; - let purge = MenuItem::with_id(app, "purge", "深度清理", true, None::<&str>)?; let quit = MenuItem::with_id(app, "quit", "退出 Squid", true, None::<&str>)?; let first_separator = PredefinedMenuItem::separator(app)?; let last_separator = PredefinedMenuItem::separator(app)?; @@ -45,9 +44,8 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> { &[ &open, &first_separator, - &cleanup, + &space, &apps, - &purge, &widget_toggle, &last_separator, &quit, @@ -66,9 +64,8 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> { .show_menu_on_left_click(false) .on_menu_event(|app, event| match event.id.as_ref() { "open" => show_main_window(app), - "cleanup" => navigate_to(app, "cleanup"), + "space" => navigate_to(app, "space"), "applications" => navigate_to(app, "applications"), - "purge" => navigate_to(app, "purge"), "widget" => { if let Err(error) = widget::toggle_from_tray(app) { eprintln!("widget toggle failed: {error}"); diff --git a/src/App.tsx b/src/App.tsx index 06ad6e9..daecebc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,6 @@ import { Settings, ShieldCheck, Sparkles, - WandSparkles, } from "lucide-react"; import { useCallback, useEffect, useState, type ReactNode } from "react"; import { useAppsWorkspace } from "./hooks/useAppsWorkspace"; @@ -33,12 +32,11 @@ import { useToast } from "./components/ui"; import { SetupPanel } from "./components/SetupPanel"; import appIconUrl from "../src-tauri/icons/128x128.png"; import { ApplicationsPage } from "./pages/ApplicationsPage"; -import { CleanupPage } from "./pages/CleanupPage"; import { HistoryPage } from "./pages/HistoryPage"; import { OverviewPage } from "./pages/OverviewPage"; import { PermissionsPage } from "./pages/PermissionsPage"; -import { PurgePage } from "./pages/PurgePage"; import { SettingsPage } from "./pages/SettingsPage"; +import { SpacePage } from "./pages/SpacePage"; import { StoragePage } from "./pages/StoragePage"; import { SystemPage } from "./pages/SystemPage"; import { WidgetPage } from "./pages/WidgetPage"; @@ -64,9 +62,9 @@ const NAV_GROUPS: { icon: LayoutDashboard, }, { - id: "cleanup", - labelEn: "Daily cleanup", - labelZh: "日常清理", + id: "space", + labelEn: "Space cleaning", + labelZh: "空间清理", icon: Eraser, }, { @@ -75,12 +73,6 @@ const NAV_GROUPS: { labelZh: "应用卸载", icon: AppWindow, }, - { - id: "purge", - labelEn: "Deep Clean", - labelZh: "深度清理", - icon: WandSparkles, - }, { id: "permissions", labelEn: "Permissions", @@ -123,9 +115,8 @@ const NAV_GROUPS: { const PAGE_TITLES: Record = { overview: ["Computer overview", "电脑概览"], - cleanup: ["Daily cleanup", "日常清理"], + space: ["Space cleaning", "空间清理"], applications: ["Uninstall apps", "应用卸载"], - purge: ["Deep Clean", "深度清理"], permissions: ["Permissions", "权限管理"], widget: ["Desktop widget", "桌面小工具"], storage: ["Storage", "存储空间"], @@ -255,17 +246,16 @@ export default function App() { useEffect(() => { const order: PageId[] = [ "overview", - "cleanup", + "space", "applications", - "purge", "permissions", "storage", "system", + "widget", "history", "settings", - "widget", ]; - // Ctrl/Cmd+1..9 map in order; the 10th (desktop widget) rides on "0". + // Ctrl/Cmd+1..9 map in navigation order. const onKey = (event: KeyboardEvent) => { if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) return; const index = event.key === "0" ? 9 : Number(event.key) - 1; @@ -336,12 +326,15 @@ export default function App() { bootstrap={bootstrap} snapshot={system.snapshot} cleanup={cleanup} + purge={purge} onNavigate={setPage} /> ) : null} - {page === "cleanup" ? ( - setPage("history")} /> @@ -349,14 +342,6 @@ export default function App() { {page === "applications" ? ( setPage("history")} /> ) : null} - {page === "purge" ? ( - setPage("history")} - /> - ) : null} {page === "permissions" ? : null} {page === "widget" ? : null} {page === "storage" ? : null} @@ -435,7 +420,7 @@ function AppChrome({ > {lang === "zh" ? item.labelZh : item.labelEn} - {item.id === "cleanup" && page !== "cleanup" ? ( + {item.id === "space" && page !== "space" ? ( ) : null} diff --git a/src/components/CleanupView.tsx b/src/components/CleanupView.tsx index 37d0ef9..e622b59 100644 --- a/src/components/CleanupView.tsx +++ b/src/components/CleanupView.tsx @@ -84,7 +84,7 @@ export function CategorySummary({ ); } -function ItemRow({ +export function ItemRow({ item, checked, onToggle, diff --git a/src/hooks/useScanWorkspace.ts b/src/hooks/useScanWorkspace.ts index 1411d95..b67c2e6 100644 --- a/src/hooks/useScanWorkspace.ts +++ b/src/hooks/useScanWorkspace.ts @@ -35,6 +35,7 @@ export interface ScanWorkspace { cancel: () => Promise; toggleItem: (index: number) => void; toggleCategory: (category: Category) => void; + setCategorySelection: (category: Category, on: boolean) => void; deselect: (indexes: number[]) => void; selectAll: () => void; clearSelection: () => void; @@ -150,6 +151,29 @@ export function useScanWorkspace(kind: ScanKind): ScanWorkspace { const clearSelection = useCallback(() => setSelected(new Set()), []); + // Deterministic category state: the 空间清理 page uses this to leave the + // optional groups (升级安装包 / 项目产物 / 开发文件) unchecked after a + // scan, wherever the rule defaults happened to point. + const setCategorySelection = useCallback( + (category: Category, on: boolean) => { + if (!result) return; + const indexes = result.items + .map((item, index) => ({ item, index })) + .filter(({ item }) => item.category === category && !item.lock) + .map(({ index }) => index); + if (indexes.length === 0) return; + setSelected((current) => { + const next = new Set(current); + for (const index of indexes) { + if (on) next.add(index); + else next.delete(index); + } + return next; + }); + }, + [result], + ); + const deselect = useCallback((indexes: number[]) => { if (indexes.length === 0) return; const drop = new Set(indexes); @@ -230,6 +254,7 @@ export function useScanWorkspace(kind: ScanKind): ScanWorkspace { cancel, toggleItem, toggleCategory, + setCategorySelection, deselect, selectAll, clearSelection, diff --git a/src/pages/CleanupPage.tsx b/src/pages/CleanupPage.tsx deleted file mode 100644 index e2ac163..0000000 --- a/src/pages/CleanupPage.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { ScanSearch, Sparkles } from "lucide-react"; -import { useI18n } from "../i18n"; -import { formatBytes } from "../lib/format"; -import type { DeleteMode } from "../types"; -import type { ScanWorkspace } from "../hooks/useScanWorkspace"; -import { CleanupInventory } from "../components/CleanupView"; -import { Button, EmptyState, PageHeader } from "../components/ui"; - -export function CleanupPage({ - workspace, - deleteMode, - onHistory, -}: { - workspace: ScanWorkspace; - deleteMode: DeleteMode; - onHistory: () => void; -}) { - const { t } = useI18n(); - return ( -
- } - onClick={() => void workspace.runScan()} - disabled={workspace.scanning || workspace.deleting} - > - {t("Scan again", "重新扫描")} - - ) : null - } - /> - - {workspace.error && !workspace.scanning ? ( -
{workspace.error}
- ) : null} - - - - {!workspace.result && !workspace.scanning && !workspace.summary ? ( - } - title={t("Ready when you are", "随时可以开始")} - description={t( - "Squid checks known cache and log locations, measures what can be reclaimed, and locks anything it cannot remove safely.", - "Squid 会检查已知缓存与日志位置,统计可释放空间,并锁定任何无法安全删除的项目。", - )} - action={ - - } - /> - ) : null} - - {workspace.result && workspace.selectedTotal > 0 ? ( -

- - {t( - `${formatBytes(workspace.selectedTotal)} selected. Nothing is removed until you confirm.`, - `已选择 ${formatBytes(workspace.selectedTotal)},在您确认前不会删除任何内容。`, - )} - -

- ) : null} -
- ); -} diff --git a/src/pages/OverviewPage.tsx b/src/pages/OverviewPage.tsx index 894eab0..71d5bf4 100644 --- a/src/pages/OverviewPage.tsx +++ b/src/pages/OverviewPage.tsx @@ -71,11 +71,13 @@ export function OverviewPage({ bootstrap, snapshot, cleanup, + purge, onNavigate, }: { bootstrap: Bootstrap; snapshot: SystemSnapshot | null; cleanup: ScanWorkspace; + purge: ScanWorkspace; onNavigate: (page: PageId) => void; }) { const { t, lang } = useI18n(); @@ -87,11 +89,33 @@ export function OverviewPage({ const memoryReserved = snapshot ? Math.max(0, memoryInstalled - snapshot.memory.total) : 0; - const found = cleanup.result - ? cleanup.result.items - .filter((item) => !item.lock) - .reduce((sum, item) => sum + item.onDisk, 0) - : 0; + const scanned = Boolean(cleanup.result || purge.result); + const scanning = cleanup.scanning || purge.scanning; + const found = [cleanup, purge].reduce( + (sum, workspace) => + sum + + (workspace.result + ? workspace.result.items + .filter((item) => !item.lock) + .reduce((total, item) => total + item.onDisk, 0) + : 0), + 0, + ); + // 智能扫描 lives on the 空间清理 page now; the workspaces are app-level so + // kicking both stages from here simply continues on that page. It uses the + // default deep-scan settings — tweak them there and re-scan if needed. + const smartScan = () => { + if (!scanned) { + void cleanup.runScan().then(() => + purge.runScan({ + roots: bootstrap.settings.purgeRoots, + minAgeDays: bootstrap.settings.purgeMinAgeDays || 7, + force: false, + }), + ); + } + onNavigate("space"); + }; const hardware = bootstrap.hardwareInfo; const ramBrands = [ @@ -151,13 +175,10 @@ export function OverviewPage({ variant="primary" size="lg" icon={} - onClick={() => { - if (cleanup.result) onNavigate("cleanup"); - else void cleanup.runScan(); - }} - disabled={cleanup.scanning} + onClick={smartScan} + disabled={scanning} > - {cleanup.result + {scanned ? t("Review scan", "查看扫描结果") : t("Smart scan", "智能扫描")} @@ -171,7 +192,7 @@ export function OverviewPage({ {t("Smart Care", "智能维护")}

- {cleanup.result + {scanned ? t( `${formatBytes(found)} found safely.`, `安全发现 ${formatBytes(found)} 可清理空间。`, @@ -179,7 +200,7 @@ export function OverviewPage({ : t("A lighter, faster machine.", "更轻盈,更顺畅。")}

- {cleanup.result + {scanned ? t( "Review each category before anything is removed. Locked files stay untouched.", "清理前可逐项检查,锁定文件始终不会被处理。", @@ -192,14 +213,11 @@ export function OverviewPage({

@@ -259,15 +277,15 @@ export function OverviewPage({
- {cleanup.scanning ? ( + {scanning ? ( void cleanup.cancel()} + onCancel={() => void (cleanup.scanning ? cleanup.cancel() : purge.cancel())} /> ) : null} - {cleanup.result && !cleanup.scanning ? ( + {scanned && !scanning ? (
onNavigate("cleanup")}> - {t("Open cleanup", "打开清理")} + } /> - onNavigate("cleanup")} - /> + {cleanup.result ? ( + onNavigate("space")} + /> + ) : null}
) : null} @@ -426,13 +446,18 @@ export function OverviewPage({ - diff --git a/src/pages/PurgePage.tsx b/src/pages/PurgePage.tsx deleted file mode 100644 index 01647a4..0000000 --- a/src/pages/PurgePage.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import { - AlertTriangle, - FolderOpen, - FolderSearch, - GitBranch, - ScanSearch, - ShieldAlert, -} from "lucide-react"; -import { open } from "@tauri-apps/plugin-dialog"; -import { useState } from "react"; -import { useI18n } from "../i18n"; -import type { Bootstrap, DeleteMode } from "../types"; -import type { ScanWorkspace } from "../hooks/useScanWorkspace"; -import { CleanupInventory } from "../components/CleanupView"; -import { Button, PageHeader, Toggle } from "../components/ui"; - -export function PurgePage({ - workspace, - bootstrap, - deleteMode, - onHistory, -}: { - workspace: ScanWorkspace; - bootstrap: Bootstrap; - deleteMode: DeleteMode; - onHistory: () => void; -}) { - const { t } = useI18n(); - const [roots, setRoots] = useState(bootstrap.settings.purgeRoots.join("\n")); - const [minAge, setMinAge] = useState(bootstrap.settings.purgeMinAgeDays); - const [force, setForce] = useState(false); - - const browse = async () => { - const chosen = await open({ - directory: true, - multiple: true, - title: t("Choose project folders to inspect", "选择要检查的项目目录"), - }); - if (!chosen) return; - const picked = (Array.isArray(chosen) ? chosen : [chosen]).filter( - (path) => !roots.split(/\r?\n/).some((line) => line.trim() === path), - ); - if (picked.length > 0) { - setRoots((current) => - current.trim().length > 0 - ? `${current.trimEnd()}\n${picked.join("\n")}` - : picked.join("\n"), - ); - } - }; - - const run = () => - void workspace.runScan({ - roots: roots - .split(/\r?\n/) - .map((root) => root.trim()) - .filter(Boolean), - minAgeDays: minAge > 0 ? minAge : null, - force, - }); - - return ( -
- } onClick={run}> - {t("Start deep scan", "开始深度扫描")} - - } - /> - - {workspace.error && !workspace.scanning ? ( -
{workspace.error}
- ) : null} - -
-
- -