fix(desktop): stop overwriting a custom dock icon on launch (#7125)
This commit is contained in:
1 parent
f3cb7f5095
commit
3b5d476eb6
2 files changed
+31
-2
No files matched your search
@@ -199,7 +199,9 @@ describe("DesktopAppIdentity", () => {
|
||||
assert.equal(calls.setAboutPanelOptions[0]?.applicationName, "T3 Code (Alpha)");
|
||||
assert.equal(calls.setAboutPanelOptions[0]?.applicationVersion, "1.2.3");
|
||||
assert.equal(calls.setAboutPanelOptions[0]?.version, "0123456789ab");
|
||||
assert.deepEqual(calls.setDockIcon, ["/icon.png"]);
|
||||
// Packaged: the bundle's own icon stands, so a custom one the user
|
||||
// attached survives.
|
||||
assert.deepEqual(calls.setDockIcon, []);
|
||||
}),
|
||||
{
|
||||
calls,
|
||||
@@ -212,4 +214,28 @@ describe("DesktopAppIdentity", () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it.effect("sets the dock icon only when running unpackaged", () => {
|
||||
const calls: ElectronAppCalls = {
|
||||
setAboutPanelOptions: [],
|
||||
setDockIcon: [],
|
||||
setName: [],
|
||||
};
|
||||
|
||||
return withIdentity(
|
||||
Effect.gen(function* () {
|
||||
const identity = yield* DesktopAppIdentity.DesktopAppIdentity;
|
||||
yield* identity.configure;
|
||||
|
||||
// Electron shows a generic icon for an unpackaged run, which is the
|
||||
// reason this call exists at all.
|
||||
assert.deepEqual(calls.setDockIcon, ["/icon.png"]);
|
||||
}),
|
||||
{
|
||||
calls,
|
||||
environment: { isPackaged: false },
|
||||
pngIconPath: Option.some("/icon.png"),
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -134,7 +134,10 @@ export const make = Effect.gen(function* () {
|
||||
yield* electronApp.setDesktopName(environment.linuxDesktopEntryName);
|
||||
}
|
||||
|
||||
if (environment.platform === "darwin") {
|
||||
// Unpackaged runs only. A packaged bundle already carries its icon in
|
||||
// Info.plist, so setting the dock tile again changes nothing except to
|
||||
// overwrite a custom icon the user attached to the app themselves.
|
||||
if (environment.platform === "darwin" && !environment.isPackaged) {
|
||||
const iconPaths = yield* assets.iconPaths;
|
||||
yield* Option.match(iconPaths.png, {
|
||||
onNone: () => Effect.void,
|
||||
|
||||
Reference in new issue
Block a user