mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
Made beta mainstream
This commit is contained in:
parent
6d9b662a52
commit
8019ca9924
@ -5,8 +5,15 @@ const os = require('os');
|
||||
const { pathToFileURL } = require("url");
|
||||
let didRegisterShortcuts = false;
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
app.commandLine.appendSwitch('disable-features', 'Metal');
|
||||
app.commandLine.appendSwitch('use-gl', 'desktop');
|
||||
}
|
||||
|
||||
|
||||
let mainWindow;
|
||||
|
||||
|
||||
// Handle file opening from Finder or File Explorer
|
||||
app.on('open-file', (event, filePath) => {
|
||||
event.preventDefault();
|
||||
@ -15,25 +22,25 @@ app.on('open-file', (event, filePath) => {
|
||||
|
||||
const openFile = (filePath) => {
|
||||
app.whenReady().then(() => {
|
||||
const fileURL = pathToFileURL(filePath).href;
|
||||
|
||||
if (mainWindow) {
|
||||
const fileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
|
||||
if (mainWindow.webContents.isLoading()) {
|
||||
mainWindow.webContents.once("did-finish-load", () => {
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
} else {
|
||||
const fileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
}
|
||||
} else {
|
||||
createWindow(() => {
|
||||
const fileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const takeSnapshot = async () => {
|
||||
if (!mainWindow) return;
|
||||
|
||||
@ -81,6 +88,19 @@ const createWindow = (onReadyCallback) => {
|
||||
|
||||
mainWindow.loadFile("index.html");
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
mainWindow.webContents.on('did-finish-load', () => {
|
||||
mainWindow.webContents.executeJavaScript("navigator.userAgent").then(ua => {
|
||||
console.log("User Agent:", ua);
|
||||
});
|
||||
|
||||
mainWindow.webContents.executeJavaScript("chrome.loadTimes ? chrome.loadTimes() : {}").then(loadTimes => {
|
||||
console.log("GPU Info (legacy):", loadTimes);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
if (onReadyCallback) onReadyCallback();
|
||||
});
|
||||
@ -103,6 +123,7 @@ const setupContextMenu = () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Set up application menu
|
||||
const setupMenu = () => {
|
||||
const menu = Menu.getApplicationMenu();
|
||||
|
Loading…
Reference in New Issue
Block a user