Skip to content

Commit

Permalink
fix: fix touchbar icon
Browse files Browse the repository at this point in the history
- fix #2183
  • Loading branch information
JellyBrick committed Jul 14, 2024
1 parent 8879799 commit 2512af8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugins/touchbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { type NativeImage, TouchBar } from 'electron';
import { nativeImage, type NativeImage, TouchBar } from 'electron';

import { createPlugin } from '@/utils';
import getSongControls from '@/providers/song-controls';
import registerCallback from '@/providers/song-info';
import { t } from '@/i18n';

import youtubeMusicIcon from '@assets/youtube-music.png?asset&asarUnpack';

export default createPlugin({
name: () => t('plugins.touchbar.name'),
description: () => t('plugins.touchbar.description'),
Expand Down Expand Up @@ -89,9 +91,9 @@ export default createPlugin({
pausePlayButton.label = songInfo.isPaused ? '▶️' : '⏸';

// Get image source
songImage.icon = songInfo.image
? songInfo.image.resize({ height: 23 })
: undefined;
songImage.icon = (
songInfo.image ? songInfo.image : nativeImage.createFromPath(youtubeMusicIcon)
).resize({ height: 23 });

window.setTouchBar(touchBar);
});
Expand Down

0 comments on commit 2512af8

Please sign in to comment.