程序坞默认不再显示图标:主窗口开着也只在菜单栏运行,通用设置可打开“在程序坞显示图标”

This commit is contained in:
gentpan committed 2026-09-17 21:39:34 +05:00
1 parent 76e7427dfe
commit 33baa71470
11 files changed
+55 -29

No files matched your search

+3 -2
View File
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="394" height="156" viewBox="0 0 394 156" role="img">
<title>56 commits in the last 26 weeks</title>
<title>68 commits in the last 26 weeks</title>
<g font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,PingFang SC,sans-serif" font-size="9" fill="#8b949e">
<text x="58" y="12">Apr</text>
<text x="114" y="12">May</text>
@@ -189,8 +189,9 @@
<rect x="380" y="18" width="11" height="11" rx="2" fill="#216e39"><title>42 commits on 2026-09-13</title></rect>
<rect x="380" y="32" width="11" height="11" rx="2" fill="#9be9a8"><title>2 commits on 2026-09-14</title></rect>
<rect x="380" y="46" width="11" height="11" rx="2" fill="#40c463"><title>12 commits on 2026-09-15</title></rect>
<rect x="380" y="60" width="11" height="11" rx="2" fill="#40c463"><title>12 commits on 2026-09-16</title></rect>
<g font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,PingFang SC,sans-serif" font-size="10" fill="#8b949e">
<text x="30" y="146">56 commits in the last 26 weeks · through 2026-09-15</text>
<text x="30" y="146">68 commits in the last 26 weeks · through 2026-09-16</text>
<text x="286" y="130" text-anchor="end">Less</text>
<rect x="290" y="120" width="11" height="11" rx="2" fill="rgba(139,148,158,0.18)"/>
<rect x="304" y="120" width="11" height="11" rx="2" fill="#9be9a8"/>

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

+3 -2
View File
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="394" height="156" viewBox="0 0 394 156" role="img">
<title>近 26 周共 56 次提交</title>
<title>近 26 周共 68 次提交</title>
<g font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,PingFang SC,sans-serif" font-size="9" fill="#8b949e">
<text x="58" y="12">4月</text>
<text x="114" y="12">5月</text>
@@ -189,8 +189,9 @@
<rect x="380" y="18" width="11" height="11" rx="2" fill="#216e39"><title>2026-09-13:42 次提交</title></rect>
<rect x="380" y="32" width="11" height="11" rx="2" fill="#9be9a8"><title>2026-09-14:2 次提交</title></rect>
<rect x="380" y="46" width="11" height="11" rx="2" fill="#40c463"><title>2026-09-15:12 次提交</title></rect>
<rect x="380" y="60" width="11" height="11" rx="2" fill="#40c463"><title>2026-09-16:12 次提交</title></rect>
<g font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,PingFang SC,sans-serif" font-size="10" fill="#8b949e">
<text x="30" y="146">近 26 周共 56 次提交 · 截至 2026-09-15</text>
<text x="30" y="146">近 26 周共 68 次提交 · 截至 2026-09-16</text>
<text x="286" y="130" text-anchor="end">少</text>
<rect x="290" y="120" width="11" height="11" rx="2" fill="rgba(139,148,158,0.18)"/>
<rect x="304" y="120" width="11" height="11" rx="2" fill="#9be9a8"/>

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

