Skip to content

Commit

Permalink
Add icontheme support for those who want ne colored ones or monochrom…
Browse files Browse the repository at this point in the history
…e ones, see #75
  • Loading branch information
squalou committed Dec 18, 2023
1 parent 61ead18 commit 9fe7931
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 11 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
An electron-base client for Google Hangouts Chat, since Google didn't see fit to provide one.

## CHANGELOG
### 5.27.23-1

Add support for several iconThemes, to match some 'monochrome' desktop themes. 3 values are supported :

* `default` : the good old green ones
* `colored` : the new colored google ones
* `mono` : an attempt at monochrome icon theme

Edit `~/.config/google-hangouts-chat-linux.json` and set `"iconTheme":"colored"` for instance, then **restart**.

No GUI setting for now.

### 5.27.22-4

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ So, **to use electron's Wayland rendering** edit `/usr/share/applciations/google

See full [CHANGELOG](./CHANGELOG.md).

### 5.27.23-1

Add support for several iconThemes, to match some 'monochrome' desktop themes. 3 values are supported :

* `default` : the good old green ones
* `colored` : the new colored google ones
* `mono` : an attempt at monochrome icon theme

Edit `~/.config/google-hangouts-chat-linux.json` and set `"iconTheme":"colored"` for instance, then **restart**.

No GUI setting for now.

### 5.27.22-4

Fix systray notification (favicon name changed on google side) see https://github.com/squalou/google-chat-linux/issues/87
Expand Down
Binary file removed assets/icon/badge-256.png
Binary file not shown.
Binary file removed assets/icon/badge-48.png
Binary file not shown.
Binary file added assets/icon/colored/badge-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/colored/normal-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/colored/offline-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/icon/mono/badge-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/mono/normal-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/mono/offline-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icon/normal-256.png
Binary file not shown.
Binary file removed assets/icon/normal-48.png
Binary file not shown.
Binary file removed assets/icon/offline-256.png
Binary file not shown.
Binary file removed assets/icon/offline-48.png
Binary file not shown.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-chat-linux",
"version": "5.27.22-4",
"version": "5.27.23-1",
"description": "Unofficial alternative Google Chat desktop app",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const setConfigDefaults = (configuration) => {
configuration.thirdPartyAuthLoginMode = configuration.thirdPartyAuthLoginMode === undefined ? false : configuration.thirdPartyAuthLoginMode;
configuration.useOldUrl = configuration.useOldUrl === undefined ? false : configuration.useOldUrl;
configuration.languages = configuration.languages === undefined ? undefined : configuration.languages;
configuration.iconTheme = configuration.iconTheme === undefined ? 'default' : configuration.iconTheme;
pathsManifest.setIconTheme(configuration.iconTheme)
if (process.platform === 'win32') {
configuration.keepMinimized = true;
}
Expand Down
29 changes: 26 additions & 3 deletions src/paths.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
const path = require("path");
const { app } = require("electron");

let theme = 'default';
const iconPathTemplate = `\`icon/\${theme}/\${iconName}\``;
const evalIconPath = (theme, iconName) => {
return eval(iconPathTemplate);
}

const setIconTheme = (t) => {
theme = t;
}


const normal = () => {
return path.resolve(process.resourcesPath, evalIconPath(theme, "normal-64.png"))
}
const badge = () => {
return path.resolve(process.resourcesPath, evalIconPath(theme, "badge-64.png"))
}
const offline = () => {
return path.resolve(process.resourcesPath, evalIconPath(theme, "offline-64.png"))
}

module.exports = {
"configsPath": path.resolve(app.getPath("appData"), "google-hangouts-chat-linux.json"),
"NORMAL": path.resolve(process.resourcesPath, "icon/normal-64.png"),
"BADGE": path.resolve(process.resourcesPath, "icon/badge-64.png"),
"OFFLINE": path.resolve(process.resourcesPath, "icon/offline-64.png")
"OVERLAY_NEW_NOTIF": path.resolve(process.resourcesPath, "icon/overlay-new-xs.png"),
normal: normal,
badge: badge,
offline: offline,
setIconTheme: setIconTheme
}
8 changes: 4 additions & 4 deletions src/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const initializeTray = (windowObj) => {
// -> moved things to ipcRenderer preload mechanism in faviconChange.js - thank you ankurk91 :-)
// see https://github.com/ankurk91/google-chat-electron.git
try {
systemTrayIcon = new Tray(pathsManifest.OFFLINE);
systemTrayIcon = new Tray(pathsManifest.offline());
} catch (e) {
console.log(e)
console.log("set Tray icon failed !")
Expand All @@ -86,11 +86,11 @@ ipcMain.on('favicon-changed', (evt, href) => {

function iconForType(iconType) {
if (iconType == "NORMAL") {
return pathsManifest.NORMAL;
return pathsManifest.normal();
} else if (iconType == "ATTENTION") {
return pathsManifest.BADGE;
return pathsManifest.badge();
} else {
return pathsManifest.OFFLINE;
return pathsManifest.offline();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const getBrowserWindowOptions = (config) => {
},
"show": false,
"backgroundColor": "#262727",
"icon": pathsManifest.NORMAL,
"icon": pathsManifest.normal(),
}
}

Expand Down

0 comments on commit 9fe7931

Please sign in to comment.