Updating presence icons for Windows

This commit is contained in:
sbenmoussati 2023-03-01 19:44:14 +01:00 committed by Salah Benmoussati
parent c1acb81c5b
commit 1f074ce3a1
53 changed files with 66 additions and 60 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 279 KiB

View File

@ -116,43 +116,47 @@ class PresenceStatus {
const isMana = !!windowHandler.isMana; const isMana = !!windowHandler.isMana;
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
{ {
label: i18n.t('My presence')(), label: i18n.t('Status')(),
visible: isMana, visible: isMana,
submenu: [ enabled: false,
{
label: i18n.t(EPresenceStatus.AVAILABLE, presenceNamespace)(),
type: 'checkbox',
checked: currentStatus === EPresenceStatus.AVAILABLE,
click: () => {
this.handlePresenceChange(EPresenceStatus.AVAILABLE);
},
},
{
label: i18n.t(EPresenceStatus.BUSY, presenceNamespace)(),
type: 'checkbox',
checked: currentStatus === EPresenceStatus.BUSY,
click: () => {
this.handlePresenceChange(EPresenceStatus.BUSY);
},
},
{
label: i18n.t(EPresenceStatus.BE_RIGHT_BACK, presenceNamespace)(),
type: 'checkbox',
checked: currentStatus === EPresenceStatus.BE_RIGHT_BACK,
click: () => {
this.handlePresenceChange(EPresenceStatus.BE_RIGHT_BACK);
},
},
{
label: i18n.t(EPresenceStatus.OUT_OF_OFFICE, presenceNamespace)(),
type: 'checkbox',
checked: currentStatus === EPresenceStatus.OUT_OF_OFFICE,
click: () => {
this.handlePresenceChange(EPresenceStatus.OUT_OF_OFFICE);
},
},
],
}, },
{
label: i18n.t(EPresenceStatus.AVAILABLE, presenceNamespace)(),
type: 'checkbox',
visible: isMana,
checked: currentStatus === EPresenceStatus.AVAILABLE,
click: () => {
this.handlePresenceChange(EPresenceStatus.AVAILABLE);
},
},
{
label: i18n.t(EPresenceStatus.BUSY, presenceNamespace)(),
type: 'checkbox',
visible: isMana,
checked: currentStatus === EPresenceStatus.BUSY,
click: () => {
this.handlePresenceChange(EPresenceStatus.BUSY);
},
},
{
label: i18n.t(EPresenceStatus.BE_RIGHT_BACK, presenceNamespace)(),
type: 'checkbox',
visible: isMana,
checked: currentStatus === EPresenceStatus.BE_RIGHT_BACK,
click: () => {
this.handlePresenceChange(EPresenceStatus.BE_RIGHT_BACK);
},
},
{
label: i18n.t(EPresenceStatus.OUT_OF_OFFICE, presenceNamespace)(),
type: 'checkbox',
visible: isMana,
checked: currentStatus === EPresenceStatus.OUT_OF_OFFICE,
click: () => {
this.handlePresenceChange(EPresenceStatus.OUT_OF_OFFICE);
},
},
{ type: 'separator', visible: isMana },
{ {
label: i18n.t('Quit Symphony')(), label: i18n.t('Quit Symphony')(),
click: () => app.quit(), click: () => app.quit(),

View File

@ -51,45 +51,45 @@ export class PresenceStatus {
const os = isWindowsOS ? 'windows' : isMac ? 'macOS' : 'linux'; const os = isWindowsOS ? 'windows' : isMac ? 'macOS' : 'linux';
const theme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark'; const theme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark';
const assetsPath = `src/renderer/assets/presence-status/${os}/${theme}`; const assetsPath = `src/renderer/assets/presence-status/${os}/${theme}`;
let fileExtension = 'png';
let iconPlace = '';
switch (place) {
case 'tray':
iconPlace = '-tray';
fileExtension = isWindowsOS ? 'ico' : isMac ? 'png' : 'png';
break;
case 'thumbnail':
iconPlace = '-thumbnail';
fileExtension = 'ico';
break;
default:
break;
}
switch (status) { switch (status) {
case EPresenceStatus.AVAILABLE: case EPresenceStatus.AVAILABLE:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/${`available${iconPlace}.${fileExtension}`}`;
place === 'tray' ? 'online-tray.png' : 'online.png'
}`;
break; break;
case EPresenceStatus.BUSY: case EPresenceStatus.BUSY:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/busy${iconPlace}.${fileExtension}`;
place === 'tray' ? 'busy-tray.png' : 'busy.png'
}`;
break; break;
case EPresenceStatus.BE_RIGHT_BACK || EPresenceStatus.AWAY: case EPresenceStatus.BE_RIGHT_BACK || EPresenceStatus.AWAY:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/brb${iconPlace}.${fileExtension}`;
place === 'tray' ? 'brb-tray.png' : 'brb.png'
}`;
break; break;
case EPresenceStatus.OFFLINE: case EPresenceStatus.OFFLINE:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/offline${iconPlace}.${fileExtension}`;
place === 'tray' ? 'offline-tray.png' : 'offline.png'
}`;
break; break;
case EPresenceStatus.OUT_OF_OFFICE: case EPresenceStatus.OUT_OF_OFFICE:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/out-of-office${iconPlace}.${fileExtension}`;
place === 'tray' ? 'out-of-office-tray.png' : 'out-of-office.png'
}`;
break; break;
case EPresenceStatus.IN_A_MEETING: case EPresenceStatus.IN_A_MEETING:
backgroundImage = `../../../${assetsPath}/${ backgroundImage = `../../../${assetsPath}/in-a-meeting${iconPlace}.${fileExtension}`;
place === 'tray' ? 'in-a-meeting-tray.png' : 'in-a-meeting.png'
}`;
break; break;
case EPresenceStatus.NO_PRESENCE: case EPresenceStatus.NO_PRESENCE:
backgroundImage = backgroundImage = `../../../${assetsPath}/no-status${iconPlace}.${fileExtension}`;
place === 'tray' ? `../../../${assetsPath}/no-status-tray.png` : '';
break; break;
default: default:
break; break;

View File

@ -9,6 +9,7 @@ import {
dialog, dialog,
Event, Event,
ipcMain, ipcMain,
nativeImage,
nativeTheme, nativeTheme,
RenderProcessGoneDetails, RenderProcessGoneDetails,
screen, screen,

View File

@ -304,14 +304,15 @@ export const showBadgeCount = (count: number): void => {
* Creates sys tray * Creates sys tray
*/ */
export const initSysTray = () => { export const initSysTray = () => {
const defaultSysTrayIcon = 'no-status-tray.png'; const defaultSysTrayIcon = 'no-status-tray';
const defaultSysTrayIconExtension = isWindowsOS ? 'ico' : 'png';
const os = isWindowsOS ? 'windows' : isMac ? 'macOS' : 'linux'; const os = isWindowsOS ? 'windows' : isMac ? 'macOS' : 'linux';
const theme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark'; const theme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark';
logger.info('theme: ', theme, nativeTheme.themeSource); logger.info('theme: ', theme, nativeTheme.themeSource);
const assetsPath = `renderer/assets/presence-status/${os}/${theme}`; const assetsPath = `renderer/assets/presence-status/${os}/${theme}`;
const defaultSysTrayIconPath = path.join( const defaultSysTrayIconPath = path.join(
__dirname, __dirname,
`../${assetsPath}/${defaultSysTrayIcon}`, `../${assetsPath}/${defaultSysTrayIcon}.${defaultSysTrayIconExtension}`,
); );
const backgroundImage = nativeImage.createFromPath(defaultSysTrayIconPath); const backgroundImage = nativeImage.createFromPath(defaultSysTrayIconPath);
const tray = new Tray(backgroundImage); const tray = new Tray(backgroundImage);

View File

@ -251,5 +251,5 @@
"OUT_OF_OFFICE": "Out of office", "OUT_OF_OFFICE": "Out of office",
"BE_RIGHT_BACK": "Be right back" "BE_RIGHT_BACK": "Be right back"
}, },
"My presence": "My presence" "Status": "Status"
} }

View File

@ -251,5 +251,5 @@
"OUT_OF_OFFICE": "Out of office", "OUT_OF_OFFICE": "Out of office",
"BE_RIGHT_BACK": "Be right back" "BE_RIGHT_BACK": "Be right back"
}, },
"My presence": "My presence" "Status": "Status"
} }

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB