Skip to content

Commit

Permalink
Improve #75 : add submenu in View to toggle tray icon theme
Browse files Browse the repository at this point in the history
  • Loading branch information
squalou committed Dec 19, 2023
1 parent 9fe7931 commit 2a37b61
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
An electron-base client for Google Hangouts Chat, since Google didn't see fit to provide one.

## CHANGELOG

### 5.27.23-2

Add a menu in 'View' to change tray icon theme.

### 5.27.23-1

Add support for several iconThemes, to match some 'monochrome' desktop themes. 3 values are supported :
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ So, **to use electron's Wayland rendering** edit `/usr/share/applciations/google

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

### 5.27.23-2

Add a menu in 'View' to change tray icon theme.

### 5.27.23-1

Add support for several iconThemes, to match some 'monochrome' desktop themes. 3 values are supported :
Expand Down
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.23-1",
"version": "5.27.23-2",
"description": "Unofficial alternative Google Chat desktop app",
"main": "src/index.js",
"scripts": {
Expand Down
37 changes: 35 additions & 2 deletions src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const pathsManifest = require("./paths");
const { platform } = require("process");
const ConfigManager = require("./configs");

const DEFAULT_ICONS = 'default'
const COLORED_ICONS = 'colored'
const MONO_ICONS = 'mono'

let mainWindow;
let isQuitting = false;
let keepMinimized = true;
Expand Down Expand Up @@ -131,6 +135,12 @@ const onQuitEntryClicked = () => {
app.quit();
}

const onSetIconThemeClicked = (theme) => {
iconTheme = theme;
app.relaunch();
onQuitEntryClicked();
}

const onToggleThirdPartyAuthLoginMode = () => {
setThirdPartyAuthLoginMode(!getThirdPartyAuthLoginMode());
if (getThirdPartyAuthLoginMode()) {
Expand Down Expand Up @@ -292,7 +302,7 @@ const initializeWindow = (config) => {
openUrlInside = (config && config.openUrlInside);
useXdgOpen = (config && config.useXdgOpen);
thirdPartyAuthLoginMode = (config && config.thirdPartyAuthLoginMode);

iconTheme = (config && config.iconTheme)
mainWindow = new BrowserWindow(bwOptions);

let url = getURL(process.argv)
Expand Down Expand Up @@ -336,7 +346,7 @@ const initializeWindow = (config) => {
configsData.openUrlInside = openUrlInside;
configsData.useXdgOpen = useXdgOpen;
configsData.thirdPartyAuthLoginMode = thirdPartyAuthLoginMode;

configsData.iconTheme = iconTheme;
ConfigManager.updateConfigs(configsData);
} else {
e.preventDefault();
Expand Down Expand Up @@ -383,6 +393,10 @@ const getUseXdgOpenTick = () => {
return getUseXdgOpen() ? '☑' : '☐';
}

const getIconThemeTick = (theme) => {
return iconTheme === theme ? '☑' : '☐';
}

const menuSubMenu = () => {

return [
Expand Down Expand Up @@ -442,6 +456,25 @@ const viewSubMenu = () => {
click: () => {
onStartHiddenClicked();
}
}, {
type: 'separator'
}, {
label: 'Tray icon theme (restart)',
}, {
label: getIconThemeTick(DEFAULT_ICONS) + ' ' + DEFAULT_ICONS,
click: () => {
onSetIconThemeClicked(DEFAULT_ICONS);
}
}, {
label: getIconThemeTick(COLORED_ICONS) + ' ' + COLORED_ICONS,
click: () => {
onSetIconThemeClicked(COLORED_ICONS);
}
}, {
label: getIconThemeTick(MONO_ICONS) + ' ' + MONO_ICONS,
click: () => {
onSetIconThemeClicked(MONO_ICONS);
}
}
]
}
Expand Down

0 comments on commit 2a37b61

Please sign in to comment.