Skip to content
Merged
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
5 changes: 5 additions & 0 deletions App/Dashboard/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ struct DashboardView: View {
}
.onDisappear { Dashboard.didClose() }
.onOpenURL { url in
// scripts/measure-cpu.sh closes the window of the build it measures this way.
if Setup.staysInBackground, url.lastPathComponent == "close" {
Dashboard.close()
return
}
// chargectl://dashboard/<page>
if let target = DashboardPage(rawValue: url.lastPathComponent) { page = target }
// Measuring in the background: keep the window above whatever the user brought forward.
Expand Down
7 changes: 4 additions & 3 deletions scripts/measure-cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ show overview
sleep 4
read -r app_cpu server_cpu < <(measure)
row "overview, in background" "$app_cpu" "$server_cpu"
# Quitting from outside only closes the dashboard; the app stays in the menu bar. AppleScript
# reports that as a cancelled quit.
osascript -e "tell application \"$app\" to quit" >/dev/null 2>&1 || true
# Closes this app's window with a link only --background builds answer. Never quit it with
# AppleScript: that finds apps by bundle identifier and also quits an installed Chargectl, which
# stops its helper and hands charging back to macOS.
show close
sleep 4
read -r app_cpu server_cpu < <(measure)
row "window closed" "$app_cpu" "$server_cpu"
Expand Down