setState
Category: Window Management
Namespace: web.window.setState
Description
Sets the window state (normal, minimized, or maximized). Changes apply immediately.
Syntax
const success = await web.window.setState({
state: 'maximized'
});
Parameters
- state (required) - Window state:
"normal","minimized", or"maximized"
Returns
Promise<boolean> - Returns a promise that resolves with true if successful, false otherwise
Examples
Maximize window
const success = await web.window.setState({
state: 'maximized'
});
if (success) {
console.log('Window maximized');
}
Minimize window
// Minimize window to taskbar
await web.window.setState({
state: 'minimized'
});
Restore to normal
// Restore window to normal state
await web.window.setState({
state: 'normal'
});
Use Cases
- Maximize window for full-screen work
- Minimize window to taskbar
- Restore window to normal state
- Control window state programmatically
- Implement custom window controls
Notes
- Valid states:
"normal","minimized","maximized" - Changes apply immediately
- Invalid state values are ignored
- Sets the WindowState property