From 3a684e9aa0058003c79e8e8d2bb74e44aa80d8f0 Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:28:39 +0700 Subject: [PATCH 1/5] =?UTF-8?q?feat(ui):=20=E8=BF=9E=E6=8E=A5=E9=A1=B5?= =?UTF-8?q?=E5=8F=AF=E6=8C=89=E5=BA=94=E7=94=A8=E5=88=86=E7=BB=84=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E8=BF=9B=E5=8F=AF=E6=8A=98=E5=8F=A0=E7=9A=84=E5=88=86?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 页面栏新增“应用 / 列表”切换。按应用显示时,同一可执行文件的连接归入一个分组: 标题行显示图标、名称与连接数,默认折叠,单击箭头、双击、Enter 或方向键展开, 展开状态与所选视图会被记住。只有一个连接的程序仍显示为普通行;搜索时含匹配项的 分组自动展开。分组标题的右键菜单提供展开/折叠、转到进程与结束进程。 --- src-gpui/src/frontend.rs | 11 ++ src-gpui/src/frontend/backend.rs | 31 +++++- src-gpui/src/frontend/layout.rs | 17 ++- src-gpui/src/frontend/lists.rs | 148 ++++++++++++++++++++++++++ src-gpui/src/frontend/menus.rs | 55 +++++++--- src-gpui/src/frontend/tables.rs | 30 +++--- src-gpui/src/frontend/tables/cells.rs | 12 ++- src-gpui/src/frontend/test_control.rs | 3 + src-gpui/src/frontend/widgets.rs | 11 +- 9 files changed, 277 insertions(+), 41 deletions(-) diff --git a/src-gpui/src/frontend.rs b/src-gpui/src/frontend.rs index a3c2b6ea..dea14233 100644 --- a/src-gpui/src/frontend.rs +++ b/src-gpui/src/frontend.rs @@ -105,6 +105,8 @@ enum Action { Sort(String), Page(String), View(String), + /// How the connection list shows ("list" or "apps"). + ConnectionView(String), Select(String), Fold(String), TreeExpand(String, bool), @@ -349,6 +351,10 @@ struct Desktop { sections: HashSet, /// The folded user groups of the process list (`collapsedUsers`). user_folds: HashSet, + /// How the connection list shows: "list", or "apps" gathered under + /// their programs, of which `connection_folds` are opened. + connection_view: String, + connection_folds: HashSet, rows: Arc>, /// The process list as the automatic column widths measure it /// (`tables::WidthRows`). @@ -543,6 +549,11 @@ impl Desktop { .get::>(model::USER_FOLDS, vec![]) .into_iter() .collect(), + connection_view: prefs.get("connectionView", "list".into()), + connection_folds: prefs + .get::>("openedConnectionApps", vec![]) + .into_iter() + .collect(), rows: Arc::new(vec![]), width_rows: None, width_pending: false, diff --git a/src-gpui/src/frontend/backend.rs b/src-gpui/src/frontend/backend.rs index 824aa97f..23826eb5 100644 --- a/src-gpui/src/frontend/backend.rs +++ b/src-gpui/src/frontend/backend.rs @@ -830,6 +830,13 @@ impl Desktop { self.prefs.set("view", &self.view); self.rebuild_rows(false, cx); } + Action::ConnectionView(view) => { + self.connection_view = view; + self.prefs.set("connectionView", &self.connection_view); + if self.page == "network" { + self.rebuild_rows(false, cx); + } + } Action::Select(key) => { if key.is_empty() || (self.page == "processes" @@ -849,6 +856,23 @@ impl Desktop { } } Action::Fold(key) => { + if self.page == "network" { + // A program's connections; every match shows while searching. + let Some(app) = key.strip_prefix(lists::APP_PREFIX) else { + return; + }; + if !self.query.trim().is_empty() { + return; + } + if !self.connection_folds.remove(app) { + self.connection_folds.insert(app.to_owned()); + } + let mut opened: Vec<_> = self.connection_folds.iter().collect(); + opened.sort(); + self.prefs.set("openedConnectionApps", opened); + self.rebuild_rows(false, cx); + return; + } if let Some(group) = key.strip_prefix("u:") { // While searching every match shows: headings cannot fold. if !self.query.trim().is_empty() { @@ -1110,7 +1134,8 @@ impl Desktop { cx.stop_propagation(); return; } - if matches!(key, "left" | "right") && self.page == "processes" { + if matches!(key, "left" | "right") && matches!(self.page.as_str(), "processes" | "network") + { if let Some(index) = selected { let row = self.rows[index].clone(); if row.expandable && row.expanded == (key == "left") && self.query.trim().is_empty() @@ -1222,6 +1247,10 @@ impl Desktop { ); } } + // A program's heading folds its connections. + "network" if row.expandable => { + self.act(Action::Fold(row.key.clone()), window, cx); + } _ => { if row.raw["pid"].as_u64().is_some_and(|pid| pid != 0) { self.act( diff --git a/src-gpui/src/frontend/layout.rs b/src-gpui/src/frontend/layout.rs index 8fee92ea..c8815139 100644 --- a/src-gpui/src/frontend/layout.rs +++ b/src-gpui/src/frontend/layout.rs @@ -830,7 +830,22 @@ impl Desktop { .child(self.details_button(cx)) } "services" => row.child(self.service_actions(cx)), - "network" => row.child(self.visibility_controls(cx)), + "network" => { + // Every connection on its own, or gathered under its program. + let views = [("apps", "AppsIcon"), ("list", "ListIcon")] + .into_iter() + .map(|(mode, glyph)| { + ( + String::new(), + Some(glyph), + Action::ConnectionView(mode.into()), + self.connection_view == mode, + ) + }) + .collect(); + row.child(self.segments("connection-view", views, cx)) + .child(self.visibility_controls(cx)) + } _ => row.child(self.page_controls(compact, window, cx)), }; Some(row.into_any_element()) diff --git a/src-gpui/src/frontend/lists.rs b/src-gpui/src/frontend/lists.rs index 12c00b9c..fee39a2a 100644 --- a/src-gpui/src/frontend/lists.rs +++ b/src-gpui/src/frontend/lists.rs @@ -63,6 +63,10 @@ pub(super) struct ListSpec { /// Titles and the collation order follow the interface language. pub locale: Locale, pub visibility: Option, + /// Connections gather under their programs (`group_connections`), with + /// the programs whose connections show, by `app_key`. + pub grouped: bool, + pub opened: HashSet, } /// How a row compares in the chosen order, computed once per row. @@ -296,9 +300,79 @@ pub(super) fn list_rows(spec: &ListSpec, source: &[Value], owners: &Owners) -> V }); let mut rows: Vec = ordered.into_iter().map(|(_, row)| row).collect(); rows.sort_by_key(|row| !row.pinned); + if network && spec.grouped { + return group_connections(rows, spec, owners); + } rows } +/// The key of a connection row's group heading. +pub(super) const APP_PREFIX: &str = "c:"; + +/// Which program a connection belongs to, as its group knows it: the owner's +/// executable name, else the row's title (no owner, or one that exited). +fn app_key(row: &Row, owners: &Owners) -> String { + match row.raw["pid"] + .as_u64() + .filter(|pid| *pid != 0) + .and_then(|pid| owners.get(&pid)) + { + Some(owner) => owner.name.to_lowercase(), + // A bar keeps these apart from an executable of the same name. + None => format!("|{}", row.title), + } +} + +/// The connection rows gathered under their programs, in the place each +/// program's first row takes in the list's order. A program with more than +/// one connection gets a heading that folds them; it shows them only when +/// opened (`ListSpec::opened`), or while a search narrows the list. +fn group_connections(rows: Vec, spec: &ListSpec, owners: &Owners) -> Vec { + let searching = !spec.query.trim().is_empty(); + let mut order: Vec = Vec::new(); + let mut groups: HashMap> = HashMap::new(); + for row in rows { + let app = app_key(&row, owners); + groups + .entry(app.clone()) + .or_insert_with(|| { + order.push(app); + Vec::new() + }) + .push(row); + } + let mut grouped = Vec::new(); + for app in order { + let mut members = groups.remove(&app).unwrap_or_default(); + if members.len() == 1 { + grouped.append(&mut members); + continue; + } + let first = &members[0]; + // One process (most programs) also gives the heading its PID, so + // that it can go to the process; several leave it empty. + let pid = &first.raw["pid"]; + let one = members.iter().all(|row| &row.raw["pid"] == pid); + let raw = json!({ + "icon": first.raw["icon"].clone(), + "pid": if one { pid.clone() } else { Value::Null }, + }); + let opened = searching || spec.opened.contains(&app); + let mut heading = Row::item(raw, format!("{APP_PREFIX}{app}"), first.title.clone()); + heading.members = members.iter().map(|row| row.raw.clone()).collect(); + heading.expandable = true; + heading.expanded = opened; + grouped.push(heading); + if opened { + for mut row in members { + row.depth = 1; + grouped.push(row); + } + } + } + grouped +} + /// The connection list's inputs, to tell whether rows built from them are current. #[derive(Clone, PartialEq)] pub(super) struct ConnectionInputs { @@ -368,6 +442,12 @@ impl Desktop { marks: self.marks_of(page), locale: argus_core::i18n::locale(), visibility: self.visibility_rules(page), + grouped: page == "network" && self.connection_view == "apps", + opened: if page == "network" && self.connection_view == "apps" { + self.connection_folds.clone() + } else { + HashSet::new() + }, } } /// The connections' owners in the current snapshot, read again only for @@ -559,6 +639,8 @@ mod tests { marks, locale: argus_core::i18n::locale(), visibility: None, + grouped: false, + opened: Default::default(), } } fn connections() -> Vec { @@ -689,6 +771,72 @@ mod tests { let rows = list_rows(&spec("localPort", false, "vpn", marks), &source, &owners); assert_eq!(ports(&rows), vec![(50000, Some(443))]); } + #[test] + fn grouped_connections_fold_under_their_programs() { + let source = connections(); + let owners = owners(&processes(), &source); + let mut spec = spec("localPort", false, "", json!({})); + spec.grouped = true; + let shape = |rows: &[Row]| { + rows.iter() + .map(|row| (row.key.clone(), row.depth, row.members.len(), row.expanded)) + .collect::>() + }; + // Folded: one heading for the server's three, the browser's one as it is. + let rows = list_rows(&spec, &source, &owners); + assert_eq!(rows.len(), 2); + assert_eq!(rows[0].key, "c:server.exe"); + assert_eq!((rows[0].depth, rows[0].members.len()), (0, 3)); + assert!(rows[0].expandable && !rows[0].expanded); + assert_eq!(rows[0].title, "server.exe"); + assert_eq!(rows[0].raw["pid"], 10); + assert_eq!(rows[0].raw["icon"], 1); + assert_eq!(rows[1].raw["pid"], 20); + assert!(!rows[1].expandable); + // Opened: its connections follow it, one step in, in the list's order. + spec.opened.insert("server.exe".into()); + let rows = list_rows(&spec, &source, &owners); + assert_eq!(rows.len(), 5); + assert!(rows[0].expanded); + assert_eq!( + ports(&rows[1..4]), + [(80, None), (8080, None), (8080, Some(51000))] + ); + assert!(rows[1..4].iter().all(|row| row.depth == 1)); + assert_eq!((rows[4].raw["pid"].as_u64(), rows[4].depth), (Some(20), 0)); + // A search opens every group with a match, folded or not. + spec.opened.clear(); + spec.query = "8080".into(); + let rows = list_rows(&spec, &source, &owners); + assert_eq!(shape(&rows)[0], ("c:server.exe".to_owned(), 0, 2, true)); + assert_eq!(ports(&rows[1..]), [(8080, None), (8080, Some(51000))]); + } + + #[test] + fn a_program_with_several_processes_is_one_group_without_a_pid() { + let source = vec![ + json!({"protocol":"tcp","localPort":1,"pid":10,"state":"established"}), + json!({"protocol":"tcp","localPort":2,"pid":11,"state":"established"}), + json!({"protocol":"tcp","localPort":3,"pid":99,"state":"established"}), + json!({"protocol":"tcp","localPort":4,"pid":98,"state":"established"}), + ]; + let processes = vec![ + json!({"pid":10,"name":"Chrome.exe","description":"Google Chrome"}), + json!({"pid":11,"name":"chrome.exe","description":"Google Chrome"}), + ]; + let owners = owners(&processes, &source); + let mut spec = spec("localPort", false, "", json!({})); + spec.grouped = true; + let rows = list_rows(&spec, &source, &owners); + assert_eq!(rows.len(), 2); + assert_eq!(rows[0].key, "c:chrome.exe"); + assert_eq!(rows[0].members.len(), 2); + assert!(rows[0].raw["pid"].is_null()); + // Connections whose processes exited gather under that title. + assert_eq!(rows[1].members.len(), 2); + assert!(rows[1].key.starts_with("c:|")); + } + #[test] fn protocol_and_state_filters_narrow_together() { let mut source = connections(); diff --git a/src-gpui/src/frontend/menus.rs b/src-gpui/src/frontend/menus.rs index cfe79ce4..67eb7c5e 100644 --- a/src-gpui/src/frontend/menus.rs +++ b/src-gpui/src/frontend/menus.rs @@ -1167,7 +1167,8 @@ impl Desktop { "network" => self.connection_menu(row), _ => vec![], }; - if self.page != "processes" { + // A program's heading has no mark of its own: its connections do. + if self.page != "processes" && !(self.page == "network" && row.expandable) { items.extend(self.mark_menu(row)); } items @@ -1498,23 +1499,43 @@ impl Desktop { }; let closable = text(raw, "protocol") == "tcp" && !v6 && text(raw, "state") == "established"; let remote = raw["remoteAddress"].as_str(); + let reveal = MenuItem::new( + label("common.goToProcess"), + Action::Preference("revealProcess".into(), raw.clone()), + ) + .icon("GoToIcon") + .disabled(process.is_none()); + let end = MenuItem::new( + tr!("connections.menu.end", name = name), + Action::Dialog( + "end".into(), + json!({"members":process.into_iter().collect::>(),"name":name}), + ), + ) + .icon("EndIcon") + .danger() + .disabled(pid <= 4 || process.is_none()); + // A program's heading: its PID is there when one process owns them all. + if row.expandable { + return vec![ + MenuItem::new( + label(if row.expanded { + "common.collapse" + } else { + "common.expand" + }), + Action::Fold(row.key.clone()), + ) + // Every match shows while searching: headings cannot fold. + .disabled(!self.query.trim().is_empty()), + MenuItem::separator(), + reveal, + end, + ]; + } vec![ - MenuItem::new( - label("common.goToProcess"), - Action::Preference("revealProcess".into(), raw.clone()), - ) - .icon("GoToIcon") - .disabled(process.is_none()), - MenuItem::new( - tr!("connections.menu.end", name = name), - Action::Dialog( - "end".into(), - json!({"members":process.into_iter().collect::>(),"name":name}), - ), - ) - .icon("EndIcon") - .danger() - .disabled(pid <= 4 || process.is_none()), + reveal, + end, MenuItem::new( label("connections.menu.close"), Action::Invoke("close_connection".into(), raw.clone()), diff --git a/src-gpui/src/frontend/tables.rs b/src-gpui/src/frontend/tables.rs index e0727dbe..c537cb37 100644 --- a/src-gpui/src/frontend/tables.rs +++ b/src-gpui/src/frontend/tables.rs @@ -1870,22 +1870,22 @@ impl TableDelegate for NativeTable { // time passed: every completed pair folds again. A category heading // folds on every press instead (its select event), as the interface's // `onClick`: no pair folds it again. - let refold = - (self.page == "processes" && row.expandable && row.section.is_none()).then(|| { - let owner = self.owner.clone(); - let key = row.key.clone(); - move |event: &ClickEvent, window: &mut Window, cx: &mut App| { - let count = event.click_count(); - if count >= 4 && count.is_multiple_of(2) { - let owner = owner.clone(); - let key = key.clone(); - window.defer(cx, move |window, cx| { - let _ = owner - .update(cx, |this, cx| this.act(Action::Fold(key), window, cx)); - }); - } + let folds = matches!(self.page.as_str(), "processes" | "network"); + let refold = (folds && row.expandable && row.section.is_none()).then(|| { + let owner = self.owner.clone(); + let key = row.key.clone(); + move |event: &ClickEvent, window: &mut Window, cx: &mut App| { + let count = event.click_count(); + if count >= 4 && count.is_multiple_of(2) { + let owner = owner.clone(); + let key = key.clone(); + window.defer(cx, move |window, cx| { + let _ = + owner.update(cx, |this, cx| this.act(Action::Fold(key), window, cx)); + }); } - }); + } + }); let tr = div() .id(("native-row", index)) .relative() diff --git a/src-gpui/src/frontend/tables/cells.rs b/src-gpui/src/frontend/tables/cells.rs index 3577e6b2..ae609069 100644 --- a/src-gpui/src/frontend/tables/cells.rs +++ b/src-gpui/src/frontend/tables/cells.rs @@ -418,6 +418,8 @@ impl NativeTable { })) .child(value); } + // A program's heading has no state of its own. + CellKind::ConnectionState if row.members.len() > 1 => {} CellKind::ConnectionState => { let state = text(&row.raw, "state"); element = element.gap(px(7.)).child(dot(match state { @@ -828,8 +830,14 @@ impl NativeTable { )); } let processes = self.page == "processes"; + // Connections gathered under their programs fold as process groups do. + let grouped = self.page == "network" + && self + .owner + .upgrade() + .is_some_and(|owner| owner.read(cx).connection_view == "apps"); let mut element = element.gap_2(); - if processes { + if processes || grouped { element = element.pl(px(6. + inset + row.depth as f32 * 20.)); element = if row.expandable { // The button carries the margin itself: a wrapper for it would @@ -857,7 +865,7 @@ impl NativeTable { .into_any_element() }); } - let group = processes && facts.members > 1; + let group = (processes || grouped) && facts.members > 1; let off = self.page == "startup" && facts.startup_disabled; let name = plain_text(row.title.clone()) .min_w_0() diff --git a/src-gpui/src/frontend/test_control.rs b/src-gpui/src/frontend/test_control.rs index f4058243..ab9bc80a 100644 --- a/src-gpui/src/frontend/test_control.rs +++ b/src-gpui/src/frontend/test_control.rs @@ -1091,6 +1091,9 @@ impl Desktop { if let Some(view) = control["view"].as_str() { self.act(Action::View(view.into()), window, cx); } + if let Some(view) = control["connectionView"].as_str() { + self.act(Action::ConnectionView(view.into()), window, cx); + } if let Some(device) = control["device"].as_str() { self.act(Action::Device(device.into()), window, cx); } diff --git a/src-gpui/src/frontend/widgets.rs b/src-gpui/src/frontend/widgets.rs index 128518e7..e30bd59c 100644 --- a/src-gpui/src/frontend/widgets.rs +++ b/src-gpui/src/frontend/widgets.rs @@ -804,11 +804,12 @@ impl Desktop { for (index, (name, glyph, action, _)) in choices.into_iter().enumerate() { let chosen = index == selected; let icon_only = name.is_empty(); - let accessible = if icon_only && let Action::View(mode) = &action { - label(&format!("shell.viewMode.{mode}.label")) - } else { - name.clone() - }; + let accessible = + if icon_only && let Action::View(mode) | Action::ConnectionView(mode) = &action { + label(&format!("shell.viewMode.{mode}.label")) + } else { + name.clone() + }; let color = if chosen { p.ink } else { p.muted }; let hover = p.hover; let ink = p.ink; From 5a571035160ab90f6367d513b1a800b7c4a65f24 Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:37:18 +0700 Subject: [PATCH 2/5] =?UTF-8?q?docs:=20=E8=AF=B4=E6=98=8E=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=A1=B5=E7=9A=84=E6=8C=89=E5=BA=94=E7=94=A8=E5=88=86?= =?UTF-8?q?=E7=BB=84=E5=8F=8A=E5=85=B6=E5=81=8F=E5=A5=BD=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/architecture/frontend.md | 2 +- docs/guide/README.md | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/architecture/frontend.md b/docs/architecture/frontend.md index f4876c82..9d84a934 100644 --- a/docs/architecture/frontend.md +++ b/docs/architecture/frontend.md @@ -10,7 +10,7 @@ `process_icons` 按当前快照保留程序及 WebView2 宿主的图标,表格、详情窗格和规则界面共用同一份图像。快照替换后,过期图标同时从 GPUI 解码缓存和窗口纹理图集中移除,GPU 页面可随之回收;暂停时继续持有原快照的 PNG。 -界面偏好在内存中立即生效,由后台线程写入磁盘,退出前完成写入。`tableSort.<表>` 保存各表排序,`tableWidths.<表>` 保存服务表与启动项表中拖动过的列宽,`services.filter` 和 `connections.filter` 分别保存服务与连接按状态的筛选条件,`connections.protocolFilter` 保存连接按协议的筛选条件。 +界面偏好在内存中立即生效,由后台线程写入磁盘,退出前完成写入。`tableSort.<表>` 保存各表排序,`tableWidths.<表>` 保存服务表与启动项表中拖动过的列宽,`services.filter` 和 `connections.filter` 分别保存服务与连接按状态的筛选条件,`connections.protocolFilter` 保存连接按协议的筛选条件,`connectionView` 保存连接页的视图(`list` 或按应用分组的 `apps`),`openedConnectionApps` 保存按应用视图中展开的分组(小写的可执行文件名)。 性能页的 `cpuKernelTime` 保存 CPU 图表是否叠加内核时间,默认开启。`perfHiddenDevices` 保存设备列表中已隐藏设备的标识(`performance/rail.rs` 的 `stable_key`):磁盘为总线、型号与容量,网络适配器为适配器型号与连接名称,显卡为名称,电池为名称与序列号;标识相同的设备按列表顺序追加序号。磁盘编号和适配器 LUID 随插拔顺序与重启变化,不用作标识。列表至少显示一项:保存的选择隐藏了当前全部设备时显示第一项。 diff --git a/docs/guide/README.md b/docs/guide/README.md index d02ae0a6..10ee456e 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -30,13 +30,17 @@ Argus 的窗口顶部是标题栏,下方是导航栏、当前页面和状态 连接页开启隐藏时,还会过滤 PID 为 0 的“无所属进程”记录。这类记录常见于 TCP 关闭后的 `TimeWait` 阶段,等待协议回收;UDP 的 PID 为 0 表示系统未提供归属。它们没有可供定位或结束的用户进程。其他 PID 暂时缺少身份信息时保留显示。 +### 连接按应用分组 + +连接页的页面栏可在“列表”(默认)与“按应用”之间切换。按应用显示时,同一可执行文件的连接归入一个分组,同名的多个进程(如多个浏览器进程)合为一组;没有所属进程或所属进程已退出的连接按显示的名称分组。分组行显示程序图标、名称与连接数,默认折叠;单击箭头、双击、Enter 或 ←/→ 展开或折叠。只有一个连接的程序仍显示为普通行。分组按其第一条连接在当前排序中的位置排列,组内沿用列排序;筛选与“隐藏系统进程”先于分组生效。搜索时含匹配项的分组自动展开,此时不能折叠。分组行的右键菜单可展开或折叠,由单个进程拥有时还可转到或结束该进程;备注与置顶仍作用于各条连接。所选视图与展开的分组在重启后保留。 + | 页面 | 快捷键 | 内容 | |---|---|---| | 进程 | Ctrl+1 | 三种视图:按应用(同一程序的多个进程合并为一行)、进程树(按父子关系)、列表(全部平铺)。CPU、内存、I/O、GPU 等列可排序,支持搜索;按名称排序时,按应用与列表视图分为“应用”“后台进程”“Windows 进程”三组,标题显示数量和该组的资源合计,单击标题可折叠或展开该组;结束进程或整个进程树、设置优先级与效率模式、暂停与恢复进程、详细信息面板、右键菜单 | | 性能 | Ctrl+2 | CPU(整体或多核视图,多核视图为每个逻辑处理器一张小图,优先排成没有空位的整齐行列,逻辑处理器的数量在当前窗口大小下排不满时才留出空位;小图保持接近原生任务管理器的比例,空间不足时上方的文字先省去频率、再整行隐藏,省去的内容在悬停提示中显示;窗口较小时小图优先,实时数字与规格移至下方,详见[硬件数据](hardware-data.md);混合架构处理器的性能核、能效核与低功耗能效核各用一种颜色并标注 P、E、LP;两种视图都在利用率曲线下叠加内核时间。在 CPU 图表上单击右键可切换“整体视图”与“多核视图”;混合架构处理器在多核视图下另可选择“全部核心”或仅显示某一类核心(如“仅性能核”);同一菜单可取消或重新勾选“显示内核时间”。所选视图、核心类型与内核时间在重启后保留;频率、温度、功耗)、内存、各个磁盘、网络适配器、GPU(引擎利用率默认“智能显示”,仅列出曲线时间范围内有占用的引擎,引擎空闲满一个时间范围后才收起;也可改为固定数量,并选择每张小图显示的引擎,按显卡型号保存。小图可排成网格、焦点(第一个引擎放大,其余排在旁边或围成 L 形)或列表(每个引擎一行),始终铺满、不留空位;除放大的第一个引擎外,其余小图大小一致;网格在引擎数不能排成整齐的行列时,由第一个引擎多占一格;拖动引擎图与显存图之间的分隔条可调整两者的高度比例,双击恢复默认。显卡按驱动支持情况显示温度、频率、电压与功耗瓦数)、NPU(Windows 识别的硬件 NPU,显示利用率与曲线)、电池。曲线随窗口大小伸缩,填满实时数字以外的空间,窗口较矮时压扁曲线以显示实时数字。实时数字与规格在较宽的窗口中左右并排;窗口较窄时(含默认尺寸)规格排在实时数字下方并分为两列,实时数字按能占最少行数的列数排列。CPU 标题旁的“概览 / 详情”切换两页:概览显示曲线、实时数据与规格,详情以卡片列出处理器信息(含指令集)、温度与功耗曲线、内部传感器、每核读数、主板传感器、封装限制与空闲状态,标题行显示摘要,所选页面在重启后保留。磁盘标题旁同样可切换概览与详情,详情页显示健康状况、设备信息与 SMART 属性,见[磁盘详情](#磁盘详情)。磁盘与网络曲线按峰值选择预设量程档位,最低分别为 100 KB/s 和 100 Kbps(字节单位为 100 KB/s),各级档位见[速率量程](../design/charts.md#速率量程);功耗等其他动态量程保持整数或整十数取整。上限变化时曲线平滑过渡、上限标签淡入,随“曲线动画”设置,关闭时直接切换。网络适配器的 IPv4、IPv6 地址超过 3 个时,单击“展开全部”查看其余地址。拖动设备列表右侧的分隔条可调整列表宽度,双击恢复默认。在设备列表的某一项上单击右键可隐藏该项(例如不常用的可移动磁盘或虚拟网络适配器),其余各项随之上移;“显示的设备”子菜单可逐项勾选,“恢复默认显示”恢复全部。隐藏的设备按型号、容量、连接名称等信息记录,重新插拔或重启后仍保持隐藏;列表至少保留一项,隐藏当前选中的项时改为选中其后一项。从概况带或详细信息面板打开已隐藏的设备时,该项回到列表。上下拖动设备列表中的某一项可调整顺序:该项浮起并跟随指针,其余各项实时让位,松开后滑入新位置。右键菜单的“磁盘排序”可选“按磁盘编号”(即 Windows 磁盘管理中的磁盘编号,默认)、“按盘符”(有多个盘符的磁盘按首个盘符,没有盘符的磁盘排在后面)或“自定义(拖动调整)”;拖动打乱了所选的磁盘顺序时自动改为“自定义”,只调整其他设备的位置时保持原选择。“恢复默认顺序”恢复全部设备的初始顺序。顺序按设备的记录信息保存,暂时拔出的设备重新接入后回到原位置,新接入的设备排在原顺序中与其相邻的设备之后。记录信息完全相同的设备(如同型号、同容量的两块磁盘)按采集顺序区分,其中一台拔出或磁盘编号改变后,隐藏状态与顺序可能转到另一台 | | 服务 | Ctrl+3 | 启动、停止服务,修改启动类型,确认后删除服务;进程页里的 svchost 会显示它承载的服务;可[添加备注与置顶](#备注与置顶) | | 启动 | Ctrl+4 | 启用、禁用登录时启动的程序,确认后删除启动项,标出已失效的项目;与系统任务管理器使用同一个开关;可[添加备注与置顶](#备注与置顶) | -| 连接 | Ctrl+5 | TCP / UDP 端点及所属进程,可按端口精确搜索,可断开 IPv4 TCP 连接;可[添加备注与置顶](#备注与置顶) | +| 连接 | Ctrl+5 | TCP / UDP 端点及所属进程,可按端口精确搜索,可断开 IPv4 TCP 连接;可[添加备注与置顶](#备注与置顶);可按应用分组,见[连接按应用分组](#连接按应用分组) | | 历史 | Ctrl+6 | 记录的处理器、内存、磁盘、网络、显卡与电池读数,可分轨道显示、叠加第二个读数,以及任一时刻或区间的进程,见[历史](#历史) | | 组件 | Ctrl+7 | 托盘图标、悬停卡片、快捷面板与常驻行为,[桌面监控](resident-mode.md#桌面监控)与[任务栏监控](resident-mode.md#任务栏监控)的设置,见[组件页](resident-mode.md#组件页) | | 设置 | Ctrl+8 | 见[设置](settings.md) | @@ -69,7 +73,7 @@ Argus 的窗口顶部是标题栏,下方是导航栏、当前页面和状态 - **概况带**:CPU、内存、最忙的磁盘、网络和 GPU。大号数字下方是辅助读数:CPU 为频率、温度与功耗,GPU 为温度与功耗(取自当前最忙的显卡),内存为占用比例,磁盘为活动时间,网络为接收与发送速率。缺失的读数不显示;卡片较窄时,数字与辅助读数随之缩小字号。曲线铺满卡片,在文字下方渐隐;顶部细线标出量程上限,右上角注明上限数值(使用率为 100%,内存为总容量,磁盘与网络为当前档位)。CPU 温度与功耗的来源可悬停查看;GPU 功耗优先显示瓦数,仅有相对读数时显示 `% TDP`。单击卡片转到“性能”页的对应设备。 - **导航栏**:默认以标签形式排列在标题栏下方,标签右侧是页面栏。在“设置 → 语言与外观”或首次启动引导中可改为侧边导航栏:位于窗口左侧,“设置”与“关于”位于底部;默认仅显示图标(指针悬停可看到页面名称与快捷键),单击顶部的 ☰ 按钮展开显示页面名称,再次单击收起。展开后可拖动侧边栏的右边缘调整宽度(150–320 px),双击右边缘恢复默认宽度。位置、展开状态与宽度在重启后保留。 - **标题栏**:空白处可拖动窗口、双击最大化,最右端是最小化、最大化与关闭按钮(指针停在最大化按钮上时,Windows 11 显示贴靠布局)。最小化按钮左侧的图钉按钮切换“置顶显示”:开启后窗口始终显示在其他窗口之上,图钉以强调色填充,再次单击恢复;该状态在重启后保留。左侧是 Argus 的图标与名称,中间是当前页面的搜索框,宽度约为窗口宽度的 30%(不窄于占位文字,不超过 480 px),空间足够且未输入时右端显示快捷键 Ctrl+F。两侧空间足够时搜索框位于窗口正中,否则紧随左侧的名称。 -- **页面栏**:顶部导航时位于标签右侧;侧边导航时位于页面顶部,左侧显示页面名称。依次是当前页面的控件和“更多”按钮:进程页为视图切换(按应用、进程树、列表,仅显示图标)、隐藏系统进程与详细信息面板按钮,服务页为针对所选服务的启动、停止、重新启动,连接页为隐藏系统进程,历史页为“实时”或“回到最新”。服务页与连接页的筛选位于列表“状态”列的表头:单击表头右端的 ⌄ 选择全部、正在运行、已停止(连接页为全部、监听、已连接);连接页的“协议”列另有协议筛选,可选全部、TCP、TCPv6、UDP、UDPv6,与状态筛选同时生效。筛选生效时该按钮显示为强调色的漏斗图标;单击表头其余部分仍按该列排序。“更多”在每个页面都位于最右端,其中有“运行新任务”(Ctrl+N)、“查找占用文件的进程”、服务页的“打开 Windows 服务管理器”和快捷键说明。标签(或页面名称)与控件之间的空白同样可拖动窗口、双击最大化。窗口较窄时,页面控件移到下方单独一行;指针悬停仍可看到按钮名称。 +- **页面栏**:顶部导航时位于标签右侧;侧边导航时位于页面顶部,左侧显示页面名称。依次是当前页面的控件和“更多”按钮:进程页为视图切换(按应用、进程树、列表,仅显示图标)、隐藏系统进程与详细信息面板按钮,服务页为针对所选服务的启动、停止、重新启动,连接页为视图切换(按应用、列表,仅显示图标)与隐藏系统进程,历史页为“实时”或“回到最新”。服务页与连接页的筛选位于列表“状态”列的表头:单击表头右端的 ⌄ 选择全部、正在运行、已停止(连接页为全部、监听、已连接);连接页的“协议”列另有协议筛选,可选全部、TCP、TCPv6、UDP、UDPv6,与状态筛选同时生效。筛选生效时该按钮显示为强调色的漏斗图标;单击表头其余部分仍按该列排序。“更多”在每个页面都位于最右端,其中有“运行新任务”(Ctrl+N)、“查找占用文件的进程”、服务页的“打开 Windows 服务管理器”和快捷键说明。标签(或页面名称)与控件之间的空白同样可拖动窗口、双击最大化。窗口较窄时,页面控件移到下方单独一行;指针悬停仍可看到按钮名称。 - **状态栏**:最左端是版本号,测试构建在版本号后附带提交数(悬停可看到完整版本与更新通道),单击打开本版本的更新内容,右键复制版本号,有新版本时改为更新标记(见[设置 → 更新](settings.md#更新));其后是线程数、句柄数、缓存、分页缓冲池与系统已运行时间,窗口较窄时从最后一项起依次隐藏;右端是刷新控件和权限标记。刷新控件左侧显示刷新状态(例如“每 1 秒刷新”“已暂停刷新”),单击可选择刷新频率,再次单击收起;右端的按钮单击暂停或继续刷新,对所有页面生效,位置不随状态文字变化。权限标记显示“管理员”时,Argus 以管理员身份运行;显示“特权服务”时,Argus 以标准权限运行,需要管理员权限的操作由已连接的特权服务执行;显示“标准权限”时两者都不具备。指针悬停可看到说明。 暂停刷新只冻结界面上的数据,历史记录和规则照常进行(这期间每 5 秒采样一次)。 From 4a1d4abfe70e758e499c5f9a7ee05a3e2faae09c Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:37:42 +0700 Subject: [PATCH 3/5] =?UTF-8?q?docs:=20=E8=BF=9E=E6=8E=A5=E5=88=86?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E8=AF=B4=E6=98=8E=E7=A7=BB=E5=88=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=A1=A8=E6=A0=BC=E4=B9=8B=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/README.md b/docs/guide/README.md index 10ee456e..75e8f32b 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -29,9 +29,6 @@ Argus 的窗口顶部是标题栏,下方是导航栏、当前页面和状态 在用户的分组行上单击右键,除折叠或展开外还有两项,与任务管理器“用户”页相同:“管理用户账户”打开控制面板的用户账户页面;“注销”在确认后结束该用户的全部会话,其中运行的程序随之关闭,未保存的数据可能丢失。注销当前用户与从“开始”菜单注销相同,程序仍可提示保存,Argus 随会话一同退出。注销其他用户需要管理员权限,仅在以管理员身份运行的 Argus 中可用,否则该项不可选并标注“需要管理员权限”。“系统”分组只能折叠或展开。 连接页开启隐藏时,还会过滤 PID 为 0 的“无所属进程”记录。这类记录常见于 TCP 关闭后的 `TimeWait` 阶段,等待协议回收;UDP 的 PID 为 0 表示系统未提供归属。它们没有可供定位或结束的用户进程。其他 PID 暂时缺少身份信息时保留显示。 - -### 连接按应用分组 - 连接页的页面栏可在“列表”(默认)与“按应用”之间切换。按应用显示时,同一可执行文件的连接归入一个分组,同名的多个进程(如多个浏览器进程)合为一组;没有所属进程或所属进程已退出的连接按显示的名称分组。分组行显示程序图标、名称与连接数,默认折叠;单击箭头、双击、Enter 或 ←/→ 展开或折叠。只有一个连接的程序仍显示为普通行。分组按其第一条连接在当前排序中的位置排列,组内沿用列排序;筛选与“隐藏系统进程”先于分组生效。搜索时含匹配项的分组自动展开,此时不能折叠。分组行的右键菜单可展开或折叠,由单个进程拥有时还可转到或结束该进程;备注与置顶仍作用于各条连接。所选视图与展开的分组在重启后保留。 | 页面 | 快捷键 | 内容 | @@ -46,6 +43,9 @@ Argus 的窗口顶部是标题栏,下方是导航栏、当前页面和状态 | 设置 | Ctrl+8 | 见[设置](settings.md) | | 关于 | Ctrl+9 | 版本、权限、更新内容、项目主页、许可证与日志,见[关于](#关于) | +### 连接按应用分组 + + ## 选择进程列 在进程列表的表头右键打开列菜单。指针所在的列可直接升序或降序排序、隐藏该列(名称列除外),或“自动调整此列宽度”。“基本信息”“CPU”“内存”“磁盘与 I/O”“网络”“GPU”六个子菜单列出全部 48 项属性并显示已选数量,单击即显示或隐藏对应的列,子菜单保持打开,可连续调整。菜单下方是“选择列…”“自动宽度”“全宽”和“恢复默认列”。 From 3053d6702541a96cd33b0abc072a214219009061 Mon Sep 17 00:00:00 2001 From: Raylea <101520596+Ray-lea@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:51:03 -0800 Subject: [PATCH 4/5] =?UTF-8?q?fix(host):=20=E9=87=8D=E6=96=B0=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=91=BD=E4=BB=A4=E9=80=82=E9=85=8D=E5=99=A8=E6=97=B6?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E7=9B=AE=E5=BD=95=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bronyaicu <264752859+bronyaicu@users.noreply.github.com> --- src-gpui/src/commands.rs | 7 +++++ src-gpui/src/dispatch.rs | 63 ++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/src-gpui/src/commands.rs b/src-gpui/src/commands.rs index 04c9581a..6370aba1 100644 --- a/src-gpui/src/commands.rs +++ b/src-gpui/src/commands.rs @@ -1015,6 +1015,13 @@ pub fn history_move( Ok(settings_view(&app)) } +pub fn history_reset_dir( + app: crate::native_runtime::Host, + move_records: bool, +) -> Result { + history_move(app, String::new(), move_records) +} + pub fn history_open_dir(dir: State<'_, HistoryDir>) -> Result<(), String> { open_folder(&dir.read()).map_err(|_| tr!("history.error.open")) } diff --git a/src-gpui/src/dispatch.rs b/src-gpui/src/dispatch.rs index 7e701c48..af6bc606 100644 --- a/src-gpui/src/dispatch.rs +++ b/src-gpui/src/dispatch.rs @@ -14,10 +14,6 @@ fn argument(args: &Value, key: &str) -> Result) -> Result { - serde_json::to_value(result.map_err(Value::String)?) - .map_err(|_| Value::String(argus_core::tr!("app.invalidRequest"))) -} pub fn invoke(host: &Host, name: &str, args: Value) -> Result { match name { "desktop_shell" => Ok(serde_json::to_value(crate::commands::desktop_shell()) @@ -301,15 +297,13 @@ pub fn invoke(host: &Host, name: &str, args: Value) -> Result { argument::>(&args, "keys")?, )) .expect("serializable command response")), - "history_events" => serde_json::to_value( - crate::commands::history_events( - host.state(), - argument::(&args, "from")?, - argument::(&args, "to")?, - ) - .map_err(Value::String)?, + "history_events" => crate::commands::history_events( + host.state(), + argument::(&args, "from")?, + argument::(&args, "to")?, ) - .map_err(|_| Value::String(argus_core::tr!("app.invalidRequest"))), + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), "history_channels" => Ok(serde_json::to_value(crate::commands::history_channels( host.state(), argument::(&args, "from")?, @@ -347,29 +341,36 @@ pub fn invoke(host: &Host, name: &str, args: Value) -> Result { ) .map(|value| serde_json::to_value(value).expect("serializable command response")) .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), - "history_move" => history_settings(crate::commands::history_move( + "set_history_enabled" => crate::commands::set_history_enabled( host.clone(), - argument(&args, "dir")?, - argument(&args, "moveRecords")?, - )), - "history_reset_dir" => history_settings(crate::commands::history_move( + host.state(), + host.state(), + argument::(&args, "enabled")?, + ) + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), + "set_history_options" => crate::commands::set_history_options( host.clone(), - String::new(), - argument(&args, "moveRecords")?, - )), - "history_open_dir" => crate::commands::history_open_dir(host.state()) - .map(|()| Value::Null) - .map_err(Value::String), - "set_history_options" => history_settings(crate::commands::set_history_options( + argument::(&args, "options")?, + ) + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), + "history_move" => crate::commands::history_move( host.clone(), - argument(&args, "options")?, - )), - "set_history_enabled" => history_settings(crate::commands::set_history_enabled( + argument::(&args, "dir")?, + argument::(&args, "moveRecords")?, + ) + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), + "history_reset_dir" => crate::commands::history_reset_dir( host.clone(), - host.state(), - host.state(), - argument(&args, "enabled")?, - )), + argument::(&args, "moveRecords")?, + ) + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), + "history_open_dir" => crate::commands::history_open_dir(host.state()) + .map(|value| serde_json::to_value(value).expect("serializable command response")) + .map_err(|error| serde_json::to_value(error).unwrap_or(serde_json::Value::Null)), "set_kernel_sensors" => crate::commands::set_kernel_sensors( host.clone(), host.state(), From e941e0e5073f71d012e632937c495fa37c439e34 Mon Sep 17 00:00:00 2001 From: Raylea <101520596+Ray-lea@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:20:00 -0800 Subject: [PATCH 5/5] =?UTF-8?q?fix(core):=20=E5=88=A0=E9=99=A4=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=96=87=E4=BB=B6=E5=89=8D=E6=A0=B8=E5=AF=B9=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=BF=9B=E7=A8=8B=E7=9A=84=E5=88=A0=E9=99=A4=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bronyaicu <264752859+bronyaicu@users.noreply.github.com> --- crates/argus-core/src/startup.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/crates/argus-core/src/startup.rs b/crates/argus-core/src/startup.rs index 6c66dd62..eb7f0a35 100644 --- a/crates/argus-core/src/startup.rs +++ b/crates/argus-core/src/startup.rs @@ -3,12 +3,13 @@ mod packaged; -use std::path::Path; +use std::{io::ErrorKind, os::windows::fs::OpenOptionsExt, path::Path}; use serde::Serialize; use windows::Win32::Foundation::{ ERROR_FILE_NOT_FOUND, ERROR_SUCCESS, FILETIME, MAX_PATH, WIN32_ERROR, }; +use windows::Win32::Storage::FileSystem::{DELETE, FILE_FLAG_OPEN_REPARSE_POINT}; use windows::Win32::System::Com::{ CLSCTX_INPROC_SERVER, COINIT_MULTITHREADED, CoCreateInstance, CoInitializeEx, IPersistFile, STGM_READ, @@ -508,6 +509,20 @@ fn remove_file(folder: &Path, name: &str, recycle: bool) -> Result<(), ActionErr if !path.is_file() { return Err(ActionError::NotFound); } + // Check the caller's delete access on the directory entry itself before + // handing it to the Shell. Release the handle before the recycle operation. + if let Err(error) = std::fs::File::options() + .access_mode(DELETE.0) + .custom_flags(FILE_FLAG_OPEN_REPARSE_POINT.0) + .open(&path) + { + crate::diagnostics::file_failure("startup open for deletion", &path, &error); + return Err(match error.kind() { + ErrorKind::PermissionDenied => ActionError::AccessDenied, + ErrorKind::NotFound => ActionError::NotFound, + _ => ActionError::Os(error.to_string()), + }); + } // The paths, each ended by a NUL, and the list by another. let mut from = wide(&path.to_string_lossy()); from.push(0); @@ -727,10 +742,11 @@ mod tests { .expect("icacls"); assert!(status.success()); } - assert!(matches!( - remove_file(&folder.0, "Locked.lnk", true), - Err(ActionError::AccessDenied) - )); + let result = remove_file(&folder.0, "Locked.lnk", true); + assert!( + matches!(result, Err(ActionError::AccessDenied)), + "{result:?}" + ); assert!(folder.0.join("Locked.lnk").exists()); }