Made beta mainstream

This commit is contained in:
Anirudh Sevugan 2025-06-17 17:10:58 -05:00 committed by GitHub
parent 6d9b662a52
commit 8019ca9924
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();