Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tray): add support for tray icon themes #2809

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8392b07
refactor(assets): update tray icons
yilmazcabuk Dec 30, 2024
10743b3
refactor: update tray icon
yilmazcabuk Dec 30, 2024
0111eaf
refactor(tray): improve tray setup and icon handling
yilmazcabuk Dec 30, 2024
86fc1a9
Merge branch 'th-ch:master' into master
yilmazcabuk Dec 31, 2024
082ebcc
feat(tray): add support for tray icon themes
yilmazcabuk Dec 31, 2024
1a9372f
Merge remote-tracking branch 'origin/master'
yilmazcabuk Dec 31, 2024
da71433
refactor(tray): update tray tooltip to use SongInfo type
yilmazcabuk Dec 31, 2024
4f7ffe9
Merge branch 'th-ch:master' into master
yilmazcabuk Dec 31, 2024
b0af7fc
refactor(tray): streamline tray icon management
yilmazcabuk Jan 1, 2025
25a2787
refactor(tray): improve handling and encapsulate logic
yilmazcabuk Jan 1, 2025
594abd1
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 1, 2025
7a1260e
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 2, 2025
781a49a
refactor(tray): simplify tray icon and menu setup
yilmazcabuk Jan 2, 2025
bfb9bfd
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 3, 2025
437d805
fix(tray): standardize setUpTray argument structure
yilmazcabuk Jan 3, 2025
d6ba730
Merge remote-tracking branch 'origin/master'
yilmazcabuk Jan 3, 2025
3f6efc5
fix(tray): correct tooltip update logic
yilmazcabuk Jan 3, 2025
ab0440f
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 4, 2025
c9f1d1c
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 5, 2025
fcdca3a
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 8, 2025
f0c579c
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 9, 2025
8c0db3f
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 10, 2025
0c8c732
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 12, 2025
581e01c
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 17, 2025
e1a864d
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 18, 2025
585f074
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 19, 2025
f645577
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 19, 2025
f286024
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 23, 2025
8ecc5be
Merge branch 'th-ch:master' into master
yilmazcabuk Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/tray-icons/default/pause.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/tray-icons/default/play.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/tray-icons/fluent/pause.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/tray-icons/fluent/play.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/tray-icons/material/pause.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/tray-icons/material/play.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/youtube-music-tray-paused.png
Binary file not shown.
Binary file removed assets/youtube-music-tray.png
Binary file not shown.
8 changes: 8 additions & 0 deletions src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export interface WindowPositionConfig {
y: number;
}

export enum TrayIconTheme {
Default = 'default',
Fluent = 'fluent',
Material = 'material',
}

export interface DefaultConfig {
'window-size': WindowSizeConfig;
'window-maximized': boolean;
Expand All @@ -16,6 +22,7 @@ export interface DefaultConfig {
options: {
language?: string;
tray: boolean;
trayIconTheme: TrayIconTheme;
appVisible: boolean;
autoUpdates: boolean;
alwaysOnTop: boolean;
Expand Down Expand Up @@ -51,6 +58,7 @@ const defaultConfig: DefaultConfig = {
'url': 'https://music.youtube.com',
'options': {
tray: false,
trayIconTheme: TrayIconTheme.Default,
appVisible: true,
autoUpdates: true,
alwaysOnTop: false,
Expand Down
8 changes: 8 additions & 0 deletions src/i18n/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@
"enabled-and-hide-app": "Enabled and hide app",
"enabled-and-show-app": "Enabled and show app",
"play-pause-on-click": "Play/Pause on click"
},
"theme": {
"label": "Tray Icon Theme",
"submenu": {
"default": "Default",
"fluent": "Fluent",
"material": "Material"
}
}
},
"visual-tweaks": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ app.whenReady().then(async () => {
mainWindow = await createMainWindow();
await setApplicationMenu(mainWindow);
await refreshMenu(mainWindow);
setUpTray(app, mainWindow);
setUpTray({ app, win: mainWindow });

setupProtocolHandler(mainWindow);

Expand Down
51 changes: 51 additions & 0 deletions src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import promptOptions from './providers/prompt-options';
import { getAllMenuTemplate, loadAllMenuPlugins } from './loader/menu';
import { setLanguage, t } from '@/i18n';

import { setUpTray } from '@/tray';

import { TrayIconTheme } from '@/config/defaults';

import packageJson from '../package.json';

export type MenuTemplate = Electron.MenuItemConstructorOptions[];
Expand Down Expand Up @@ -413,6 +417,53 @@ export const mainMenuTemplate = async (
},
},
{ type: 'separator' },
{
label: t('main.menu.options.submenu.tray.theme.label'),
submenu: [
{
label: 'Default',
type: 'radio',
checked:
config.get('options.trayIconTheme') ===
TrayIconTheme.Default,
click() {
config.setMenuOption(
'options.trayIconTheme',
TrayIconTheme.Default,
);
setUpTray({ app, win });
},
},
{
label: 'Fluent',
type: 'radio',
checked:
config.get('options.trayIconTheme') ===
TrayIconTheme.Fluent,
click() {
config.setMenuOption(
'options.trayIconTheme',
TrayIconTheme.Fluent,
);
setUpTray({ app, win });
},
},
{
label: 'Material',
type: 'radio',
checked:
config.get('options.trayIconTheme') ===
TrayIconTheme.Material,
click() {
config.setMenuOption(
'options.trayIconTheme',
TrayIconTheme.Material,
);
setUpTray({ app, win });
},
},
],
},
{
label: t(
'main.menu.options.submenu.tray.submenu.play-pause-on-click',
Expand Down
4 changes: 2 additions & 2 deletions src/providers/prompt-options.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import youtubeMusicTrayIcon from '@assets/youtube-music-tray.png?asset&asarUnpack';
import trayIconPlay from '@assets/tray-icons/default/play.png?asset&asarUnpack';

const promptOptions = {
customStylesheet: 'dark',
icon: youtubeMusicTrayIcon,
icon: trayIconPlay,
};

export default () => promptOptions;
Loading
Loading