mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
fix(main): keep background reveals inactive on Linux maximize and drop the flag on admin restart
This commit is contained in:
@@ -5,7 +5,7 @@ export const DESKTOP_WINDOW_METHODS = [
|
||||
// `orca open` asks the running app instead of relaunching it, which would hand it the foreground.
|
||||
defineMethod({
|
||||
name: 'desktop.openWindowInBackground',
|
||||
permission: 'workspace',
|
||||
permission: 'desktop-control',
|
||||
params: null,
|
||||
handler: async () => ({ requested: requestBackgroundWindowOpen() })
|
||||
})
|
||||
|
||||
@@ -75,13 +75,16 @@ export function installMainWindowStateLifecycle(args: {
|
||||
if (isWindowlessLaunch()) {
|
||||
return
|
||||
}
|
||||
// Windows can only maximize by activating (SW_MAXIMIZE), so a background reveal skips it there.
|
||||
if (savedMaximized && !(revealInBackground && process.platform === 'win32')) {
|
||||
mainWindow.maximize()
|
||||
}
|
||||
if (revealInBackground) {
|
||||
// Maximizing a hidden window shows it active; Windows activates on any maximize, so it stays restored there.
|
||||
mainWindow.showInactive()
|
||||
if (savedMaximized && process.platform !== 'win32') {
|
||||
mainWindow.maximize()
|
||||
}
|
||||
} else {
|
||||
if (savedMaximized) {
|
||||
mainWindow.maximize()
|
||||
}
|
||||
showWindowWithoutStealingFocus(mainWindow)
|
||||
}
|
||||
// Fullscreen needs a shown window; after maximize so leaving it returns there. Background launches must not take a Space.
|
||||
|
||||
@@ -4,6 +4,7 @@ import { app } from 'electron'
|
||||
import { quoteWindowsArgument } from '@orca/process-host/windows-command-line'
|
||||
import { getBundledLauncherPath } from '../cli/packaged-assets/bundled-cli-launcher-path'
|
||||
import { getWindowsAdministratorStatus } from './windows-administrator-status'
|
||||
import { BACKGROUND_OPEN_ARG } from '../../shared/background-open-argv'
|
||||
|
||||
const RESTART_LOCAL_TERMINALS_ARG = '--orca-restart-local-terminals-as-administrator'
|
||||
|
||||
@@ -28,7 +29,10 @@ export function prepareWindowsAdministratorRestart(): Electron.RelaunchOptions {
|
||||
if (!launcher || !existsSync(launcher)) {
|
||||
throw new Error('The Windows administrator launcher is unavailable.')
|
||||
}
|
||||
const args = process.argv.slice(1).filter((arg) => arg !== RESTART_LOCAL_TERMINALS_ARG)
|
||||
// The user asked for this restart, so the elevated window comes forward even when `orca open` started this one.
|
||||
const args = process.argv
|
||||
.slice(1)
|
||||
.filter((arg) => arg !== RESTART_LOCAL_TERMINALS_ARG && arg !== BACKGROUND_OPEN_ARG)
|
||||
return {
|
||||
execPath: launcher,
|
||||
args: [
|
||||
|
||||
Reference in New Issue
Block a user