From d7673d436fad7dd7334402a69e257defb3792c80 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 15:39:52 -0700 Subject: [PATCH] fix(bar): the update widget asks the platform for its release URLs The update widget's refresh thread polled the Windows repository's GitHub API on every platform (a hard-coded second URL, while the first fetch went through BarPlatform::latest_release_api_url), and the page the click opens was built for the Windows repository, so on macOS the widget compared the mac version against Windows releases after the first refresh and linked to the wrong project. The refresh now uses latest_release_api_url, and a new BarPlatform::release_page_url(version) builds the click target: Windows keeps https://github.com/LGUG2Z/komorebi/releases/v{version} exactly, macOS gets https://github.com/LGUG2Z/komorebi-for-mac/releases/tag/v{version}. BEHAVIOUR (macOS): the update widget compares against and links to the komorebi-for-mac releases. Windows output is unchanged (same URLs). Gate: macOS hand-check (see docs/dev/macos-handcheck.md); Windows needs no e2e. Verified: see the following revisions' fast-check results; not run on a Mac. --- crates/komorebi-bar-core/src/platform.rs | 3 +++ crates/komorebi-bar-core/src/widgets/update.rs | 9 ++++----- komorebi-bar/src/macos/os.rs | 4 ++++ komorebi-bar/src/windows/os.rs | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/komorebi-bar-core/src/platform.rs b/crates/komorebi-bar-core/src/platform.rs index c7c2316e..7117872d 100644 --- a/crates/komorebi-bar-core/src/platform.rs +++ b/crates/komorebi-bar-core/src/platform.rs @@ -31,6 +31,9 @@ pub trait BarPlatform: Send + Sync { /// The GitHub API URL that says which release of this platform's komorebi is the latest. fn latest_release_api_url(&self) -> &'static str; + /// The page of this platform's release `version` that the update widget opens when clicked. + fn release_page_url(&self, version: &str) -> String; + /// The icon of the program a command string would start (Windows: the executable's icon; /// macOS: none). fn command_icon(&self, command: &str) -> Option; diff --git a/crates/komorebi-bar-core/src/widgets/update.rs b/crates/komorebi-bar-core/src/widgets/update.rs index 04c068ea..c7bd51be 100644 --- a/crates/komorebi-bar-core/src/widgets/update.rs +++ b/crates/komorebi-bar-core/src/widgets/update.rs @@ -83,7 +83,7 @@ impl Update { { let client = reqwest::blocking::Client::new(); if let Ok(response) = client - .get("https://api.github.com/repos/LGUG2Z/komorebi/releases/latest") + .get(platform().latest_release_api_url()) .header("User-Agent", "komorebi-bar-version-checker") .send() { @@ -143,10 +143,9 @@ impl BarWidget for Update { if SelectableFrame::new(false) .show(ui, |ui| ui.add(Label::new(layout_job).selectable(false))) .clicked() - && let Err(error) = platform().open_system_tool(SystemTool::Url(format!( - "https://github.com/LGUG2Z/komorebi/releases/v{}", - self.latest_version - ))) + && let Err(error) = platform().open_system_tool(SystemTool::Url( + platform().release_page_url(&self.latest_version), + )) { eprintln!("{error}") } diff --git a/komorebi-bar/src/macos/os.rs b/komorebi-bar/src/macos/os.rs index 3275456e..dbab39cd 100644 --- a/komorebi-bar/src/macos/os.rs +++ b/komorebi-bar/src/macos/os.rs @@ -37,6 +37,10 @@ impl BarPlatform for MacBar { "https://api.github.com/repos/LGUG2Z/komorebi-for-mac/releases/latest" } + fn release_page_url(&self, version: &str) -> String { + format!("https://github.com/LGUG2Z/komorebi-for-mac/releases/tag/v{version}") + } + fn calendar_icon(&self) -> &'static str { CALENDAR } diff --git a/komorebi-bar/src/windows/os.rs b/komorebi-bar/src/windows/os.rs index 5ba8990c..ed41c03f 100644 --- a/komorebi-bar/src/windows/os.rs +++ b/komorebi-bar/src/windows/os.rs @@ -35,6 +35,10 @@ impl BarPlatform for WindowsBar { "https://api.github.com/repos/LGUG2Z/komorebi/releases/latest" } + fn release_page_url(&self, version: &str) -> String { + format!("https://github.com/LGUG2Z/komorebi/releases/v{version}") + } + fn calendar_icon(&self) -> &'static str { CALENDAR_DOTS }