fix: missing icons taskbar-mediacontrol

This commit is contained in:
JellyBrick
2023-10-08 19:41:39 +09:00
parent 5812eb0147
commit fbf4b3b8b5
4 changed files with 35 additions and 32 deletions

View File

@ -2,7 +2,6 @@ import fs from 'node:fs';
import path from 'node:path';
import { app, ipcMain, ipcRenderer } from 'electron';
import is from 'electron-is';
import { ValueOf } from '../utils/type-utils';
@ -15,6 +14,26 @@ export const getMediaIconLocation = () =>
? path.resolve(app.getPath('userData'), 'icons')
: path.resolve(getAssetsDirectoryLocation(), 'media-icons-black');
export const mediaIcons = {
play: '\u{1405}', // ᐅ
pause: '\u{2016}', // ‖
next: '\u{1433}', //
previous: '\u{1438}', //
};
export const saveMediaIcon = () => {
for (const kind of Object.keys(mediaIcons)) {
const destinationPath = path.join(getMediaIconLocation(), `${kind}.png`);
if (fs.existsSync(destinationPath)) {
continue;
}
const iconPath = path.resolve(path.resolve(getAssetsDirectoryLocation(), 'media-icons-black'), `${kind}.png`);
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
fs.copyFile(iconPath, destinationPath, () => {});
}
};
// Creates a DOM element from an HTML string
export const ElementFromHtml = (html: string): HTMLElement => {
const template = document.createElement('template');