Skip to content

Commit

Permalink
Add tray_icon_path to config to allow overriding tray icon
Browse files Browse the repository at this point in the history
  • Loading branch information
3nprob committed Aug 3, 2022
1 parent b693aee commit f4aca16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion element.io/nightly/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
"feature_spotlight": true,
"feature_video_rooms": true
},
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
"tray_icon_path": null
}
3 changes: 2 additions & 1 deletion element.io/release/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"apiHost": "https://posthog.element.io"
},
"privacy_policy_url": "https://element.io/cookie-policy",
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
"tray_icon_path": null
}
7 changes: 3 additions & 4 deletions src/electron-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const argv = minimist(process.argv, {
// async to are initialised in setupGlobals()
let asarPath: string;
let resPath: string;
let iconPath: string;

if (argv["help"]) {
console.log("Options:");
Expand Down Expand Up @@ -193,8 +192,8 @@ async function setupGlobals(): Promise<void> {

// The tray icon
// It's important to call `path.join` so we don't end up with the packaged asar in the final path.
const iconFile = `element.${process.platform === 'win32' ? 'ico' : 'png'}`;
iconPath = path.join(resPath, "img", iconFile);
const iconPath = global.vectorConfig.tray_icon_path ||
path.join(resPath, "img", `element.${process.platform === 'win32' ? 'ico' : 'png'}`);
global.trayConfig = {
icon_path: iconPath,
brand: global.vectorConfig.brand || 'Element',
Expand Down Expand Up @@ -418,7 +417,7 @@ app.on('ready', async () => {
// https://www.electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
backgroundColor: '#fff',

icon: iconPath,
icon: global.trayConfig.icon_path,
show: false,
autoHideMenuBar: global.store.get('autoHideMenuBar', true),

Expand Down

0 comments on commit f4aca16

Please sign in to comment.