Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ryzhpolsos/redeye/llms.txt

Use this file to discover all available pages before exploring further.

RedEye exposes two families of window-control functions in RWML expressions: window.* functions manage shell windows you define in your own RWML configuration files, while wapi.* functions operate on any Win32 system window using its native window handle. Both families return an empty string and are primarily used as onClick or action values rather than for their return value.

Shell windows vs. system windows

window.*wapi.*
TargetWindows declared with <window id="..."> in RWMLAny Win32 window, identified by its HWND handle
IdentifierString id attribute from the RWML definitionInteger window handle, typically from a ${window.handle} variable
ScopeOnly windows created and owned by RedEyeAll visible windows in the desktop session

Shell window functions (window.*)

Use these functions to show, hide, or toggle windows you have declared in your RWML configuration. You reference windows by the string id you assigned in the <window> element.
Makes a shell window visible. Has no effect if the window is already visible.
id
string
required
The id attribute of the target <window> element.
Returns: An empty string.
<!-- Show the shutdown options panel from the start menu -->
<button text="Shutdown..." onClick="window.show(shutdownOptions)"/>
Hides a shell window. Has no effect if the window is already hidden.
id
string
required
The id attribute of the target <window> element.
Returns: An empty string.
<!-- Auto-hide the start menu when it loses focus -->
<window
    id="startMenu"
    autoShow="false"
    onDeactivate="window.hide(startMenu)">
Closes and destroys a shell window permanently.
id
string
required
The id attribute of the target <window> element.
Returns: An empty string.
<button text="Close panel" onClick="window.close(floatingPanel)"/>
window.close permanently destroys the window object. Use window.hide instead if you intend to show the window again later.
Toggles a shell window between visible and hidden states.
id
string
required
The id attribute of the target <window> element.
Returns: An empty string.
<!-- Toggle the start menu with the Windows key -->
<hotkey keys="Win" action="window.toggle(startMenu)"/>

Real-world example: start menu

The default RedEye start menu uses window.toggle to open on Win and window.hide to close when focus is lost:
<!-- keyBindings.xml -->
<hotkey keys="Win" action="window.toggle(startMenu)"/>
<!-- startMenu.xml -->
<window
    id="startMenu"
    type="topMost"
    autoShow="false"
    onDeactivate="window.hide(startMenu)">
    ...
    <!-- Opens the shutdown options sub-window -->
    <button text="Shutdown..." onClick="window.show(shutdownOptions)"/>
</window>

System window functions (wapi.*)

Use these functions to control any Win32 window by its handle. In RWML, the handle is most often available as ${window.handle} inside a <windowList> template, where it refers to the handle of the currently-rendered window entry.
Minimizes the specified system window.
handle
number
required
The integer HWND handle of the window to minimize.
Returns: An empty string.
<button onClick="wapi.minimizeWindow(${window.handle})"/>
Restores (un-minimizes) the specified system window to its previous size and position.
handle
number
required
The integer HWND handle of the window to restore.
Returns: An empty string.
<button onClick="wapi.restoreWindow(${window.handle})"/>
Brings the specified system window to the foreground and gives it keyboard focus.
handle
number
required
The integer HWND handle of the window to activate.
Returns: An empty string.
<button onClick="wapi.activateWindow(${window.handle})"/>
Toggles a system window between its normal state and minimized. If the window is minimized, it is restored and activated; otherwise it is minimized.
handle
number
required
The integer HWND handle of the window to toggle.
Returns: An empty string.
<!-- Clicking a taskbar icon toggles the corresponding window -->
<image
    id="icon"
    src="${window.icon}"
    dock="fill"
    onClick="wapi.toggleWindow(${window.handle})"
    toolTip="${window.title}"/>
Sends a close message to the specified system window (equivalent to clicking the window’s X button).
handle
number
required
The integer HWND handle of the window to close.
Returns: An empty string.
<!-- Right-click context menu on a taskbar item -->
<contextMenu for="icon">
    <item action="wapi.closeWindow(${window.handle})">Close window</item>
</contextMenu>
Minimizes every system window that is currently tracked by the shell event listener. Equivalent to “Show Desktop”.Returns: An empty string.
<button text="Show Desktop" onClick="wapi.minimizeAllWindows()"/>
Restores every system window that was previously minimized by the shell event listener.Returns: An empty string.
<button text="Restore All" onClick="wapi.restoreAllWindows()"/>
Toggles the minimize state of all tracked system windows. The first call minimizes all windows; the second call restores them. State is tracked internally per shell session.Returns: An empty string.
<!-- Show/hide desktop with a single button -->
<button text="Desktop" onClick="wapi.toggleAllWindows()"/>

Real-world example: taskbar window list

The default taskbar uses wapi.toggleWindow on click and wapi.closeWindow in the context menu:
<!-- taskbar.xml -->
<windowList
    x="${taskbar.item.size}"
    y="0"
    width="calc('${taskbar.width} - ${taskbar.tray.width} - ${taskbar.item.size}')"
    height="${taskbar.height}">

    <panel
        width="${taskbar.item.size}"
        height="${taskbar.item.size}"
        backgroundColor="if(${window.isActive}, ${theme.color.backgroundActive}, ${theme.color.backgroundChild})">

        <image
            id="icon"
            src="${window.icon}"
            dock="fill"
            onClick="wapi.toggleWindow(${window.handle})"
            toolTip="${window.title}"/>

        <contextMenu for="icon">
            <item action="wapi.closeWindow(${window.handle})">Close window</item>
        </contextMenu>
    </panel>
</windowList>

PowerSearch launcher

PowerSearch is the built-in application launcher. These functions open or configure it from expressions.
Opens the PowerSearch launcher overlay.Returns: An empty string.
<!-- Open PowerSearch with Win+R (default binding) -->
<hotkey keys="Win+R" action="powerSearch.open()"/>

<!-- Or from a button in the start menu -->
<button text="Run..." onClick="powerSearch.open()"/>
Sets a configuration option for the PowerSearch launcher at runtime.
key
string
required
The configuration key to set.
value
string
required
The value to assign to the configuration key.
Returns: An empty string.
<eval command="powerSearch.config(width, 600)"/>
<eval command="powerSearch.config(font, 'Consolas,12')"/>

Real-world example: key bindings

<!-- keyBindings.xml -->
<hotkeys>
    <!-- Toggle start menu with Windows key -->
    <hotkey keys="Win" action="window.toggle(startMenu)"/>

    <!-- Open PowerSearch launcher with Win+R -->
    <hotkey keys="Win+R" action="powerSearch.open()"/>
</hotkeys>

Expression functions

General-purpose expression functions.

Shell windows

Define and configure shell window elements.

Hotkeys

Bind window functions to keyboard shortcuts.

Build docs developers (and LLMs) love