From 22259e6a27d810460c8388195cdfa854f027310a Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:49:41 +0700 Subject: [PATCH 1/8] =?UTF-8?q?feat(ui):=20=E6=9C=8D=E5=8A=A1=E3=80=81?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E4=B8=8E=E8=BF=9E=E6=8E=A5=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E5=A4=8D=E5=88=B6=E5=90=8D=E7=A7=B0=E3=80=81?= =?UTF-8?q?=E6=89=80=E5=9C=A8=E5=88=97=E4=B8=8E=E8=AF=A6=E7=BB=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与进程列表一致:Ctrl+C 复制名称列显示的名称,Ctrl+Shift+C 以“列名: 内容”逐行复制该行显示的各列 (空白与暂无读数的列除外),有选中的文字时仍复制所选文字。右键菜单新增复制名称列(标注 Ctrl+C)与 “复制详细信息”(Ctrl+Shift+C),在某一列上单击右键时可复制该列。详细信息在菜单打开时取得,连接在 菜单打开期间离开列表也能复制。快捷键说明与使用文档同步更新。 --- docs/guide/README.md | 4 +- locales/de-DE/common.json | 1 + locales/de-DE/settings.json | 4 +- locales/en-US/common.json | 1 + locales/en-US/settings.json | 4 +- locales/es-ES/common.json | 1 + locales/es-ES/settings.json | 4 +- locales/fr-FR/common.json | 1 + locales/fr-FR/settings.json | 4 +- locales/ja-JP/common.json | 1 + locales/ja-JP/settings.json | 4 +- locales/ru-RU/common.json | 1 + locales/ru-RU/settings.json | 4 +- locales/zh-CN/common.json | 1 + locales/zh-CN/settings.json | 4 +- locales/zh-TW/common.json | 1 + locales/zh-TW/settings.json | 4 +- src-gpui/src/frontend.rs | 1 + src-gpui/src/frontend/backend.rs | 13 ++- src-gpui/src/frontend/list_copy.rs | 129 +++++++++++++++++++++++++++++ src-gpui/src/frontend/menus.rs | 48 +++++++++-- src-gpui/src/frontend/tables.rs | 14 ++++ 22 files changed, 222 insertions(+), 27 deletions(-) create mode 100644 src-gpui/src/frontend/list_copy.rs diff --git a/docs/guide/README.md b/docs/guide/README.md index be81dc3e..471239b5 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -110,7 +110,7 @@ Argus 的窗口顶部是标题栏,下方是导航栏、当前页面和状态 选中应用组时,详情面板显示该组的 CPU 与内存曲线、资源合计、最早启动时间、累计读数之和、按 CPU 排序的成员与文件位置。单击成员可查看单进程详情。结束、优先级和效率模式操作仅作用于选中组。 -面板右上角的复制按钮(Ctrl+Shift+C)将面板所列内容复制为文字,按“【进程】”“【资源】”等小节分段,暂无读数的项目不复制;进程页的列表获得焦点时按 Ctrl+C 复制选中项的名称(与名称列显示的一致),面板或其他位置有选中的文字时,两组快捷键都改为复制所选文字。进程的右键菜单中,“复制”子菜单可复制名称、映像名称、PID、映像路径、命令行或详细信息;在某一列上单击右键时,菜单另有“复制“列名””,复制该行在这一列显示的内容,例如在 CPU 列上为“复制“CPU””。 +面板右上角的复制按钮(Ctrl+Shift+C)将面板所列内容复制为文字,按“【进程】”“【资源】”等小节分段,暂无读数的项目不复制;进程页的列表获得焦点时按 Ctrl+C 复制选中项的名称(与名称列显示的一致),面板或其他位置有选中的文字时,两组快捷键都改为复制所选文字。进程的右键菜单中,“复制”子菜单可复制名称、映像名称、PID、映像路径、命令行或详细信息;在某一列上单击右键时,菜单另有“复制“列名””,复制该行在这一列显示的内容,例如在 CPU 列上为“复制“CPU””。服务、启动与连接页的列表同样支持:Ctrl+C 复制名称列显示的名称,Ctrl+Shift+C 或右键菜单的“复制详细信息”以“列名: 内容”逐行复制该行显示的各列(空白与暂无读数的列除外),在某一列上单击右键时同样可“复制“列名””。 网络速率默认以字节每秒显示(KB/s、MB/s,与磁盘一致),可以在“设置 → 数据与历史”里改为比特每秒(Kbps、Mbps,与网卡的链路速度、宽带套餐一致),概况带、进程表、详细信息面板和历史页随之切换;性能页的网络视图总是同时显示两种。 @@ -306,7 +306,7 @@ Windows 触摸屏支持点按按钮、选择列表项,以及双击展开或折 | 选择 | ↑ ↓ | | 折叠 / 展开 | ← →;分组标题上也可按 Enter 或空格 | | 打开详细信息 | Enter | -| 复制名称 / 详细信息 | 进程页 Ctrl+C / Ctrl+Shift+C;有选中的文字时复制所选文字 | +| 复制名称 / 详细信息 | 进程、服务、启动与连接页 Ctrl+C / Ctrl+Shift+C;有选中的文字时复制所选文字 | | 横向滚动列表 | Shift+滚轮(指针位于列表上) | | 结束进程 | 进程页 Alt+E;列表获得焦点时也可按 Delete(Shift+Delete 跳过确认) | | 显示 / 隐藏窗口(全局) | Ctrl+Alt+Esc,可在设置中更改 | diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index 237e52a6..f1ee7048 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -19,6 +19,7 @@ "filterColumn": "Nach „{column}“ filtern", "command": "Befehl", "copyName": "Namen kopieren", + "copyDetails": "Details kopieren", "copyPath": "Pfad kopieren", "openFileLocation": "Dateipfad öffnen", "goToProcess": "Zum Prozess wechseln", diff --git a/locales/de-DE/settings.json b/locales/de-DE/settings.json index 71632851..cfa1211d 100644 --- a/locales/de-DE/settings.json +++ b/locales/de-DE/settings.json @@ -101,8 +101,8 @@ "ends": "Wählen Sie das erste / letzte Element aus", "expand": "Prozesse: Reduzieren/Erweitern einer Gruppe oder Kategorie oder Auswählen eines übergeordneten/untergeordneten Elements", "details": "Prozesse: Details öffnen", - "copyName": "Prozesse: Namen der Auswahl kopieren", - "copyDetails": "Prozesse: Details der Auswahl kopieren, wie sie der Detailbereich aufführt", + "copyName": "Namen der Auswahl kopieren, wie ihn die Namensspalte zeigt", + "copyDetails": "Details der Auswahl kopieren: bei Prozessen wie im Detailbereich, in anderen Listen alle angezeigten Spalten", "endTable": "Prozesse: Auswahl beenden, mit Bestätigung", "endDirect": "Prozesse: Auswahl ohne Bestätigung beenden", "clear": "Auswahl löschen; löschen Sie zuerst die Prozesssuche, falls eine aktiv ist.", diff --git a/locales/en-US/common.json b/locales/en-US/common.json index fa4d9a55..c35750af 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -19,6 +19,7 @@ "filterColumn": "Filter by {column}", "command": "Command", "copyName": "Copy name", + "copyDetails": "Copy details", "copyPath": "Copy path", "openFileLocation": "Open file location", "goToProcess": "Go to process", diff --git a/locales/en-US/settings.json b/locales/en-US/settings.json index 9693be78..3e3ad6f9 100644 --- a/locales/en-US/settings.json +++ b/locales/en-US/settings.json @@ -101,8 +101,8 @@ "ends": "Select the first / last item", "expand": "Processes: collapse / expand a group or category, or select a parent / child", "details": "Processes: open details", - "copyName": "Processes: copy the name of the selection", - "copyDetails": "Processes: copy the details of the selection, as the details pane lists them", + "copyName": "Copy the name of the selection, as the name column shows it", + "copyDetails": "Copy the details of the selection: for a process as the details pane lists them, in other lists every column shown", "endTable": "Processes: end the selection, with confirmation", "endDirect": "Processes: end the selection without confirmation", "clear": "Clear selection; clear the process search first if one is active.", diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index aa65e142..d4aadfca 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -19,6 +19,7 @@ "filterColumn": "Filtrar por {column}", "command": "Comando", "copyName": "Copiar nombre", + "copyDetails": "Copiar detalles", "copyPath": "Copiar ruta", "openFileLocation": "Abrir ubicación del archivo", "goToProcess": "Ir al proceso", diff --git a/locales/es-ES/settings.json b/locales/es-ES/settings.json index 1bcbc89d..49403a64 100644 --- a/locales/es-ES/settings.json +++ b/locales/es-ES/settings.json @@ -101,8 +101,8 @@ "ends": "Seleccione el primer/último elemento", "expand": "Procesos: contraer/expandir un grupo o categoría, o seleccionar un padre/hijo", "details": "Procesos: abrir detalles", - "copyName": "Procesos: copiar el nombre de la selección", - "copyDetails": "Procesos: copiar los detalles de la selección, tal como los muestra el panel de detalles", + "copyName": "Copiar el nombre de la selección, tal como lo muestra la columna de nombre", + "copyDetails": "Copiar los detalles de la selección: en un proceso, como en el panel de detalles; en otras listas, todas las columnas mostradas", "endTable": "Procesos: finalizar la selección, con confirmación", "endDirect": "Procesos: finalizar la selección sin confirmación", "clear": "Borrar selección; borre primero la búsqueda de procesos si hay alguna activa.", diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index c2e948c2..7c3a72c2 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -19,6 +19,7 @@ "filterColumn": "Filtrer par {column}", "command": "Commande", "copyName": "Copier le nom", + "copyDetails": "Copier les détails", "copyPath": "Copier le chemin", "openFileLocation": "Ouvrir l’emplacement du fichier", "goToProcess": "Accéder au processus", diff --git a/locales/fr-FR/settings.json b/locales/fr-FR/settings.json index 6f83e2aa..ac50516b 100644 --- a/locales/fr-FR/settings.json +++ b/locales/fr-FR/settings.json @@ -101,8 +101,8 @@ "ends": "Sélectionnez le premier/dernier élément", "expand": "Processus : réduire/développer un groupe ou une catégorie, ou sélectionner un parent/enfant", "details": "Processus : ouvrir les détails", - "copyName": "Processus : copier le nom de la sélection", - "copyDetails": "Processus : copier les détails de la sélection, tels que les affiche le volet Détails", + "copyName": "Copier le nom de la sélection, tel que l’affiche la colonne du nom", + "copyDetails": "Copier les détails de la sélection : pour un processus, comme dans le volet Détails ; dans les autres listes, toutes les colonnes affichées", "endTable": "Processus : terminer la sélection, avec confirmation", "endDirect": "Processus : terminer la sélection sans confirmation", "clear": "Effacer la sélection ; effacez d’abord la recherche de processus si elle est active.", diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index 0e09e0a8..be0f1105 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -19,6 +19,7 @@ "filterColumn": "「{column}」で絞り込む", "command": "コマンド", "copyName": "名前をコピー", + "copyDetails": "詳細をコピー", "copyPath": "パスをコピー", "openFileLocation": "ファイルの場所を開く", "goToProcess": "プロセスに移動", diff --git a/locales/ja-JP/settings.json b/locales/ja-JP/settings.json index 75fbab91..aa664b79 100644 --- a/locales/ja-JP/settings.json +++ b/locales/ja-JP/settings.json @@ -101,8 +101,8 @@ "ends": "最初/最後の項目を選択", "expand": "プロセス:グループまたはカテゴリを折りたたむ/展開する、または親/子を選択する", "details": "プロセス:詳細を開く", - "copyName": "プロセス:選択項目の名前をコピー", - "copyDetails": "プロセス:選択項目の詳細を詳細ペインと同じ内容でコピー", + "copyName": "選択項目の名前を名前列の表示どおりにコピー", + "copyDetails": "選択項目の詳細をコピー(プロセスは詳細ペインと同じ内容、その他の一覧は表示中のすべての列)", "endTable": "プロセス一覧:確認後に選択項目を終了", "endDirect": "プロセス一覧:確認を省略して選択項目を終了", "clear": "選択をクリアします。プロセス検索がアクティブな場合は、最初にそれをクリアします。", diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 86104e7a..4bf8e13b 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -19,6 +19,7 @@ "filterColumn": "Фильтр по столбцу «{column}»", "command": "Команда", "copyName": "Копировать имя", + "copyDetails": "Копировать сведения", "copyPath": "Копировать путь", "openFileLocation": "Открыть папку с файлом", "goToProcess": "Перейти к процессу", diff --git a/locales/ru-RU/settings.json b/locales/ru-RU/settings.json index 19bd1768..5c0ca198 100644 --- a/locales/ru-RU/settings.json +++ b/locales/ru-RU/settings.json @@ -101,8 +101,8 @@ "ends": "Выбор первого/последнего элемента", "expand": "Процессы: свернуть/развернуть группу или категорию или выбрать родительский/дочерний элемент", "details": "Процессы: открыть сведения", - "copyName": "Процессы: копировать имя выбранного элемента", - "copyDetails": "Процессы: копировать сведения о выбранном элементе в том виде, в каком их показывает панель сведений", + "copyName": "Копировать имя выбранного элемента так, как его показывает столбец имени", + "copyDetails": "Копировать сведения о выбранном элементе: у процесса — как в панели сведений, в других списках — все показанные столбцы", "endTable": "Процессы: завершить выбранные элементы с подтверждением", "endDirect": "Процессы: завершить выбранные элементы без подтверждения", "clear": "Снять выделение; если активен поиск процессов, сначала очистить его.", diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index b33c448d..a8c1ba2a 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -19,6 +19,7 @@ "filterColumn": "按“{column}”筛选", "command": "命令", "copyName": "复制名称", + "copyDetails": "复制详细信息", "copyPath": "复制路径", "openFileLocation": "打开文件位置", "goToProcess": "转到进程", diff --git a/locales/zh-CN/settings.json b/locales/zh-CN/settings.json index 25f83b89..31ebabfb 100644 --- a/locales/zh-CN/settings.json +++ b/locales/zh-CN/settings.json @@ -101,8 +101,8 @@ "ends": "选择第一项 / 最后一项", "expand": "进程列表:折叠 / 展开进程组或分组,或选择父项 / 子项", "details": "进程列表:打开详细信息", - "copyName": "进程列表:复制选中项的名称", - "copyDetails": "进程列表:复制选中项的详细信息,内容与详细信息面板一致", + "copyName": "复制选中项的名称,与名称列显示的一致", + "copyDetails": "复制选中项的详细信息:进程与详细信息面板一致,其他列表为显示的各列", "endTable": "进程列表:结束选中项,操作前确认", "endDirect": "进程列表:直接结束选中项,跳过确认", "clear": "取消选择;进程列表有搜索条件时先清空搜索。", diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index 1f9a343e..4b8f09b4 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -19,6 +19,7 @@ "filterColumn": "依「{column}」篩選", "command": "命令", "copyName": "複製名稱", + "copyDetails": "複製詳細資料", "copyPath": "複製路徑", "openFileLocation": "開啟檔案位置", "goToProcess": "移至處理程序", diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json index c3c27e71..2181a1aa 100644 --- a/locales/zh-TW/settings.json +++ b/locales/zh-TW/settings.json @@ -79,8 +79,8 @@ "ends": "選取第一項 / 最後一項", "expand": "處理程序清單:摺疊 / 展開處理程序群組或分組,或選取父項 / 子項", "details": "處理程序清單:開啟詳細資料", - "copyName": "處理程序清單:複製選取項目的名稱", - "copyDetails": "處理程序清單:複製選取項目的詳細資料,內容與詳細資料窗格一致", + "copyName": "複製選取項目的名稱,與名稱欄顯示的一致", + "copyDetails": "複製選取項目的詳細資料:處理程序與詳細資料窗格一致,其他清單為顯示的各欄", "endTable": "處理程序清單:結束選取項目,操作前確認", "endDirect": "處理程序清單:直接結束選取項目,略過確認", "clear": "取消選取;處理程序清單有搜尋條件時先清除搜尋。", diff --git a/src-gpui/src/frontend.rs b/src-gpui/src/frontend.rs index 0cec8cac..9dac08f9 100644 --- a/src-gpui/src/frontend.rs +++ b/src-gpui/src/frontend.rs @@ -15,6 +15,7 @@ mod icon_motion; mod inline; mod layout; mod leaks; +mod list_copy; mod lists; mod menus; mod model; diff --git a/src-gpui/src/frontend/backend.rs b/src-gpui/src/frontend/backend.rs index 62277a53..a577ab32 100644 --- a/src-gpui/src/frontend/backend.rs +++ b/src-gpui/src/frontend/backend.rs @@ -1198,9 +1198,11 @@ impl Desktop { cx.stop_propagation(); return; } - // Ctrl+C copies the selected process's name and Ctrl+Shift+C its + // Ctrl+C copies the selected row's name and Ctrl+Shift+C its // details, unless text is selected: the window copies that instead. - if self.page == "processes" + // A process's details are the details pane's, another list's the + // columns it shows (`list_copy`). + if list_copy::LISTS.contains(&self.page.as_str()) && key == "c" && m.control && !m.alt @@ -1211,8 +1213,13 @@ impl Desktop { .and_then(|index| self.rows.get(index)) .filter(|row| row.section.is_none()) { - let action = if m.shift { + let action = if m.shift && self.page == "processes" { Action::CopyDetails(row.key.clone()) + } else if m.shift { + let Some(details) = self.cells_text(row, cx) else { + return; + }; + Action::CopyAs(details, label("actions.copyWhat.details")) } else { Action::Copy(row.title.clone(), "actions.copyWhat.name") }; diff --git a/src-gpui/src/frontend/list_copy.rs b/src-gpui/src/frontend/list_copy.rs new file mode 100644 index 00000000..79d9d44d --- /dev/null +++ b/src-gpui/src/frontend/list_copy.rs @@ -0,0 +1,129 @@ +//! Copying from the service, startup and connection lists as the process +//! list does: Ctrl+C the selection's name, Ctrl+Shift+C its details, and a +//! right press on a cell offers that column's text. +//! +//! These lists have no details pane: their details are the columns the +//! table shows, read through the table so they keep its units and language. +use super::*; + +/// The lists whose rows copy their cells. The process list copies its own +/// details (`Desktop::details_text`) but shares the column copy. +pub(super) const LISTS: [&str; 4] = ["processes", "services", "startup", "network"]; + +/// Whether `page` copies its details from the table's cells. +pub(super) fn copies_cells(page: &str) -> bool { + LISTS.contains(&page) && page != "processes" +} + +/// The cells worth copying: text a reader can use, without empty cells or +/// the placeholder for a missing reading. +pub(super) fn cell_lines(cells: Vec<(String, String)>, missing: &str) -> Vec<(String, String)> { + cells + .into_iter() + .filter(|(_, value)| !value.trim().is_empty() && value != missing) + .collect() +} + +/// `lines` as text, each through `field` ("Name: value"), one per line as +/// the process details are. +pub(super) fn lines_text( + lines: &[(String, String)], + field: impl Fn(&str, &str) -> String, +) -> String { + lines + .iter() + .map(|(name, value)| field(name, value)) + .collect::>() + .join("\n") +} + +/// Where a row menu takes more copy items: after its last copy item (a copy +/// action, or the process list's copy submenu), else at its end. +pub(super) fn copy_position(items: &[MenuItem]) -> usize { + items + .iter() + .rposition(|item| { + matches!(item.action, Action::Copy(..) | Action::CopyAs(..)) + || (!item.children.is_empty() && item.icon == Some("CopyIcon")) + }) + .map_or(items.len(), |at| at + 1) +} + +impl Desktop { + /// The details of `row` on a list that copies its cells: every column + /// the table shows. None when there is nothing to copy. + pub(in crate::frontend) fn cells_text(&self, row: &Row, cx: &App) -> Option { + if !copies_cells(&self.page) || row.section.is_some() { + return None; + } + let lines = cell_lines(self.row_cells(row, cx), &label("format.missing")); + (!lines.is_empty()).then(|| { + lines_text(&lines, |name, value| { + tr!("details.copy.field", name = name, value = value) + }) + }) + } +} + +#[cfg(test)] +mod tests { + // Named imports keep the glob-imported GPUI `test` macro out of scope. + use super::{Action, MenuItem, cell_lines, copies_cells, copy_position, lines_text}; + + fn cell(name: &str, value: &str) -> (String, String) { + (name.into(), value.into()) + } + + #[test] + fn only_the_other_lists_copy_their_cells() { + for page in ["services", "startup", "network"] { + assert!(copies_cells(page)); + } + for page in ["processes", "performance", "history"] { + assert!(!copies_cells(page)); + } + } + + #[test] + fn details_leave_out_empty_and_missing_cells() { + let cells = vec![ + cell("Name", "Dnscache"), + cell("PID", ""), + cell("Description", " "), + cell("Publisher", "—"), + cell("Status", "Running"), + ]; + let lines = cell_lines(cells, "—"); + assert_eq!(lines, [cell("Name", "Dnscache"), cell("Status", "Running")]); + assert_eq!( + lines_text(&lines, |name, value| format!("{name}={value}")), + "Name=Dnscache\nStatus=Running" + ); + assert_eq!(lines_text(&[], |name, _| name.into()), ""); + } + + #[test] + fn copy_items_join_the_menu_after_its_last_copy() { + let item = |action| MenuItem::new("item", action); + let copy = || item(Action::Copy("x".into(), "actions.copyWhat.name")); + let menu = [ + item(Action::CloseOverlay), + copy(), + item(Action::CloseOverlay), + copy(), + MenuItem::separator(), + item(Action::CloseOverlay), + ]; + assert_eq!(copy_position(&menu), 4); + let submenu = [ + item(Action::CloseOverlay), + item(Action::CloseOverlay) + .icon("CopyIcon") + .submenu(vec![copy()]), + MenuItem::separator(), + ]; + assert_eq!(copy_position(&submenu), 2); + let none = [item(Action::CloseOverlay), MenuItem::separator()]; + assert_eq!(copy_position(&none), 2); + } +} diff --git a/src-gpui/src/frontend/menus.rs b/src-gpui/src/frontend/menus.rs index 23468984..6da5e20f 100644 --- a/src-gpui/src/frontend/menus.rs +++ b/src-gpui/src/frontend/menus.rs @@ -1091,16 +1091,40 @@ impl Desktop { } else if row.user.is_none() { return; } + // The other lists copy the cells shown as their details, taken now: + // a connection can leave the list while its menu is open. + let details = self.cells_text(&row, cx); + // Their name column is what Ctrl+C copies; it gets its own item, as + // the process list's copy submenu has "Name". + let first = tables::first_column(&self.page); + let name_cell = details + .is_some() + .then(|| self.cell_copy(&row, first, cx)) + .flatten(); let cell = column - .filter(|_| row.section.is_none() && self.page == "processes") + .filter(|key| { + row.section.is_none() + && list_copy::LISTS.contains(&self.page.as_str()) + && !(name_cell.is_some() && *key == first) + }) .and_then(|key| self.cell_copy(&row, key, cx)); let mut items = self.row_menu(&row); + // After the menu's own copy items: the name, the cell's copy, then + // the details. + let mut at = list_copy::copy_position(&items); + if let Some((name, value)) = name_cell { + items.insert( + at, + MenuItem::new( + tr!("processes.menu.copyColumn", column = &name), + Action::CopyAs(value, label("actions.copyWhat.name")), + ) + .icon("CopyIcon") + .hint("Ctrl+C"), + ); + at += 1; + } if let Some((name, value)) = cell { - // After the copy submenu, as the cell's own copy. - let at = items - .iter() - .position(|item| !item.children.is_empty() && item.icon == Some("CopyIcon")) - .map_or(items.len(), |at| at + 1); let nothing = value.is_empty() || value == label("format.missing"); items.insert( at, @@ -1110,6 +1134,18 @@ impl Desktop { ) .disabled(nothing), ); + at += 1; + } + if let Some(details) = details { + items.insert( + at, + MenuItem::new( + label("common.copyDetails"), + Action::CopyAs(details, label("actions.copyWhat.details")), + ) + .icon("CopyIcon") + .hint("Ctrl+Shift+C"), + ); } self.open_popup(items, window, cx); cx.notify(); diff --git a/src-gpui/src/frontend/tables.rs b/src-gpui/src/frontend/tables.rs index f90e4af8..ee58b7b6 100644 --- a/src-gpui/src/frontend/tables.rs +++ b/src-gpui/src/frontend/tables.rs @@ -2901,6 +2901,20 @@ impl Desktop { let field = delegate.fields.iter().find(|field| field.key == key)?; Some((field.label.clone(), display_cell(row, field, delegate.bits))) } + /// Every column of the current table with `row`'s cell in it, as the + /// table shows them. + pub(in crate::frontend) fn row_cells(&self, row: &Row, cx: &App) -> Vec<(String, String)> { + let Some(table) = self.table.as_ref() else { + return Vec::new(); + }; + let state = table.read(cx); + let delegate = state.delegate(); + delegate + .fields + .iter() + .map(|field| (field.label.clone(), display_cell(row, field, delegate.bits))) + .collect() + } /// Display names of the services running in each process, by PID. pub(in crate::frontend) fn hosted_services(&self) -> HashMap> { let mut hosted: HashMap> = HashMap::new(); From 6c14554908f563535e0726208f8691de5a540086 Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:14:25 +0700 Subject: [PATCH 2/8] =?UTF-8?q?fix(ui):=20=E6=9C=8D=E5=8A=A1=E3=80=81?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E4=B8=8E=E8=BF=9E=E6=8E=A5=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=A4=8D=E5=88=B6=E9=A1=B9=E6=94=B6=E8=BF=9B=E2=80=9C?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E2=80=9D=E5=AD=90=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此前新增的三项使服务菜单在 480 px 最小窗口高度下超出窗口,底部的置顶与备注无法选择。与进程列表一致,各页原有的复制项、名称(Ctrl+C)与详细信息(Ctrl+Shift+C)合为“复制”子菜单,位于原先第一个复制项的位置;所在列的复制仍紧随子菜单。服务菜单不在列上右键时与改动前等高。 --- locales/de-DE/common.json | 1 - locales/en-US/common.json | 1 - locales/es-ES/common.json | 1 - locales/fr-FR/common.json | 1 - locales/ja-JP/common.json | 1 - locales/ru-RU/common.json | 1 - locales/zh-CN/common.json | 1 - locales/zh-TW/common.json | 1 - src-gpui/src/frontend/list_copy.rs | 79 +++++++++++++++++++++++++++++- src-gpui/src/frontend/menus.rs | 43 +++++++--------- 10 files changed, 97 insertions(+), 33 deletions(-) diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index f1ee7048..237e52a6 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -19,7 +19,6 @@ "filterColumn": "Nach „{column}“ filtern", "command": "Befehl", "copyName": "Namen kopieren", - "copyDetails": "Details kopieren", "copyPath": "Pfad kopieren", "openFileLocation": "Dateipfad öffnen", "goToProcess": "Zum Prozess wechseln", diff --git a/locales/en-US/common.json b/locales/en-US/common.json index c35750af..fa4d9a55 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -19,7 +19,6 @@ "filterColumn": "Filter by {column}", "command": "Command", "copyName": "Copy name", - "copyDetails": "Copy details", "copyPath": "Copy path", "openFileLocation": "Open file location", "goToProcess": "Go to process", diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index d4aadfca..aa65e142 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -19,7 +19,6 @@ "filterColumn": "Filtrar por {column}", "command": "Comando", "copyName": "Copiar nombre", - "copyDetails": "Copiar detalles", "copyPath": "Copiar ruta", "openFileLocation": "Abrir ubicación del archivo", "goToProcess": "Ir al proceso", diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index 7c3a72c2..c2e948c2 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -19,7 +19,6 @@ "filterColumn": "Filtrer par {column}", "command": "Commande", "copyName": "Copier le nom", - "copyDetails": "Copier les détails", "copyPath": "Copier le chemin", "openFileLocation": "Ouvrir l’emplacement du fichier", "goToProcess": "Accéder au processus", diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index be0f1105..0e09e0a8 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -19,7 +19,6 @@ "filterColumn": "「{column}」で絞り込む", "command": "コマンド", "copyName": "名前をコピー", - "copyDetails": "詳細をコピー", "copyPath": "パスをコピー", "openFileLocation": "ファイルの場所を開く", "goToProcess": "プロセスに移動", diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 4bf8e13b..86104e7a 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -19,7 +19,6 @@ "filterColumn": "Фильтр по столбцу «{column}»", "command": "Команда", "copyName": "Копировать имя", - "copyDetails": "Копировать сведения", "copyPath": "Копировать путь", "openFileLocation": "Открыть папку с файлом", "goToProcess": "Перейти к процессу", diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index a8c1ba2a..b33c448d 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -19,7 +19,6 @@ "filterColumn": "按“{column}”筛选", "command": "命令", "copyName": "复制名称", - "copyDetails": "复制详细信息", "copyPath": "复制路径", "openFileLocation": "打开文件位置", "goToProcess": "转到进程", diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index 4b8f09b4..1f9a343e 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -19,7 +19,6 @@ "filterColumn": "依「{column}」篩選", "command": "命令", "copyName": "複製名稱", - "copyDetails": "複製詳細資料", "copyPath": "複製路徑", "openFileLocation": "開啟檔案位置", "goToProcess": "移至處理程序", diff --git a/src-gpui/src/frontend/list_copy.rs b/src-gpui/src/frontend/list_copy.rs index 79d9d44d..b50cd5ee 100644 --- a/src-gpui/src/frontend/list_copy.rs +++ b/src-gpui/src/frontend/list_copy.rs @@ -49,6 +49,36 @@ pub(super) fn copy_position(items: &[MenuItem]) -> usize { .map_or(items.len(), |at| at + 1) } +/// Whether a menu item copies text. +fn is_copy(item: &MenuItem) -> bool { + matches!(item.action, Action::Copy(..) | Action::CopyAs(..)) +} + +/// `items` with their copy items and `more` in one "Copy" submenu (`title`), +/// as the process list's menu has it: where the first copy item was, else +/// at the end. A long menu then keeps its height in a short window. +pub(super) fn gather_copies( + items: Vec, + more: Vec, + title: String, +) -> Vec { + let at = items.iter().position(is_copy); + let (mut copies, mut rest): (Vec<_>, Vec<_>) = items.into_iter().partition(is_copy); + for copy in &mut copies { + // Submenu entries go without the icon the menu gives the submenu. + copy.icon = None; + } + copies.extend(more); + let at = at.unwrap_or(rest.len()); + rest.insert( + at, + MenuItem::new(title, Action::CloseOverlay) + .icon("CopyIcon") + .submenu(copies), + ); + rest +} + impl Desktop { /// The details of `row` on a list that copies its cells: every column /// the table shows. None when there is nothing to copy. @@ -68,7 +98,54 @@ impl Desktop { #[cfg(test)] mod tests { // Named imports keep the glob-imported GPUI `test` macro out of scope. - use super::{Action, MenuItem, cell_lines, copies_cells, copy_position, lines_text}; + use super::{ + Action, MenuItem, cell_lines, copies_cells, copy_position, gather_copies, lines_text, + }; + + #[test] + fn copies_gather_in_one_submenu_where_the_first_was() { + let item = |label: &str, action| MenuItem::new(label, action); + let copy = |label: &str| { + item(label, Action::Copy("x".into(), "actions.copyWhat.name")).icon("CopyIcon") + }; + let menu = vec![ + item("start", Action::CloseOverlay), + item("open", Action::CloseOverlay), + copy("service name"), + MenuItem::separator(), + item("delete", Action::CloseOverlay), + copy("late copy"), + ]; + let more = vec![ + item("display name", Action::CopyAs("y".into(), "name".into())), + MenuItem::separator(), + item("details", Action::CopyAs("z".into(), "details".into())), + ]; + let menu = gather_copies(menu, more, "Copy".into()); + let labels: Vec<_> = menu.iter().map(|item| item.label.as_str()).collect(); + assert_eq!(labels, ["start", "open", "Copy", "", "delete"]); + let submenu = &menu[2]; + assert_eq!(submenu.icon, Some("CopyIcon")); + let children: Vec<_> = submenu + .children + .iter() + .map(|item| item.label.as_str()) + .collect(); + assert_eq!( + children, + ["service name", "late copy", "display name", "", "details"] + ); + assert!(submenu.children.iter().all(|child| child.icon.is_none())); + // The cell's own copy then follows the submenu. + assert_eq!(copy_position(&menu), 3); + // A menu without copies takes the submenu at its end. + let plain = gather_copies( + vec![item("a", Action::CloseOverlay)], + Vec::new(), + "Copy".into(), + ); + assert_eq!(plain.last().map(|item| item.label.as_str()), Some("Copy")); + } fn cell(name: &str, value: &str) -> (String, String) { (name.into(), value.into()) diff --git a/src-gpui/src/frontend/menus.rs b/src-gpui/src/frontend/menus.rs index 6da5e20f..43b25563 100644 --- a/src-gpui/src/frontend/menus.rs +++ b/src-gpui/src/frontend/menus.rs @@ -1109,43 +1109,38 @@ impl Desktop { }) .and_then(|key| self.cell_copy(&row, key, cx)); let mut items = self.row_menu(&row); - // After the menu's own copy items: the name, the cell's copy, then - // the details. - let mut at = list_copy::copy_position(&items); - if let Some((name, value)) = name_cell { - items.insert( - at, + // The other lists gather their copies in one submenu, as the process + // list does, so the menu keeps its height: the page's own copies, + // then the name (Ctrl+C) and the details (Ctrl+Shift+C). + if let Some(details) = details { + let mut more = Vec::new(); + if let Some((name, value)) = name_cell { + more.push( + MenuItem::new(name, Action::CopyAs(value, label("actions.copyWhat.name"))) + .hint("Ctrl+C"), + ); + } + more.push(MenuItem::separator()); + more.push( MenuItem::new( - tr!("processes.menu.copyColumn", column = &name), - Action::CopyAs(value, label("actions.copyWhat.name")), + label("processes.menu.details"), + Action::CopyAs(details, label("actions.copyWhat.details")), ) - .icon("CopyIcon") - .hint("Ctrl+C"), + .hint("Ctrl+Shift+C"), ); - at += 1; + items = list_copy::gather_copies(items, more, label("common.edit.copy")); } + // The cell's own copy follows the copy submenu. if let Some((name, value)) = cell { let nothing = value.is_empty() || value == label("format.missing"); items.insert( - at, + list_copy::copy_position(&items), MenuItem::new( tr!("processes.menu.copyColumn", column = &name), Action::CopyAs(value, tr!("processes.menu.columnWhat", column = &name)), ) .disabled(nothing), ); - at += 1; - } - if let Some(details) = details { - items.insert( - at, - MenuItem::new( - label("common.copyDetails"), - Action::CopyAs(details, label("actions.copyWhat.details")), - ) - .icon("CopyIcon") - .hint("Ctrl+Shift+C"), - ); } self.open_popup(items, window, cx); cx.notify(); From 27ecb3cd931e671254a741e682c3dcc6b24cb17f Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:27:47 +0700 Subject: [PATCH 3/8] =?UTF-8?q?fix(ui):=20=E2=80=9C=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E2=80=9D=E5=AD=90=E8=8F=9C=E5=8D=95=E4=B8=AD=E7=9A=84=E5=90=84?= =?UTF-8?q?=E9=A1=B9=E4=BB=A5=E5=88=97=E5=90=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 服务的“复制服务名称”与名称列项(服务)并列时看似重复。与进程列表的复制子菜单一致,子菜单中的各项改用对应的列名:服务为名称与服务,启动为命令,连接为本地地址与远程地址。移除不再使用的四个文案。 --- locales/de-DE/connections.json | 4 +--- locales/de-DE/services.json | 3 +-- locales/de-DE/startup.json | 4 +--- locales/en-US/connections.json | 4 +--- locales/en-US/services.json | 3 +-- locales/en-US/startup.json | 4 +--- locales/es-ES/connections.json | 4 +--- locales/es-ES/services.json | 3 +-- locales/es-ES/startup.json | 4 +--- locales/fr-FR/connections.json | 4 +--- locales/fr-FR/services.json | 3 +-- locales/fr-FR/startup.json | 4 +--- locales/ja-JP/connections.json | 4 +--- locales/ja-JP/services.json | 3 +-- locales/ja-JP/startup.json | 4 +--- locales/ru-RU/connections.json | 4 +--- locales/ru-RU/services.json | 3 +-- locales/ru-RU/startup.json | 4 +--- locales/zh-CN/connections.json | 4 +--- locales/zh-CN/services.json | 3 +-- locales/zh-CN/startup.json | 4 +--- locales/zh-TW/connections.json | 4 +--- locales/zh-TW/services.json | 3 +-- locales/zh-TW/startup.json | 4 +--- src-gpui/src/frontend/menus.rs | 8 ++++---- 25 files changed, 28 insertions(+), 68 deletions(-) diff --git a/locales/de-DE/connections.json b/locales/de-DE/connections.json index fc6ab77e..ec0d0902 100644 --- a/locales/de-DE/connections.json +++ b/locales/de-DE/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "{name} beenden", - "close": "Diese Verbindung schließen", - "copyLocal": "Lokale Adresse kopieren", - "copyRemote": "Remote-Adresse kopieren" + "close": "Diese Verbindung schließen" }, "copied": { "local": "lokale Adresse", diff --git a/locales/de-DE/services.json b/locales/de-DE/services.json index 6da7d498..08e876dc 100644 --- a/locales/de-DE/services.json +++ b/locales/de-DE/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Windows-Diensteverwaltung öffnen" }, "menu": { - "startType": "Starttyp: {type}", - "copyName": "Dienstnamen kopieren" + "startType": "Starttyp: {type}" }, "delete": { "title": "Dienst {name} löschen?", diff --git a/locales/de-DE/startup.json b/locales/de-DE/startup.json index e13666f5..18dd5b38 100644 --- a/locales/de-DE/startup.json +++ b/locales/de-DE/startup.json @@ -7,9 +7,7 @@ "commonFolder": "Startordner (alle Benutzer)", "package": "App-Paket (aktueller Benutzer)" }, - "menu": { - "copyCommand": "Befehl kopieren" - }, + "menu": {}, "delete": { "title": "Autostart-App {name} löschen?", "registry": "„{entry}“ wird aus {location} entfernt. Dies kann nicht rückgängig gemacht werden; das Programm selbst bleibt erhalten.", diff --git a/locales/en-US/connections.json b/locales/en-US/connections.json index 75959a40..5e5243e5 100644 --- a/locales/en-US/connections.json +++ b/locales/en-US/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "End {name}", - "close": "Close this connection", - "copyLocal": "Copy local address", - "copyRemote": "Copy remote address" + "close": "Close this connection" }, "copied": { "local": "local address", diff --git a/locales/en-US/services.json b/locales/en-US/services.json index 2ec79dc9..752c5638 100644 --- a/locales/en-US/services.json +++ b/locales/en-US/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Open the Windows Services console" }, "menu": { - "startType": "Startup type: {type}", - "copyName": "Copy service name" + "startType": "Startup type: {type}" }, "delete": { "title": "Delete service {name}?", diff --git a/locales/en-US/startup.json b/locales/en-US/startup.json index 905a521a..c8346fdb 100644 --- a/locales/en-US/startup.json +++ b/locales/en-US/startup.json @@ -7,9 +7,7 @@ "commonFolder": "Startup folder (all users)", "package": "App package (current user)" }, - "menu": { - "copyCommand": "Copy command" - }, + "menu": {}, "delete": { "title": "Delete startup app {name}?", "registry": "“{entry}” will be removed from {location}. This cannot be undone; the program itself is kept.", diff --git a/locales/es-ES/connections.json b/locales/es-ES/connections.json index 900ac3e2..0858f390 100644 --- a/locales/es-ES/connections.json +++ b/locales/es-ES/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "Finalizar {name}", - "close": "Cerrar esta conexión", - "copyLocal": "Copiar dirección local", - "copyRemote": "Copiar dirección remota" + "close": "Cerrar esta conexión" }, "copied": { "local": "dirección local", diff --git a/locales/es-ES/services.json b/locales/es-ES/services.json index 7815acc5..86ce44a5 100644 --- a/locales/es-ES/services.json +++ b/locales/es-ES/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Abrir la consola de Servicios de Windows" }, "menu": { - "startType": "Tipo de inicio: {type}", - "copyName": "Copiar nombre del servicio" + "startType": "Tipo de inicio: {type}" }, "delete": { "title": "¿Eliminar el servicio {name}?", diff --git a/locales/es-ES/startup.json b/locales/es-ES/startup.json index 1e23e238..d1d3a2e5 100644 --- a/locales/es-ES/startup.json +++ b/locales/es-ES/startup.json @@ -7,9 +7,7 @@ "commonFolder": "Carpeta de inicio (todos los usuarios)", "package": "Paquete de aplicación (usuario actual)" }, - "menu": { - "copyCommand": "Copiar comando" - }, + "menu": {}, "delete": { "title": "¿Eliminar la aplicación de inicio {name}?", "registry": "Se quitará «{entry}» de {location}. Esta acción no se puede deshacer; el programa se conserva.", diff --git a/locales/fr-FR/connections.json b/locales/fr-FR/connections.json index add82fb5..f3580361 100644 --- a/locales/fr-FR/connections.json +++ b/locales/fr-FR/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "Terminer {name}", - "close": "Fermer cette connexion", - "copyLocal": "Copier l’adresse locale", - "copyRemote": "Copier l’adresse distante" + "close": "Fermer cette connexion" }, "copied": { "local": "adresse locale", diff --git a/locales/fr-FR/services.json b/locales/fr-FR/services.json index ce819a49..74aab42c 100644 --- a/locales/fr-FR/services.json +++ b/locales/fr-FR/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Ouvrez la console des services Windows" }, "menu": { - "startType": "Type de démarrage : {type}", - "copyName": "Copier le nom du service" + "startType": "Type de démarrage : {type}" }, "delete": { "title": "Supprimer le service {name} ?", diff --git a/locales/fr-FR/startup.json b/locales/fr-FR/startup.json index 478d61e5..a065485a 100644 --- a/locales/fr-FR/startup.json +++ b/locales/fr-FR/startup.json @@ -7,9 +7,7 @@ "commonFolder": "Dossier de démarrage (tous les utilisateurs)", "package": "Package d’application (utilisateur actuel)" }, - "menu": { - "copyCommand": "Copier la commande" - }, + "menu": {}, "delete": { "title": "Supprimer l’application de démarrage {name} ?", "registry": "« {entry} » sera supprimé de {location}. Cette action est irréversible ; le programme lui-même est conservé.", diff --git a/locales/ja-JP/connections.json b/locales/ja-JP/connections.json index 1e46181d..b12d70a9 100644 --- a/locales/ja-JP/connections.json +++ b/locales/ja-JP/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "{name} を終了", - "close": "この接続を閉じる", - "copyLocal": "ローカルアドレスをコピー", - "copyRemote": "リモートアドレスをコピー" + "close": "この接続を閉じる" }, "copied": { "local": "ローカルアドレス", diff --git a/locales/ja-JP/services.json b/locales/ja-JP/services.json index d220728c..045d153a 100644 --- a/locales/ja-JP/services.json +++ b/locales/ja-JP/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Windows サービス コンソールを開きます" }, "menu": { - "startType": "スタートアップの種類:{type}", - "copyName": "サービス名をコピー" + "startType": "スタートアップの種類:{type}" }, "delete": { "title": "サービス {name} を削除しますか?", diff --git a/locales/ja-JP/startup.json b/locales/ja-JP/startup.json index 0db54a40..32a00e78 100644 --- a/locales/ja-JP/startup.json +++ b/locales/ja-JP/startup.json @@ -7,9 +7,7 @@ "commonFolder": "スタートアップフォルダー(全ユーザー)", "package": "アプリパッケージ(現在のユーザー)" }, - "menu": { - "copyCommand": "コマンドをコピー" - }, + "menu": {}, "delete": { "title": "スタートアップ アプリ {name} を削除しますか?", "registry": "{location} から「{entry}」を削除します。この操作は元に戻せません。プログラム自体は残ります。", diff --git a/locales/ru-RU/connections.json b/locales/ru-RU/connections.json index cc8ba909..0731db14 100644 --- a/locales/ru-RU/connections.json +++ b/locales/ru-RU/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "Завершить {name}", - "close": "Закрыть это подключение", - "copyLocal": "Копировать локальный адрес", - "copyRemote": "Копировать удалённый адрес" + "close": "Закрыть это подключение" }, "copied": { "local": "локальный адрес", diff --git a/locales/ru-RU/services.json b/locales/ru-RU/services.json index bbdc4f05..b94306e9 100644 --- a/locales/ru-RU/services.json +++ b/locales/ru-RU/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "Открыть консоль служб Windows" }, "menu": { - "startType": "Тип запуска: {type}", - "copyName": "Копировать название службы" + "startType": "Тип запуска: {type}" }, "delete": { "title": "Удалить службу {name}?", diff --git a/locales/ru-RU/startup.json b/locales/ru-RU/startup.json index bb0010c2..00519611 100644 --- a/locales/ru-RU/startup.json +++ b/locales/ru-RU/startup.json @@ -7,9 +7,7 @@ "commonFolder": "Папка автозагрузки (все пользователи)", "package": "Пакет приложения (текущий пользователь)" }, - "menu": { - "copyCommand": "Копировать команду" - }, + "menu": {}, "delete": { "title": "Удалить элемент автозагрузки {name}?", "registry": "Запись «{entry}» будет удалена ({location}). Это действие нельзя отменить; сама программа сохранится.", diff --git a/locales/zh-CN/connections.json b/locales/zh-CN/connections.json index cb5fef28..f3e42be2 100644 --- a/locales/zh-CN/connections.json +++ b/locales/zh-CN/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "结束 {name}", - "close": "断开此连接", - "copyLocal": "复制本地地址", - "copyRemote": "复制远程地址" + "close": "断开此连接" }, "copied": { "local": "本地地址", diff --git a/locales/zh-CN/services.json b/locales/zh-CN/services.json index bcd16a20..64e92614 100644 --- a/locales/zh-CN/services.json +++ b/locales/zh-CN/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "打开 Windows 服务管理器" }, "menu": { - "startType": "启动类型:{type}", - "copyName": "复制服务名称" + "startType": "启动类型:{type}" }, "delete": { "title": "删除服务 {name}?", diff --git a/locales/zh-CN/startup.json b/locales/zh-CN/startup.json index 3ae64b94..7421824b 100644 --- a/locales/zh-CN/startup.json +++ b/locales/zh-CN/startup.json @@ -7,9 +7,7 @@ "commonFolder": "启动文件夹(所有用户)", "package": "应用包(当前用户)" }, - "menu": { - "copyCommand": "复制命令" - }, + "menu": {}, "delete": { "title": "删除启动项 {name}?", "registry": "将从{location}中删除“{entry}”,此操作无法撤销;程序本身保留。", diff --git a/locales/zh-TW/connections.json b/locales/zh-TW/connections.json index 1800c5c7..09667e83 100644 --- a/locales/zh-TW/connections.json +++ b/locales/zh-TW/connections.json @@ -31,9 +31,7 @@ }, "menu": { "end": "結束 {name}", - "close": "中斷此連線", - "copyLocal": "複製本機位址", - "copyRemote": "複製遠端位址" + "close": "中斷此連線" }, "copied": { "local": "本機位址", diff --git a/locales/zh-TW/services.json b/locales/zh-TW/services.json index 9081f39a..ea8d8b9f 100644 --- a/locales/zh-TW/services.json +++ b/locales/zh-TW/services.json @@ -29,8 +29,7 @@ "openConsoleTitle": "開啟 Windows 服務管理員" }, "menu": { - "startType": "啟動類型:{type}", - "copyName": "複製服務名稱" + "startType": "啟動類型:{type}" }, "delete": { "title": "刪除服務 {name}?", diff --git a/locales/zh-TW/startup.json b/locales/zh-TW/startup.json index 41dfac71..fa7b0993 100644 --- a/locales/zh-TW/startup.json +++ b/locales/zh-TW/startup.json @@ -7,9 +7,7 @@ "commonFolder": "啟動資料夾(所有使用者)", "package": "應用程式套件(目前使用者)" }, - "menu": { - "copyCommand": "複製命令" - }, + "menu": {}, "delete": { "title": "刪除啟動項目 {name}?", "registry": "將從{location}中刪除「{entry}」,此操作無法復原;程式本身會保留。", diff --git a/src-gpui/src/frontend/menus.rs b/src-gpui/src/frontend/menus.rs index 43b25563..4d3845d9 100644 --- a/src-gpui/src/frontend/menus.rs +++ b/src-gpui/src/frontend/menus.rs @@ -1212,7 +1212,7 @@ impl Desktop { .icon("FolderIcon") .disabled(!boolean(raw, "exists") || path.is_none()), MenuItem::new( - label("startup.menu.copyCommand"), + label("common.command"), Action::Copy(text(raw, "command").into(), "startup.copied.command"), ) .icon("CopyIcon") @@ -1552,7 +1552,7 @@ impl Desktop { .icon("FolderIcon") .disabled(binary.is_none()), MenuItem::new( - label("services.menu.copyName"), + label("common.name"), Action::Copy(name.into(), "services.copied.name"), ) .icon("CopyIcon"), @@ -1619,7 +1619,7 @@ impl Desktop { .disabled(!closable), MenuItem::separator(), MenuItem::new( - label("connections.menu.copyLocal"), + label("connections.column.localAddress"), Action::Copy( endpoint(text(raw, "localAddress"), &raw["localPort"]), "connections.copied.local", @@ -1627,7 +1627,7 @@ impl Desktop { ) .icon("CopyIcon"), MenuItem::new( - label("connections.menu.copyRemote"), + label("connections.column.remoteAddress"), Action::Copy( remote .map(|r| endpoint(r, &raw["remotePort"])) From 47e795b46a41006a2a32d9c9bee0230993133572 Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:27:50 +0700 Subject: [PATCH 4/8] =?UTF-8?q?fix(ui):=20=E7=94=B1=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E7=9A=84=E8=A1=A8=E6=A0=BC=E8=A1=8C=E5=9C=A8?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E6=97=B6=E4=B9=9F=E8=AE=B0=E4=B8=8B=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 右键菜单的“复制“列名””依赖右键所在的列,此前只有 Argus 自绘的行记录该列;由组件绘制的行(ARGUS_TABLE_ROWS=component 或辅助功能启用时)不显示该项,进程列表同样受影响。现在单元格在右键按下时记下其列,先于行打开菜单。 --- src-gpui/src/frontend/tables.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src-gpui/src/frontend/tables.rs b/src-gpui/src/frontend/tables.rs index ee58b7b6..6fb8a057 100644 --- a/src-gpui/src/frontend/tables.rs +++ b/src-gpui/src/frontend/tables.rs @@ -1827,7 +1827,22 @@ impl TableDelegate for NativeTable { cx: &mut Context>, ) -> impl IntoElement { let content = self.td_content(row_index, column, window, cx); - self.gliding_cell(column, false, content) + let key = self.fields.get(column).map(|field| field.key); + // The row menu offers to copy the cell under the pointer. Rows Argus + // draws note it themselves (`body`); here the cell does, before the + // row's own right press opens the menu. + div() + .size_full() + .min_w_0() + .flex() + .items_center() + .on_mouse_down( + MouseButton::Right, + cx.listener(move |state, _: &MouseDownEvent, _, _| { + state.delegate_mut().context_column = key; + }), + ) + .child(self.gliding_cell(column, false, content)) } fn render_tr( &mut self, From 9d41881b68790e2b5be5dbb9a981cc1cf178de2e Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:41:19 +0700 Subject: [PATCH 5/8] =?UTF-8?q?fix(ui):=20=E6=9C=8D=E5=8A=A1=E3=80=81?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E4=B8=8E=E8=BF=9E=E6=8E=A5=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E2=80=9C=E5=A4=8D=E5=88=B6=E2=80=9C=E5=88=97=E5=90=8D?= =?UTF-8?q?=E2=80=9D=E2=80=9D=E7=A7=BB=E5=85=A5=E2=80=9C=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E2=80=9D=E5=AD=90=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 服务行已有备注时菜单多出“删除备注”,在 480 px 最小窗口高度下加上所在列的复制项仍会超出窗口。这三个列表的所在列复制项改为位于“复制”子菜单中的名称之后,菜单高度在任何状态下都与改动前相同;进程列表仍放在子菜单之后。 --- src-gpui/src/frontend/menus.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src-gpui/src/frontend/menus.rs b/src-gpui/src/frontend/menus.rs index 4d3845d9..def35d99 100644 --- a/src-gpui/src/frontend/menus.rs +++ b/src-gpui/src/frontend/menus.rs @@ -1109,9 +1109,18 @@ impl Desktop { }) .and_then(|key| self.cell_copy(&row, key, cx)); let mut items = self.row_menu(&row); - // The other lists gather their copies in one submenu, as the process - // list does, so the menu keeps its height: the page's own copies, - // then the name (Ctrl+C) and the details (Ctrl+Shift+C). + let column_item = |(name, value): (String, String)| { + let nothing = value.is_empty() || value == label("format.missing"); + MenuItem::new( + tr!("processes.menu.copyColumn", column = &name), + Action::CopyAs(value, tr!("processes.menu.columnWhat", column = &name)), + ) + .disabled(nothing) + }; + // The other lists gather their copies in one submenu, the clicked + // column's too, so the menu keeps its height whatever it holds (a + // note adds a row): the page's own copies, the name (Ctrl+C), the + // column, then the details (Ctrl+Shift+C). if let Some(details) = details { let mut more = Vec::new(); if let Some((name, value)) = name_cell { @@ -1120,6 +1129,7 @@ impl Desktop { .hint("Ctrl+C"), ); } + more.extend(cell.map(column_item)); more.push(MenuItem::separator()); more.push( MenuItem::new( @@ -1129,18 +1139,9 @@ impl Desktop { .hint("Ctrl+Shift+C"), ); items = list_copy::gather_copies(items, more, label("common.edit.copy")); - } - // The cell's own copy follows the copy submenu. - if let Some((name, value)) = cell { - let nothing = value.is_empty() || value == label("format.missing"); - items.insert( - list_copy::copy_position(&items), - MenuItem::new( - tr!("processes.menu.copyColumn", column = &name), - Action::CopyAs(value, tr!("processes.menu.columnWhat", column = &name)), - ) - .disabled(nothing), - ); + } else if let Some(cell) = cell { + // The process list's cell copy follows its copy submenu. + items.insert(list_copy::copy_position(&items), column_item(cell)); } self.open_popup(items, window, cx); cx.notify(); From 0787538e42902b2d04b028b4fd431186cdedfed6 Mon Sep 17 00:00:00 2001 From: digital-bombyx <225719517+digital-bombyx@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:41:22 +0700 Subject: [PATCH 6/8] =?UTF-8?q?fix(ui):=20=E5=A4=8D=E5=88=B6=20IPv6=20?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E5=8D=8F=E8=AE=AE=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E7=95=99=20v6=20=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 协议单元格将 v6 作为独立标记绘制,复制的文字只有 TCP 或 UDP,与 IPv4 连接无法区分。复制所在列与详细信息时改为 TCPv6、UDPv6,与协议筛选的名称一致。 --- src-gpui/src/frontend/tables.rs | 34 ++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src-gpui/src/frontend/tables.rs b/src-gpui/src/frontend/tables.rs index 6fb8a057..c5319743 100644 --- a/src-gpui/src/frontend/tables.rs +++ b/src-gpui/src/frontend/tables.rs @@ -434,6 +434,26 @@ fn entry_cell(raw: &Value, field: &Field) -> String { } } +/// What copying `row`'s cell in `field` gives: its text, with what the cell +/// draws apart from the text, such as an IPv6 connection's "v6" tag. +fn copied_cell(row: &Row, field: &Field, bits: bool) -> String { + let text = display_cell(row, field, bits); + if field.kind == CellKind::Protocol { + protocol_copy(text, boolean(&row.raw, "ipv6")) + } else { + text + } +} + +/// A protocol as copied: "TCPv6" for IPv6, as the protocol filter names it. +fn protocol_copy(protocol: String, ipv6: bool) -> String { + if ipv6 && !protocol.is_empty() { + format!("{protocol}v6") + } else { + protocol + } +} + fn display_cell(row: &Row, field: &Field, bits: bool) -> String { if field.kind == CellKind::NetworkRate { row.metric(field.key) @@ -2914,7 +2934,7 @@ impl Desktop { let state = self.table.as_ref()?.read(cx); let delegate = state.delegate(); let field = delegate.fields.iter().find(|field| field.key == key)?; - Some((field.label.clone(), display_cell(row, field, delegate.bits))) + Some((field.label.clone(), copied_cell(row, field, delegate.bits))) } /// Every column of the current table with `row`'s cell in it, as the /// table shows them. @@ -2927,7 +2947,7 @@ impl Desktop { delegate .fields .iter() - .map(|field| (field.label.clone(), display_cell(row, field, delegate.bits))) + .map(|field| (field.label.clone(), copied_cell(row, field, delegate.bits))) .collect() } /// Display names of the services running in each process, by PID. @@ -3280,9 +3300,17 @@ pub(super) fn descending_first(page: &str, key: &str) -> bool { mod tests { // Named imports keep the glob-imported GPUI `test` macro out of scope. use super::{ - Value, json, prefs, restore_sort, saved_filters, sort_columns, sort_preference, sortable, + Value, json, prefs, protocol_copy, restore_sort, saved_filters, sort_columns, + sort_preference, sortable, }; + #[test] + fn copied_protocols_keep_the_ipv6_tag() { + assert_eq!(protocol_copy("TCP".into(), true), "TCPv6"); + assert_eq!(protocol_copy("UDP".into(), false), "UDP"); + assert_eq!(protocol_copy(String::new(), true), ""); + } + #[test] fn saved_orders_keep_persistent_column_ids() { // Values a preferences.json from the saved preferences holds. 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 7/8] =?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 8/8] =?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()); }