Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions boringNotch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
B1F0A0022E60000100000001 /* BrightnessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F0A0012E60000100000001 /* BrightnessManager.swift */; };
B1FEB4992C7686630066EBBC /* PanGesture.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1FEB4982C7686630066EBBC /* PanGesture.swift */; };
F38DE6482D8243E7008B5C6D /* BatteryActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F38DE6472D8243E2008B5C6D /* BatteryActivityManager.swift */; };
E5A00004AAAA000000000004 /* SystemMonitorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00001AAAA000000000001 /* SystemMonitorManager.swift */; };
E5A00005AAAA000000000005 /* SystemMonitorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00002AAAA000000000002 /* SystemMonitorView.swift */; };
E5A00006AAAA000000000006 /* SystemMonitorSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00003AAAA000000000003 /* SystemMonitorSettingsView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -333,6 +336,9 @@
B1F0A0012E60000100000001 /* BrightnessManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrightnessManager.swift; sourceTree = "<group>"; };
B1FEB4982C7686630066EBBC /* PanGesture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanGesture.swift; sourceTree = "<group>"; };
F38DE6472D8243E2008B5C6D /* BatteryActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryActivityManager.swift; sourceTree = "<group>"; };
E5A00001AAAA000000000001 /* SystemMonitorManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemMonitorManager.swift; sourceTree = "<group>"; };
E5A00002AAAA000000000002 /* SystemMonitorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemMonitorView.swift; sourceTree = "<group>"; };
E5A00003AAAA000000000003 /* SystemMonitorSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemMonitorSettingsView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
Expand Down Expand Up @@ -530,6 +536,7 @@
11DB266F2EDD0CDF001EA0CF /* SettingsHelpers.swift */,
11DB26702EDD0CDF001EA0CF /* ShelfSettingsView.swift */,
11DB26712EDD0CDF001EA0CF /* ShortcutsSettingsView.swift */,
E5A00003AAAA000000000003 /* SystemMonitorSettingsView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -584,6 +591,7 @@
149E0B982C737D26006418B1 /* Webcam */,
B18654312C6F45AE000B926A /* Live activities */,
B18654302C6F4590000B926A /* Settings */,
E5A00007AAAA000000000001 /* SystemMonitor */,
B186542F2C6F455E000B926A /* Notch */,
9A0887332C7AFF7E00C160EA /* Tabs */,
B186542E2C6F453B000B926A /* Music */,
Expand All @@ -605,10 +613,19 @@
147163992C5D35FF0068B555 /* MusicManager.swift */,
149E0B962C737D00006418B1 /* WebcamManager.swift */,
14C08BB52C8DE42D000F8AA0 /* CalendarManager.swift */,
E5A00001AAAA000000000001 /* SystemMonitorManager.swift */,
);
path = managers;
sourceTree = "<group>";
};
E5A00007AAAA000000000001 /* SystemMonitor */ = {
isa = PBXGroup;
children = (
E5A00002AAAA000000000002 /* SystemMonitorView.swift */,
);
path = SystemMonitor;
sourceTree = "<group>";
};
149E0B982C737D26006418B1 /* Webcam */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1108,6 +1125,9 @@
1100290C2E847E2800035A57 /* NSItemProvider+LoadHelpers.swift in Sources */,
11CFC6632E09918400748C80 /* MusicControllerSelectionView.swift in Sources */,
B1F0A0022E60000100000001 /* BrightnessManager.swift in Sources */,
E5A00004AAAA000000000004 /* SystemMonitorManager.swift in Sources */,
E5A00005AAAA000000000005 /* SystemMonitorView.swift in Sources */,
E5A00006AAAA000000000006 /* SystemMonitorSettingsView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
20 changes: 17 additions & 3 deletions boringNotch/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ struct ContentView: View {
}
}
.onReceive(NotificationCenter.default.publisher(for: .sharingDidFinish)) { _ in
if vm.notchState == .open && !isHovering && !vm.isBatteryPopoverActive {
if vm.notchState == .open && !isHovering && !vm.isBatteryPopoverActive && !vm.isSystemMonitorPopoverActive {
hoverTask?.cancel()
hoverTask = Task {
try? await Task.sleep(for: .milliseconds(100))
guard !Task.isCancelled else { return }
await MainActor.run {
if self.vm.notchState == .open && !self.isHovering && !self.vm.isBatteryPopoverActive && !SharingStateManager.shared.preventNotchClose {
if self.vm.notchState == .open && !self.isHovering && !self.vm.isBatteryPopoverActive && !self.vm.isSystemMonitorPopoverActive && !SharingStateManager.shared.preventNotchClose {
self.vm.close()
}
}
Expand Down Expand Up @@ -204,6 +204,20 @@ struct ContentView: View {
}
}
}
.onChange(of: vm.isSystemMonitorPopoverActive) {
if !vm.isSystemMonitorPopoverActive && !isHovering && vm.notchState == .open && !SharingStateManager.shared.preventNotchClose {
hoverTask?.cancel()
hoverTask = Task {
try? await Task.sleep(for: .milliseconds(100))
guard !Task.isCancelled else { return }
await MainActor.run {
if !self.vm.isSystemMonitorPopoverActive && !self.isHovering && self.vm.notchState == .open && !SharingStateManager.shared.preventNotchClose {
self.vm.close()
}
}
}
}
}
.sensoryFeedback(.alignment, trigger: haptics)
.contextMenu {
Button("Settings") {
Expand Down Expand Up @@ -583,7 +597,7 @@ struct ContentView: View {
self.isHovering = false
}

if self.vm.notchState == .open && !self.vm.isBatteryPopoverActive && !SharingStateManager.shared.preventNotchClose {
if self.vm.notchState == .open && !self.vm.isBatteryPopoverActive && !self.vm.isSystemMonitorPopoverActive && !SharingStateManager.shared.preventNotchClose {
self.vm.close()
}
}
Expand Down
34 changes: 33 additions & 1 deletion boringNotch/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,10 @@
},
"Accessibility Access Required" : {

},
"Activity Monitor" : {
"comment" : "A button label that opens the Activity Monitor.",
"isCommentAutoGenerated" : true
},
"Add" : {
"extractionState" : "stale",
Expand Down Expand Up @@ -5429,6 +5433,14 @@
}
}
},
"CPU Usage" : {
"comment" : "A label displayed next to the CPU usage value in the System Monitor settings view.",
"isCommentAutoGenerated" : true
},
"Current Stats" : {
"comment" : "A section header for the current CPU and memory usage statistics.",
"isCommentAutoGenerated" : true
},
"Currently selected: %@" : {
"localizations" : {
"ar" : {
Expand Down Expand Up @@ -6432,6 +6444,10 @@
}
}
},
"Display CPU and memory usage indicators in the notch header area, next to the battery indicator." : {
"comment" : "A description of the feature that allows users to see CPU and memory usage indicators in the notch header area.",
"isCommentAutoGenerated" : true
},
"Download" : {
"localizations" : {
"ar" : {
Expand Down Expand Up @@ -11963,6 +11979,10 @@
}
}
},
"Memory Used" : {
"comment" : "A label describing the amount of memory currently used by the device.",
"isCommentAutoGenerated" : true
},
"Mic" : {

},
Expand Down Expand Up @@ -18083,6 +18103,10 @@
}
}
},
"Show system monitor" : {
"comment" : "A toggle label that allows the user to enable or disable the system monitor.",
"isCommentAutoGenerated" : true
},
"Slider color" : {
"localizations" : {
"ar" : {
Expand Down Expand Up @@ -18739,6 +18763,10 @@
}
}
},
"Statistics update every 3 seconds." : {
"comment" : "A footer label for the System Monitor settings view, explaining that the statistics are updated every 3 seconds.",
"isCommentAutoGenerated" : true
},
"Stopped" : {
"extractionState" : "stale",
"localizations" : {
Expand Down Expand Up @@ -19040,6 +19068,10 @@
}
}
},
"System Monitor" : {
"comment" : "The title of a settings page related to monitoring the system.",
"isCommentAutoGenerated" : true
},
"Time to Full Charge: %lld min" : {
"localizations" : {
"ar" : {
Expand Down Expand Up @@ -21158,5 +21190,5 @@
}
}
},
"version" : "1.0"
"version" : "1.1"
}
3 changes: 3 additions & 0 deletions boringNotch/components/Notch/BoringHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ struct BoringHeader: View {
)
.transition(.scale(scale: 0.8).combined(with: .opacity))
} else {
if Defaults[.showSystemMonitor] {
SystemMonitorView()
}
if Defaults[.showMirror] {
Button(action: {
vm.toggleCameraPreview()
Expand Down
5 changes: 5 additions & 0 deletions boringNotch/components/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct SettingsView: View {
NavigationLink(value: "Battery") {
Label("Battery", systemImage: "battery.100.bolt")
}
NavigationLink(value: "SystemMonitor") {
Label("System Monitor", systemImage: "gauge.with.dots.needle.33percent")
}
NavigationLink(value: "Shelf") {
Label("Shelf", systemImage: "books.vertical")
}
Expand Down Expand Up @@ -72,6 +75,8 @@ struct SettingsView: View {
OSDSettings()
case "Battery":
Charge()
case "SystemMonitor":
SystemMonitorSettings()
case "Shelf":
Shelf()
case "Shortcuts":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// SystemMonitorSettingsView.swift
// boringNotch
//
// Created by Zaky Syihab Hatmoko on 05/03/2026.
//

import Defaults
import SwiftUI

struct SystemMonitorSettings: View {
@ObservedObject var monitor = SystemMonitorManager.shared

var body: some View {
Form {
Section {
Defaults.Toggle(key: .showSystemMonitor) {
Text("Show system monitor")
}
} header: {
Text("General")
} footer: {
Text("Display CPU and memory usage indicators in the notch header area, next to the battery indicator.")
.font(.caption)
.foregroundStyle(.secondary)
}

if Defaults[.showSystemMonitor] {
Section {
HStack {
Text("CPU Usage")
Spacer()
Text(String(format: "%.1f%%", monitor.cpuUsage))
.foregroundStyle(.secondary)
}
HStack {
Text("Memory Used")
Spacer()
Text(String(format: "%.1f / %.0f GB", monitor.memoryUsed, monitor.memoryTotal))
.foregroundStyle(.secondary)
}
} header: {
Text("Current Stats")
} footer: {
Text("Statistics update every 3 seconds.")
.font(.caption)
.foregroundStyle(.secondary)
}
}
}
.accentColor(.effectiveAccent)
.navigationTitle("System Monitor")
}
}
Loading