Managing Radiance X Windows on Windows (WSL2 + VcXsrv)


Managing Radiance X Windows on Windows (WSL2 + VcXsrv)

Many Radiance tools (rview, ximage, objview, etc.) open X11
windows.
Under Windows + WSL2, those windows can:

  • Open oversized\
  • Appear off-screen\
  • Ignore geometry hints\
  • Behave inconsistently with multi-monitor or RDP

Here is a stable setup and a simple solution.


:one: Disable WSLg (Use Pure X11)

On Windows 11, WSLg (Wayland/Weston) is enabled by default.
For deterministic X11 behavior, disable it.

Create:

C:\Users\<username>\.wslconfig

Contents:

[wsl2]
guiApplications=false

Then in PowerShell:

wsl --shutdown

:two: Install and Launch VcXsrv

Install VcXsrv.

Launch it with:

vcxsrv.exe :0 -multiwindow -clipboard -wgl -ac

Important flag:

-ac

This disables access control so WSL clients can connect.

Inside WSL (~/.bashrc):

export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0

Test:

xclock

:three: The Window Placement Problem

Radiance tools such as:

  • rview
  • ximage
  • objview

often open at inconvenient sizes or positions.

rview -geometry is unreliable under Windows window management.

Rather than fighting the X window manager, control placement from
Windows.


:four: Practical Solution: AutoHotkey Hotkey Snap

Install AutoHotkey (v2).

Create a script like:

#Requires AutoHotkey v2.0
#SingleInstance Force

; Ctrl+Alt+M → snap active window to lower-right quarter
^!m:: {
    MonitorGetWorkArea(1, &L, &T, &R, &B)
    monW := R - L
    monH := B - T

    x := Floor(monW/2)
    y := Floor(monH/2)
    w := Floor(monW/2)
    h := Floor(monH/2)

    WinRestore("A")
    WinMove(x, y, w, h, "A")
}

Run the script. Then:

  1. Open rview, ximage, or objview
  2. Press Ctrl+Alt+M
  3. The window snaps to the lower-right quadrant

This works regardless of:

  • Screen resolution
  • RDP vs local console
  • Multi-monitor setups

It avoids continuous auto-snapping and lets users move windows freely
afterward.


:five: Summary

For Radiance on Windows via WSL2:

  • Disable WSLg\
  • Use VcXsrv with -ac\
  • Set DISPLAY properly\
  • Use AutoHotkey for window control

This provides a stable and predictable X11 workflow for Radiance users.


**XWin_LowerRightQuarter.ahk**

#Requires AutoHotkey v2.0
#SingleInstance Force

; Ctrl+Alt+M → snap active window to lower-right quarter
^!m:: {
    ; Get primary monitor work area (excludes taskbar)
    MonitorGetWorkArea(1, &L, &T, &R, &B)
    monW := R - L
    monH := B - T

    x := Floor(monW/2)
    y := Floor(monH/2)
    w := Floor(monW/2)
    h := Floor(monH/2)

    WinRestore("A")
    WinMove(x, y, w, h, "A")
}

; Optional: Ctrl+Alt+F → full screen (monitor work area)
^!f:: {
    MonitorGetWorkArea(1, &L, &T, &R, &B)
    WinRestore("A")
    WinMove(L, T, R-L, B-T, "A")
}

; Optional: Ctrl+Alt+C → center window at 1200x800
^!c:: {
    MonitorGetWorkArea(1, &L, &T, &R, &B)
    monW := R - L
    monH := B - T

    w := 1200
    h := 800
    x := L + Floor((monW - w)/2)
    y := T + Floor((monH - h)/2)

    WinRestore("A")
    WinMove(x, y, w, h, "A")
}
2 Likes