Skip to main content

Positioner Plugin

The Positioner plugin provides semantic window positioning with screen-aware coordinates.

Installation

<dependency>
<groupId>build.krema</groupId>
<artifactId>krema-plugin-positioner</artifactId>
<version>${krema.version}</version>
</dependency>

Permissions

[permissions]
allow = ["window:manage"]

Commands

positioner:moveTo

Moves the window to a predefined position.

await window.krema.invoke('positioner:moveTo', { position: 'bottom-right' });

Available Positions

┌─────────────────────────────────────┐
│ top-left top-center top-right │
│ │
│left-center center right-center│
│ │
│bottom-left bottom-center bottom-right│
└─────────────────────────────────────┘
PositionDescription
top-leftTop-left corner
top-centerTop edge, centered
top-rightTop-right corner
left-centerLeft edge, centered
centerScreen center
right-centerRight edge, centered
bottom-leftBottom-left corner
bottom-centerBottom edge, centered
bottom-rightBottom-right corner

Example: Mini Player

async function enterMiniPlayer() {
await window.krema.invoke('window:setSize', { width: 320, height: 180 });
await window.krema.invoke('positioner:moveTo', { position: 'bottom-right' });
await window.krema.invoke('window:setAlwaysOnTop', { alwaysOnTop: true });
}

async function exitMiniPlayer() {
await window.krema.invoke('window:setAlwaysOnTop', { alwaysOnTop: false });
await window.krema.invoke('window:setSize', { width: 1024, height: 768 });
await window.krema.invoke('positioner:moveTo', { position: 'center' });
}