Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Fix taskbar icon not showing on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Mar 2, 2021
1 parent 86e6a1e commit 17117dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions projector-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Notable changes to this project are documented in this file.

## 1.0.1

## Fixed

- Taskbar icon not showing on Linux.

# 1.0.0

## Changed
Expand Down
7 changes: 7 additions & 0 deletions projector-launcher/src/main/kotlin/ElectronApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class ElectronApp(val url: String) {
var preloadPath = path.normalize(path.join(__dirname, "../assets/js/preload.js"))
this.mainWindow = BrowserWindow(js(windowOptions)(workAreaSize.width, workAreaSize.height, preloadPath))

if (process.platform.unsafeCast<String>().toLowerCase() !in setOf("win32", "darwin")) {
// change icon for Linux and other systems:
val iconPath = path.normalize(path.join(__dirname, "assets/img/electron-icon.png")).unsafeCast<String>()
val iconImage = NativeImage.createFromPath(iconPath)
this.mainWindow.setIcon(iconImage)
}

this.mainWindow.webContents.on("did-navigate-in-page")
{
_: Event,
Expand Down
3 changes: 1 addition & 2 deletions projector-launcher/src/main/kotlin/KElectron.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ external interface MouseWheelInputEvent : MouseInputEvent {
set(value) = definedExternally
}

@JsName("nativeImage")
open external class NativeImage {
open fun addRepresentation(options: AddRepresentationOptions)
open fun crop(rect: Rectangle): NativeImage
Expand Down Expand Up @@ -5473,8 +5474,6 @@ external var ipcMain: IpcMain

external var ipcRenderer: IpcRenderer

external var nativeImage: Any

external var nativeTheme: NativeTheme

external var net: Net
Expand Down
4 changes: 4 additions & 0 deletions projector-launcher/webpack.config.d/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@

// todo: remove after https://youtrack.jetbrains.com/issue/KT-35327 is fixed
config.target = 'electron-renderer';
// fix root dir: https://webconfiguration.wordpress.com/2017/12/04/__dirname-resolving-to-root-of-disk/
config.node = config.node || {};
config.node.__dirname = false;
config.node.__filename = false;

0 comments on commit 17117dc

Please sign in to comment.