electron-macos-window-extensions
v0.1.2
Published
macOS window management extensions for Electron applications
Downloads
272
Maintainers
Readme
electron-macos-window-extensions
macOS window management extensions for Electron applications.
Installation
npm install electron-macos-window-extensionsAPI
WindowObserver
Observe window key status changes.
import { WindowObserver } from 'electron-macos-window-extensions'
const observer = new WindowObserver(
window.getNativeWindowHandle(),
(event) => {
console.log(event.type) // 'BecomeKey' | 'ResignKey'
}
)
observer.stop()Window Controls
import { showAndMakeKey, orderOut, nonActivatingPanel, setAnimationBehavior, deactivateApp } from 'electron-macos-window-extensions'
// Display window and make it the key window (receives keyboard events)
showAndMakeKey(window.getNativeWindowHandle())
// Hide window (resigns key)
orderOut(window.getNativeWindowHandle())
// Configure as non-activating panel (interactions won't activate the app)
nonActivatingPanel(window.getNativeWindowHandle(), { resizable: true })
// Set window animation behavior
// Options: Default, None, DocumentWindow, UtilityWindow, AlertPanel
setAnimationBehavior(window.getNativeWindowHandle(), 'None')
// Deactivate application (move focus to another app)
deactivateApp()License
MIT
