[PR #5010] [MERGED] fix(desktop): add win version checks for DWM attr api #5019

Closed
opened 2026-03-17 02:30:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5010
Author: @CuriousCorrelation
Created: 4/22/2025
Status: Merged
Merged: 4/25/2025
Merged by: @AndrewBastin

Base: nextHead: fix-desktop-dwm-win-attr


📝 Commits (1)

  • 379b9cf fix: add win version checks for DWM attr api

📊 Changes

3 files changed (+34 additions, -19 deletions)

View changed files

📝 packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/ui/windows/posit.rs (+28 -13)
📝 packages/hoppscotch-desktop/src-tauri/Cargo.lock (+1 -1)
📝 pnpm-lock.yaml (+5 -5)

📄 Description

This adds version checking before using Windows 11-specific DWM APIs.

Closes HFE-821

The desktop app crashes on startup on older Windows versions (pre-Windows 11) due to unsupported DWM API calls for dark mode and caption styling.

According to docs at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute, both DWMWA_USE_IMMERSIVE_DARK_MODE and DWMWA_CAPTION_COLOR attributes are only supported starting with Windows 11 Build 22000.

DWMWA_USE_IMMERSIVE_DARK_MODE: [...] This value is supported starting
with Windows 11 Build 22000"

and

DWMWA_CAPTION_COLOR: [...] This value is supported starting
with Windows 11 Build 22000.

See https://github.com/hoppscotch/hoppscotch/discussions/4984 for more details, for reports of app crashing immediately on startup with these errors:

Failed to set dark mode: Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[0417/150158.530:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1412

Notes to reviewers

The tests were all over the place, both attributes (sometimes!) seems to be present on Windows 10 1809 and even earlier, only if it was installed with network access, so perhaps this is due to Windows updates? Other times, they weren't, especially on VMs.

The issue is reproducible on Windows Server 2019 Datacenter (v10.0.17763), which is equivalent to Windows 10 version 1809.

This version is too old to support DWMWA_USE_IMMERSIVE_DARK_MODE, which is only officially supported starting with Windows 11 Build 22000 according to Microsoft's documentation.

So at the moment, relying on official docs seems to be the right call, and themes are definitely something app shouldn't crash for regardless.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5010 **Author:** [@CuriousCorrelation](https://github.com/CuriousCorrelation) **Created:** 4/22/2025 **Status:** ✅ Merged **Merged:** 4/25/2025 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `next` ← **Head:** `fix-desktop-dwm-win-attr` --- ### 📝 Commits (1) - [`379b9cf`](https://github.com/hoppscotch/hoppscotch/commit/379b9cfa161d5734992d175c43984c3ccf479f3a) fix: add win version checks for DWM attr api ### 📊 Changes **3 files changed** (+34 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/ui/windows/posit.rs` (+28 -13) 📝 `packages/hoppscotch-desktop/src-tauri/Cargo.lock` (+1 -1) 📝 `pnpm-lock.yaml` (+5 -5) </details> ### 📄 Description This adds version checking before using Windows 11-specific DWM APIs. Closes HFE-821 The desktop app crashes on startup on older Windows versions (pre-Windows 11) due to unsupported DWM API calls for dark mode and caption styling. According to docs at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute, both `DWMWA_USE_IMMERSIVE_DARK_MODE` and `DWMWA_CAPTION_COLOR` attributes are only supported starting with Windows 11 Build 22000. > DWMWA_USE_IMMERSIVE_DARK_MODE: [...] This value is supported starting > with Windows 11 Build 22000" and > DWMWA_CAPTION_COLOR: [...] This value is supported starting > with Windows 11 Build 22000. See https://github.com/hoppscotch/hoppscotch/discussions/4984 for more details, for reports of app crashing immediately on startup with these errors: ``` Failed to set dark mode: Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace [0417/150158.530:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1412 ``` ### Notes to reviewers The tests were all over the place, both attributes (sometimes!) seems to be present on Windows 10 1809 and even earlier, only if it was installed with network access, so perhaps this is due to Windows updates? Other times, they weren't, especially on VMs. The issue is reproducible on **Windows Server 2019 Datacenter (v10.0.17763)**, which is equivalent to Windows 10 version 1809. This version is too old to support `DWMWA_USE_IMMERSIVE_DARK_MODE`, which is only **officially supported** starting with **Windows 11 Build 22000** according to Microsoft's documentation. So at the moment, relying on official docs seems to be the right call, and themes are definitely something app shouldn't crash for regardless. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:30:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5019
No description provided.