+8
View File
@@ -3,6 +3,14 @@
记录 OpenStats 应用的功能新增、样式调整和问题修复,按版本与日期倒序排列。
官网、构建与发布脚本等不影响应用本身的改动不在此记录。
## 未发布
### 2026-09-17
#### 调整
- 程序坞默认不再显示 OpenStats 图标:以前打开主窗口(比如从风扇弹窗进入温度与风扇页)时,图标会出现在程序坞与 ⌘Tab 里,关窗后才消失。现在和其他菜单栏工具一样始终只在菜单栏运行,主窗口照常打开并置于最前。想从程序坞或 ⌘Tab 切回主窗口的,可以在「设置 · 通用」打开“在程序坞显示图标”,开关立即生效。
## 0.4.0 · 2026-09-16
### 2026-09-16
@@ -372,6 +372,7 @@ npm 缓存 npm Cache
圆环表示当前占用比例 A ring shows current usage
在 cleanip.io 查看这个 IP 的完整报告 Open this IP's full report on cleanip.io
在主窗口打开“{}” Open “{}” in the main window
在程序坞显示图标 Show Icon in Dock
在线升级 Online Updates
在线升级:发现新版本时显示更新摘要,一键安装并自动重启 Online updates: see what's new, install in one click and relaunch automatically
在菜单栏显示 Show in Menu Bar
@@ -1030,6 +1031,7 @@ npm 缓存 npm Cache
高负载 Heavy load
高负载时着色 Color High Load
高风险 High risk
默认只在菜单栏运行;打开后,主窗口开着时图标出现在程序坞与 ⌘Tab 中 OpenStats lives in the menu bar by default. Turn this on to show its icon in the Dock and ⌘Tab while the main window is open
({}) ({})
, ,
,{} 项未能移动 , {} couldn't be moved
@@ -159,10 +159,10 @@ public final class AppController: NSObject, NSApplicationDelegate {
updateTimer?.tolerance = 5 * 60
}
/// 有窗口打开时显示在程序坞与 ⌘Tab 里,全部关闭后回到仅菜单栏
/// 默认只在菜单栏运行、不占程序坞;打开了“在程序坞显示图标”时,有窗口开着才出现在程序坞与 ⌘Tab 里
private func updateActivationPolicy() {
let hasWindow = mainWindow.isVisible
let policy: NSApplication.ActivationPolicy = hasWindow ? .regular : .accessory
let policy: NSApplication.ActivationPolicy = hasWindow && model.settings.showDockIcon ? .regular : .accessory
guard NSApp.activationPolicy() != policy else { return }
NSApp.setActivationPolicy(policy)
if hasWindow { NSApp.activate() }
@@ -186,6 +186,7 @@ public final class AppController: NSObject, NSApplicationDelegate {
_ = model.settings.expandedPopoverSections
_ = model.keepAwake.isActive
_ = model.settings.appearance
_ = model.settings.showDockIcon
_ = model.isNetworkDetailVisible
_ = model.settings.probeEnabled
_ = model.settings.probeInBackground
@@ -199,6 +200,7 @@ public final class AppController: NSObject, NSApplicationDelegate {
await self.model.hub.update(self.model.demand)
self.model.bluetooth.setDemand(self.model.bluetoothDemand)
self.applyAppearance()
self.updateActivationPolicy()
self.menuBar.update()
self.menuBar.refreshPopoverHeight()
self.updateNetworkVisibility()
@@ -1,7 +1,7 @@
import AppKit
import SwiftUI
/// 主窗口。打开时应用出现在程序坞与 ⌘Tab 中,关闭后回到仅菜单栏运行
/// 主窗口。应用默认只在菜单栏运行,窗口开着也不占程序坞;设置里打开“在程序坞显示图标”后才出现在程序坞与 ⌘Tab 中
@MainActor
final class MainWindowController: NSObject, NSWindowDelegate {
private let model: AppModel
@@ -73,6 +73,11 @@ struct GeneralSettings: View {
label: tr("登录时启动"))
}
}
GroupRow {
SettingRow(title: tr("在程序坞显示图标"), subtitle: tr("默认只在菜单栏运行;打开后,主窗口开着时图标出现在程序坞与 ⌘Tab 中")) {
DSToggle(isOn: $settings.showDockIcon, label: tr("在程序坞显示图标"))
}
}
GroupRow {
SettingRow(title: tr("刷新频率"), subtitle: tr("只显示菜单栏时的采样间隔;打开弹窗或主窗口时为 1 秒(进程页 2 秒)")) {
SegmentedControl(selection: $settings.refreshSeconds,
@@ -421,6 +421,10 @@ public final class AppSettings {
public var appearance: AppearanceMode {
didSet { defaults.set(appearance.rawValue, forKey: Keys.appearance) }
}
/// 主窗口开着时在程序坞与 ⌘Tab 中显示图标;默认关闭,和其他菜单栏工具一样只在菜单栏运行
public var showDockIcon: Bool {
didSet { defaults.set(showDockIcon, forKey: Keys.showDockIcon) }
}
public var menuBarLayout: MenuBarLayout {
didSet { defaults.set(menuBarLayout.rawValue, forKey: Keys.menuBarLayout) }
}
@@ -520,6 +524,7 @@ public final class AppSettings {
? defaults.integer(forKey: Keys.fanSafetyTemperature) : 95
panelTab = defaults.string(forKey: Keys.panelTab).flatMap(PanelTab.init(rawValue:)) ?? .overview
appearance = defaults.string(forKey: Keys.appearance).flatMap(AppearanceMode.init(rawValue:)) ?? .system
showDockIcon = defaults.bool(forKey: Keys.showDockIcon)
cleanPrefersTrash = defaults.bool(forKey: Keys.cleanPrefersTrash)
menuBarLayout = defaults.string(forKey: Keys.menuBarLayout).flatMap(MenuBarLayout.init(rawValue:)) ?? .separate
expandedPopoverSections = Set((defaults.stringArray(forKey: Keys.expandedPopoverSections) ?? []).compactMap(PopoverSection.init(rawValue:)))
@@ -590,6 +595,7 @@ public final class AppSettings {
static let fanSafetyTemperature = "fanSafetyTemperature"
static let panelTab = "panelTab"
static let appearance = "appearance"
static let showDockIcon = "showDockIcon"
static let cleanPrefersTrash = "cleanPrefersTrash"
static let menuBarLayout = "menuBarLayout"
static let hiddenPopoverSections = "hiddenPopoverSections"
@@ -17,6 +17,7 @@ public struct SettingsDocument: Codable, Equatable, Sendable {
public var lidModeBatteryFloor: Int?
public var fanSafetyTemperature: Int?
public var appearance: String?
public var showDockIcon: Bool?
public var menuBarLayout: String?
public var hiddenPopoverSections: [String]?
public var probeEnabled: Bool?
@@ -50,6 +51,7 @@ extension AppSettings {
doc.lidModeBatteryFloor = lidModeBatteryFloor
doc.fanSafetyTemperature = fanSafetyTemperature
doc.appearance = appearance.rawValue
doc.showDockIcon = showDockIcon
doc.menuBarLayout = menuBarLayout.rawValue
doc.hiddenPopoverSections = hiddenPopoverSections.map(\.rawValue).sorted()
doc.probeEnabled = probeEnabled
@@ -93,6 +95,7 @@ extension AppSettings {
assign(\.lidModeBatteryFloor, option(doc.lidModeBatteryFloor, in: Self.batteryFloorOptions))
assign(\.fanSafetyTemperature, option(doc.fanSafetyTemperature, in: Self.fanSafetyOptions))
assign(\.appearance, doc.appearance.flatMap(AppearanceMode.init(rawValue:)))
assign(\.showDockIcon, doc.showDockIcon)
assign(\.menuBarLayout, doc.menuBarLayout.flatMap(MenuBarLayout.init(rawValue:)))
assign(\.hiddenPopoverSections, doc.hiddenPopoverSections.map { Set($0.compactMap(PopoverSection.init(rawValue:))) })
assign(\.probeEnabled, doc.probeEnabled)
+10 -11
View File
@@ -59,9 +59,18 @@ system language by default; switch it in Settings → General → Language.
<!-- changelog:start -->
<!-- Generated from CHANGELOG.md by Scripts/sync_changelog.py. Do not edit by hand. -->
Latest release **0.4.0** (2026-09-16) · [full changelog](CHANGELOG.md) (kept in Chinese)
Latest release **0.4.0** (2026-09-16) · **1** changes in development · [full changelog](CHANGELOG.md) (kept in Chinese)
<details open>
<summary><b>2026-09-17</b> · Unreleased · 1 changed</summary>
**Changed**
- 程序坞默认不再显示 OpenStats 图标:以前打开主窗口(比如从风扇弹窗进入温度与风扇页)时,图标会出现在程序坞与 ⌘Tab 里,关窗后才消失。现在和其他菜单栏工具一样始终只在菜单栏运行,主窗口照常打开并置于最前。想从程序坞或 ⌘Tab 切回主窗口的,可以在「设置 · 通用」打开“在程序坞显示图标”,开关立即生效。
</details>
<details>
<summary><b>2026-09-16</b> · 0.4.0 · 1 fixed · 2 changed · 6 style · 1 added</summary>
**Fixed**
@@ -98,16 +107,6 @@ Latest release **0.4.0** (2026-09-16) · [full changelog](CHANGELOG.md) (kept in
</details>
<details>
<summary><b>2026-09-15</b> · 0.3.1 · 2 added</summary>
**Added**
- 支持 Intel 芯片的 Mac:分别发布 Apple 芯片版与 Intel 版安装包,官网与 Homebrew 按芯片提供下载(Homebrew 自动选择)。Intel 机型需要 macOS 14 Sonoma 或更高版本;用 Apple 智能解释进程只能在 Apple 芯片上使用,Intel 机型的 CPU 不分性能核与能效核,部分功耗与频率读数可能不显示。
- 在线升级按芯片下载对应的安装包,并在安装前核对安装包支持这台 Mac 的芯片;在 Apple 芯片上经 Rosetta 运行的 Intel 版会升级为 Apple 芯片版。
</details>
<!-- changelog:end -->
## Activity
+10 -11
View File
@@ -55,9 +55,18 @@ CPU 不分性能核与能效核,部分功耗与频率读数可能不显示。
<!-- changelog:start -->
<!-- 由 Scripts/sync_changelog.py 从 CHANGELOG.md 生成,请勿手改。 -->
最新版本 **0.4.0**(2026-09-16) · [完整更新日志](CHANGELOG.md)
最新版本 **0.4.0**(2026-09-16) · 开发中 **1** 项改动尚未发布 · [完整更新日志](CHANGELOG.md)
<details open>
<summary><b>2026-09-17</b> · 未发布 · 调整 1</summary>
**调整**
- 程序坞默认不再显示 OpenStats 图标:以前打开主窗口(比如从风扇弹窗进入温度与风扇页)时,图标会出现在程序坞与 ⌘Tab 里,关窗后才消失。现在和其他菜单栏工具一样始终只在菜单栏运行,主窗口照常打开并置于最前。想从程序坞或 ⌘Tab 切回主窗口的,可以在「设置 · 通用」打开“在程序坞显示图标”,开关立即生效。
</details>
<details>
<summary><b>2026-09-16</b> · 0.4.0 · 修复 1 · 调整 2 · 样式 6 · 新增 1</summary>
**修复**
@@ -94,16 +103,6 @@ CPU 不分性能核与能效核,部分功耗与频率读数可能不显示。
</details>
<details>
<summary><b>2026-09-15</b> · 0.3.1 · 新增 2</summary>
**新增**
- 支持 Intel 芯片的 Mac:分别发布 Apple 芯片版与 Intel 版安装包,官网与 Homebrew 按芯片提供下载(Homebrew 自动选择)。Intel 机型需要 macOS 14 Sonoma 或更高版本;用 Apple 智能解释进程只能在 Apple 芯片上使用,Intel 机型的 CPU 不分性能核与能效核,部分功耗与频率读数可能不显示。
- 在线升级按芯片下载对应的安装包,并在安装前核对安装包支持这台 Mac 的芯片;在 Apple 芯片上经 Rosetta 运行的 Intel 版会升级为 Apple 芯片版。
</details>
<!-- changelog:end -->
## 活跃度