style(menubar): 将底部操作改为一体式液态玻璃胶囊
This commit is contained in:
@@ -146,6 +146,8 @@ App 持有进程级 `KeepAwakeService`(Core/Services,MainActor + Observable
|
||||
|
||||
状态不持久化,重启默认关闭;关闭面板、暂停资源采样均不影响已开启的保持唤醒,无额外定时器、辅助进程或权限变更。主动锁屏、主动睡眠、合盖、低电量保护与管理策略仍由系统决定;独立屏保/自动锁定策略的实际行为需在用户环境验收,不以电源断言创建成功替代锁屏实测。
|
||||
|
||||
面板底部四个按钮统一透明背景与圆角矩形细边框,咖啡杯开启时使用当前强调色,并提供三语帮助及无障碍开关状态。
|
||||
面板底部四个按钮置于一个原生 `.glassEffect(.regular, in: .capsule)` 液态玻璃胶囊内,各按钮采用圆形悬停/按压反馈,退出按钮前有分隔线;咖啡杯开启时使用当前强调色,并提供三语帮助及无障碍开关状态。
|
||||
|
||||
2026-10-30 验证:Debug 构建通过;独立核心检查在普通进程与带主应用沙盒权限的临时 .app 中均通过,实际查询本进程断言,覆盖默认关闭、连续三次开关、开启后两类断言存在、关闭/服务销毁后消失。CLI 检查器直接加沙盒签名会在 libsecinit 初始化阶段退出,改用完整 .app 包后通过,未更改产品权限。当前没有 Xcode 测试 Target。UI 自动化 getApp 本轮构建超时;本轮仅退出自动化启动的测试副本,保留用户 Xcode 进程。底部实际视觉、关闭面板后长时间空闲不锁屏/息屏以及关闭开关后恢复系统策略,待用户验收。
|
||||
|
||||
底部液态玻璃样式调整:Debug 构建通过;实际面板中的玻璃质感及悬停视觉待用户重新运行验收。
|
||||
|
||||
@@ -196,29 +196,34 @@ struct MenuPanelView: View {
|
||||
.font(.system(size: 9)).foregroundStyle(.tertiary)
|
||||
}
|
||||
Spacer()
|
||||
Button { keepAwake.toggle() } label: {
|
||||
Image(systemName: keepAwake.isEnabled ? "cup.and.saucer.fill" : "cup.and.saucer")
|
||||
.frame(width: 20, height: 20)
|
||||
.foregroundStyle(keepAwake.isEnabled ? preferences.tintColor : Color.primary)
|
||||
HStack(spacing: 2) {
|
||||
Button { keepAwake.toggle() } label: {
|
||||
Image(systemName: keepAwake.isEnabled ? "cup.and.saucer.fill" : "cup.and.saucer")
|
||||
.frame(width: 20, height: 20)
|
||||
.foregroundStyle(keepAwake.isEnabled ? preferences.tintColor : Color.primary)
|
||||
}
|
||||
.help(keepAwake.didFail ? Text("awake.failed") : (keepAwake.isEnabled ? Text("awake.disable") : Text("awake.enable")))
|
||||
.accessibilityLabel(keepAwake.isEnabled ? Text("awake.disable") : Text("awake.enable"))
|
||||
.accessibilityValue(keepAwake.isEnabled ? Text("awake.on") : Text("awake.off"))
|
||||
Button { metrics.togglePause() } label: {
|
||||
Image(systemName: metrics.isPaused ? "play.fill" : "pause.fill").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
|
||||
.accessibilityLabel(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
|
||||
Button { NSApp.activate(); openSettings() } label: {
|
||||
Image(systemName: "gearshape").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(Text("action.settings")).accessibilityLabel(Text("action.settings"))
|
||||
Divider().frame(height: 18).padding(.horizontal, 3)
|
||||
Button { NSApp.terminate(nil) } label: {
|
||||
Image(systemName: "power").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(Text("action.quit")).accessibilityLabel(Text("action.quit"))
|
||||
}
|
||||
.help(keepAwake.didFail ? Text("awake.failed") : (keepAwake.isEnabled ? Text("awake.disable") : Text("awake.enable")))
|
||||
.accessibilityLabel(keepAwake.isEnabled ? Text("awake.disable") : Text("awake.enable"))
|
||||
.accessibilityValue(keepAwake.isEnabled ? Text("awake.on") : Text("awake.off"))
|
||||
Button { metrics.togglePause() } label: {
|
||||
Image(systemName: metrics.isPaused ? "play.fill" : "pause.fill").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
|
||||
.accessibilityLabel(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
|
||||
Button { NSApp.activate(); openSettings() } label: {
|
||||
Image(systemName: "gearshape").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(Text("action.settings")).accessibilityLabel(Text("action.settings"))
|
||||
Button { NSApp.terminate(nil) } label: {
|
||||
Image(systemName: "power").frame(width: 20, height: 20)
|
||||
}
|
||||
.help(Text("action.quit")).accessibilityLabel(Text("action.quit"))
|
||||
.buttonStyle(FooterButtonStyle())
|
||||
.padding(4)
|
||||
.glassEffect(.regular, in: .capsule)
|
||||
}
|
||||
.buttonStyle(FooterButtonStyle())
|
||||
.controlSize(.small)
|
||||
.padding(.horizontal, 8).padding(.vertical, 6)
|
||||
}
|
||||
@@ -227,13 +232,24 @@ struct MenuPanelView: View {
|
||||
|
||||
private struct FooterButtonStyle: ButtonStyle {
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
configuration.label
|
||||
.padding(.horizontal, 9).padding(.vertical, 6)
|
||||
.contentShape(RoundedRectangle(cornerRadius: 6))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 6)
|
||||
.strokeBorder(.primary.opacity(configuration.isPressed ? 0.5 : 0.18), lineWidth: 1)
|
||||
FooterButtonBody(isPressed: configuration.isPressed) {
|
||||
configuration.label
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct FooterButtonBody<Content: View>: View {
|
||||
let isPressed: Bool
|
||||
@ViewBuilder var content: () -> Content
|
||||
@State private var isHovered = false
|
||||
|
||||
var body: some View {
|
||||
content()
|
||||
.frame(width: 34, height: 34)
|
||||
.background {
|
||||
Circle().fill(.primary.opacity(isPressed ? 0.16 : (isHovered ? 0.08 : 0)))
|
||||
}
|
||||
.opacity(configuration.isPressed ? 0.6 : 1)
|
||||
.contentShape(Circle())
|
||||
.onHover { isHovered = $0 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user