mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
fix: fix #30
This commit is contained in:
@ -7,7 +7,7 @@ import config from './config';
|
|||||||
|
|
||||||
import { cache } from '../../providers/decorators';
|
import { cache } from '../../providers/decorators';
|
||||||
import { SongInfo } from '../../providers/song-info';
|
import { SongInfo } from '../../providers/song-info';
|
||||||
import { getMediaIconLocation } from '../utils';
|
import { getAssetsDirectoryLocation } from '../utils';
|
||||||
|
|
||||||
const icon = 'assets/youtube-music.png';
|
const icon = 'assets/youtube-music.png';
|
||||||
const userData = app.getPath('userData');
|
const userData = app.getPath('userData');
|
||||||
@ -89,7 +89,7 @@ export const saveTempIcon = () => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconPath = path.resolve(getMediaIconLocation(), `${kind}.png`);
|
const iconPath = path.resolve(path.resolve(getAssetsDirectoryLocation(), 'media-icons-black'), `${kind}.png`);
|
||||||
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
||||||
fs.copyFile(iconPath, destinationPath, () => {});
|
fs.copyFile(iconPath, destinationPath, () => {});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,10 +8,12 @@ import is from 'electron-is';
|
|||||||
import { ValueOf } from '../utils/type-utils';
|
import { ValueOf } from '../utils/type-utils';
|
||||||
import defaultConfig from '../config/defaults';
|
import defaultConfig from '../config/defaults';
|
||||||
|
|
||||||
|
export const getAssetsDirectoryLocation = () => path.resolve(__dirname, 'assets');
|
||||||
|
|
||||||
export const getMediaIconLocation = () =>
|
export const getMediaIconLocation = () =>
|
||||||
app.isPackaged
|
app.isPackaged
|
||||||
? path.resolve(app.getPath('userData'), 'icons')
|
? path.resolve(app.getPath('userData'), 'icons')
|
||||||
: path.resolve(__dirname, 'assets', 'media-icons-black');
|
: path.resolve(getAssetsDirectoryLocation(), 'media-icons-black');
|
||||||
|
|
||||||
// Creates a DOM element from an HTML string
|
// Creates a DOM element from an HTML string
|
||||||
export const ElementFromHtml = (html: string): HTMLElement => {
|
export const ElementFromHtml = (html: string): HTMLElement => {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
const iconPath = path.join(__dirname, '..', 'assets', 'youtube-music-tray.png');
|
import { getAssetsDirectoryLocation } from '../plugins/utils';
|
||||||
|
|
||||||
|
const iconPath = path.join(getAssetsDirectoryLocation(), 'youtube-music-tray.png');
|
||||||
|
|
||||||
const promptOptions = {
|
const promptOptions = {
|
||||||
customStylesheet: 'dark',
|
customStylesheet: 'dark',
|
||||||
|
|||||||
4
tray.ts
4
tray.ts
@ -6,6 +6,8 @@ import { restart } from './providers/app-controls';
|
|||||||
import config from './config';
|
import config from './config';
|
||||||
import getSongControls from './providers/song-controls';
|
import getSongControls from './providers/song-controls';
|
||||||
|
|
||||||
|
import { getAssetsDirectoryLocation } from './plugins/utils';
|
||||||
|
|
||||||
import type { MenuTemplate } from './menu';
|
import type { MenuTemplate } from './menu';
|
||||||
|
|
||||||
// Prevent tray being garbage collected
|
// Prevent tray being garbage collected
|
||||||
@ -39,7 +41,7 @@ export const setUpTray = (app: Electron.App, win: Electron.BrowserWindow) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { playPause, next, previous } = getSongControls(win);
|
const { playPause, next, previous } = getSongControls(win);
|
||||||
const iconPath = path.join(__dirname, 'assets', 'youtube-music-tray.png');
|
const iconPath = path.join(getAssetsDirectoryLocation(), 'youtube-music-tray.png');
|
||||||
|
|
||||||
const trayIcon = nativeImage.createFromPath(iconPath).resize({
|
const trayIcon = nativeImage.createFromPath(iconPath).resize({
|
||||||
width: 16,
|
width: 16,
|
||||||
|
|||||||
Reference in New Issue
Block a user