Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[desktop] Revert to 1.6.63 Linux icon behaviour

Manav Rathie4bc206d6a7f
diff --git a/desktop/CHANGELOG.md b/desktop/CHANGELOG.md
index b6dccf60e5..1d535dc1a2 100644
--- a/desktop/CHANGELOG.md
+++ b/desktop/CHANGELOG.md
@@ -3,6 +3,7 @@
## v1.7.1 (Unreleased)
- Remember the window size across app restarts.
+- Revert changes to the Linux icon.
## v1.7.0
diff --git a/desktop/build/icons/512-512.png b/desktop/build/icons/512-512.png
deleted file mode 100644
index 9d4d8ced53..0000000000
Binary files a/desktop/build/icons/512-512.png and /dev/null differ
diff --git a/desktop/build/window-icon.png b/desktop/build/window-icon.png
new file mode 100644
index 0000000000..5b0458033d
Binary files /dev/null and b/desktop/build/window-icon.png differ
diff --git a/desktop/electron-builder.yml b/desktop/electron-builder.yml
index c2c000ce9f..347aabe631 100644
--- a/desktop/electron-builder.yml
+++ b/desktop/electron-builder.yml
@@ -23,6 +23,7 @@ linux:
- target: pacman
arch: [x64, arm64]
category: Photography
+ icon: ./build/icon.icns
mac:
target:
target: default
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index fab5dbce0a..afbf4eccd3 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -143,6 +143,9 @@ const registerPrivilegedSchemes = () => {
* This window will show the HTML served from {@link rendererURL}.
*/
const createMainWindow = () => {
+ const icon = nativeImage.createFromPath(
+ path.join(isDev ? "build" : process.resourcesPath, "window-icon.png"),
+ );
const bounds = windowBounds();
// Create the main window. This'll show our web content.
@@ -151,12 +154,11 @@ const createMainWindow = () => {
preload: path.join(__dirname, "preload.js"),
sandbox: true,
},
+ icon,
// Set the window's position and size (if we have one saved).
...(bounds ?? {}),
// Enforce a minimum size
...minimumWindowSize(),
- // (Maybe) fix the dock icon on Linux.
- ...windowIconOptions(),
// The color to show in the window until the web content gets loaded.
// See: https://www.electronjs.org/docs/latest/api/browser-window#setting-the-backgroundcolor-property
backgroundColor: "black",
@@ -272,53 +274,6 @@ const saveWindowBounds = (window: BrowserWindow) => {
}
};
-/**
- * On Linux the app does not show a dock icon by default, attempt to fix this by
- * returning the path to an icon as the "icon" property that can be passed to
- * the BrowserWindow during creation.
- */
-const windowIconOptions = () => {
- if (process.platform != "linux") return {};
-
- // There are two, possibly three, different issues with icons on Linux.
- //
- // Firstly, the AppImage itself doesn't show an icon. There does not seem to
- // be a reasonable workaround either currently. See:
- // https://github.com/AppImage/AppImageKit/issues/346
- //
- // Secondly, and this is the problem we're trying to fix here, when the app
- // is started it does not show a dock icon (Ubuntu 22) or shows the generic
- // gear icon (Ubuntu 24). The issue possibly exists on other distributions
- // too.
- //
- // Electron provides a `BrowserWindow.setIcon` function which should solve
- // our issue, we could call it selectively on Linux. There is also an
- // apparently undocumented "icon" option that can be passed when creating a
- // new BrowserWindow, and that is what most of the other code I saw on
- // GitHub seems to be doing.
- //
- // However, try what I may, I can't get either of these to work. Which leads
- // me to believe there is a third issue: I can't get it to work because I'm
- // testing on an Ubuntu 24 VM, where this might just not be working:
- // https://askubuntu.com/questions/1511534/ubuntu-24-04-skype-logo-on-the-dock-not-showing-skype-logo
- //
- // 24 isn't likely the year of the Linux desktop either.
- //
- // For now, I'm adding a very specific incantation taken from
- // https://github.com/arduino/arduino-ide/blob/main/arduino-ide-extension/src/electron-main/fix-app-image-icon.ts
- //
- // Possibly all this specific naming of the file etc is superstition, and
- // just any name would do as long as the path is correct, but let me try it
- // this way and see if this gets the icon to appear on Ubuntu 22 etc.
-
- const icon = path.join(
- isDev ? "build" : process.resourcesPath,
- "icons/512x512.png",
- );
-
- return { icon };
-};
-
/**
* Automatically set the save path for user initiated downloads to the system's
* "downloads" directory instead of asking the user to select a save location.