Skip to content

Commit d86b598

Browse files
committed
fix(desktop): preserve fallback for unknown portal schemes
1 parent b0d38f3 commit d86b598

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎apps/desktop/src/electron/LinuxColorScheme.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ it("reads the current color scheme and follows portal changes", async () => {
6868
bus.changed("org.freedesktop.appearance", "color-scheme", 1);
6969
// GNOME's light mode reports "no preference".
7070
bus.changed("org.freedesktop.appearance", "color-scheme", 0);
71-
expect(schemes).toEqual(["dark", "light", "dark", "light"]);
71+
bus.changed("org.freedesktop.appearance", "color-scheme", 3);
72+
expect(schemes).toEqual(["dark", "light", "dark", "light", null]);
7273

7374
stop();
7475
bus.changed("org.freedesktop.appearance", "color-scheme", 1);
75-
expect(schemes).toEqual(["dark", "light", "dark", "light"]);
76+
expect(schemes).toEqual(["dark", "light", "dark", "light", null]);
7677
expect(bus.disconnect).toHaveBeenCalledOnce();
7778
});
7879

‎apps/desktop/src/electron/LinuxColorScheme.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export type LinuxColorScheme = "dark" | "light" | null;
1515
function decodeColorScheme(value: unknown): LinuxColorScheme {
1616
let scheme = value;
1717
while (scheme instanceof Variant) scheme = scheme.value;
18-
if (typeof scheme !== "number") return null;
19-
return scheme === 1 ? "dark" : "light";
18+
return scheme === 1 ? "dark" : scheme === 0 || scheme === 2 ? "light" : null;
2019
}
2120

2221
const settingsCall = (member: "ReadOne" | "Read") =>

0 commit comments

Comments
 (0)