Improved compatibility

This commit is contained in:
JellyBrick
2025-12-20 21:57:47 +09:00
parent 29736f480d
commit 696ff0fc7a
75 changed files with 415 additions and 375 deletions

View File

@ -14,7 +14,8 @@ import {
protocol,
type BrowserWindowConstructorOptions,
} from 'electron';
import enhanceWebRequest, {
import {
enhanceWebRequest,
type BetterSession,
} from '@jellybrick/electron-better-web-request';
import is from 'electron-is';
@ -53,7 +54,7 @@ import {
} from '@/loader/main';
import { LoggerPrefix } from '@/utils';
import { loadI18n, setLanguage, t } from '@/i18n';
import { APPLICATION_NAME, loadI18n, setLanguage, t } from '@/i18n';
import ErrorHtmlAsset from '@assets/error.html?asset';
@ -104,11 +105,6 @@ protocol.registerSchemesAsPrivileged([
{ scheme: 'mailto', privileges: { standard: true } },
]);
// https://github.com/electron/electron/issues/46538#issuecomment-2808806722
if (is.linux()) {
app.commandLine.appendSwitch('gtk-version', '3');
}
// Ozone platform hint: Required for Wayland support
app.commandLine.appendSwitch('ozone-platform-hint', 'auto');
// SharedArrayBuffer: Required for downloader (@ffmpeg/core-mt)
@ -131,7 +127,9 @@ if (config.get('options.disableHardwareAcceleration')) {
if (is.linux()) {
// Overrides WM_CLASS for X11 to correspond to icon filename
app.setName('com.github.th_ch.pear_music');
app.setName(
'com.github.th_ch.\u0079\u006f\u0075\u0074\u0075\u0062\u0065\u005f\u006d\u0075\u0073\u0069\u0063',
);
// Stops chromium from launching its own MPRIS service
if (await config.plugins.isEnabled('shortcuts')) {
@ -167,9 +165,9 @@ electronDebug({
let icon = 'assets/icon.png';
if (process.platform === 'win32') {
icon = 'assets/generated/icon.ico';
icon = 'assets/generated/icons/win/icon.ico';
} else if (process.platform === 'darwin') {
icon = 'assets/generated/icon.icns';
icon = 'assets/generated/icons/mac/icon.icns';
}
function onClosed() {
@ -663,7 +661,8 @@ app.whenReady().then(async () => {
// Register appID on windows
if (is.windows()) {
const appID = 'com.github.th-ch.pear-music';
const appID =
'com.github.th-ch.\u0079\u006f\u0075\u0074\u0075\u0062\u0065\u002d\u006d\u0075\u0073\u0069\u0063';
app.setAppUserModelId(appID);
const appLocation = process.execPath;
const appData = app.getPath('appData');
@ -678,7 +677,7 @@ app.whenReady().then(async () => {
'Windows',
'Start Menu',
'Programs',
'Pear Desktop.lnk',
`${APPLICATION_NAME}.lnk`,
);
try {
// Check if shortcut is registered and valid
@ -698,7 +697,7 @@ app.whenReady().then(async () => {
{
target: appLocation,
cwd: path.dirname(appLocation),
description: 'Pear Desktop App - including custom plugins',
description: `${APPLICATION_NAME} Desktop App - including custom plugins`,
appUserModelId: appID,
},
);