Skip to main content

Module window_icon

Module window_icon 

Source
Expand description

Setting the host console/terminal window icon (#577).

§Capability-reported, never assumed

Most terminals do not let a running program change their window icon, and they do not say so — the API call succeeds and nothing happens. Windows Terminal is the case that matters most: GetConsoleWindow returns a real handle to a hidden pseudo-console window, so WM_SETICON succeeds against a window nobody can see.

A function that returns Ok(()) there would be worse than one that fails: the caller would ship a feature that silently does nothing on the default terminal of every recent Windows install. So support is probed and reported, and set_host_icon refuses rather than pretending.

§What is supported

Classic Windows console (conhost.exe) only, for now. Everything else reports IconSupport::Unsupported with a reason. Linux/X11 is a plausible later addition; macOS Terminal.app and iTerm2, Windows Terminal, Wayland compositors, and most modern emulators deliberately reserve the window decoration to themselves, and no in-process API changes that.

Modules§

ico
Locating the best image inside an .ico blob (#577).

Enums§

IconError
Why setting an icon failed.
IconScope
Which window an icon operation targets.
IconSource
Where an icon comes from.
IconSupport
Whether this process can set its host window’s icon.
StockIcon
A stock icon provided by the operating system.

Functions§

host_icon_support
Whether this process’s host window can accept an icon.
icon_support
Whether a window can accept an icon.
set_host_icon
Set the icon on this process’s host console window.
set_icon
Set the icon on the window named by scope.