Each pill now shows the icon the app's .desktop file names (Icon=), looked up in the freedesktop icon themes, instead of the letter tile. The tile stays as the fallback for windows with no app id, no desktop file or no icon the host can read. - WIT: a new `icons` capability (`app-icon(app-id) -> u32`, a handle, never a path or pixels) and an `image(image-op)` draw op (appended, so existing modules keep their ABI). taskbar-widget and plasmoid-host import `icons`. Host raster gains `load-image(path)` and a `draw-image` op; the plasmoids host gets an icons table (6: app id, handle). - Compositor (shell/icons.mbt): window app id -> desktop file (resolve_app_id, so StartupWMClass and last-dotted-part matches work) -> Icon= -> theme lookup (XDG data dirs, ~/.icons, flatpak exports; hicolor, Adwaita, breeze; 48/64/32 px PNG first, then scalable SVG when the host can draw it, then other sizes, then /usr/share/pixmaps). Absolute Icon= paths are used as they are. Results are cached per app id; the table is published only when a module imports `icons`. - wasm host (host-wasm): PNG via the png crate, SVG via resvg (rendered sharp at each size), PNGs area-averaged to the drawn size; loads cached by path. - Native build: a small PNG decoder (compositor/renderer/png.mbt: inflate + filters, 1-16 bit, palettes with tRNS) and the Image op in the software renderer. SVG-only icons fall back to the tile there. The wasmer stub serves `icons.app-icon` from the same table. - Tests: PNG decoder fixtures (all filters, fixed/dynamic/stored blocks, palette), image scaling and drawing, icon lookup order, Icon= parsing, task module icon-or-tile (native and wasmtime), host raster PNG+SVG loading and drawing. Checked end to end with the wasm host: foot's hicolor icon shows on its pill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhmtDt52EjaW8jevGU
This commit is contained in:
53 files changed
+2284
-473
No files matched your search
@@ -69,6 +69,15 @@ interface windows {
|
||||
|
||||
}
|
||||
|
||||
/// App icons. The host finds the app's .desktop file (by desktop id or StartupWMClass), reads its
|
||||
/// Icon= key and looks it up in the freedesktop icon themes; the widget only gets a handle to draw
|
||||
/// with a `draw-op.image`, never a path or pixels.
|
||||
interface icons {
|
||||
/// The icon of the app whose windows carry `app-id`, or 0 when the host has none (draw your
|
||||
/// own stand-in then).
|
||||
app-icon: func(app-id: string) -> u32;
|
||||
}
|
||||
|
||||
/// The window manager's layout mode (tiling / monocle / floating).
|
||||
interface layout-control {
|
||||
/// Display names, indexed by mode.
|
||||
|
||||
@@ -40,7 +40,8 @@ interface plasmoids {
|
||||
/// Row tables, as built by compositor/wasm: a LE u32 row count, then per row each field as a LE
|
||||
/// i32 ('i') or a LE u32 byte length + UTF-8 ('s'). `which`: 0 apps (sssss: id name comment
|
||||
/// category glyph), 1 windows (isii: id title focused minimized), 2 layouts (s), 3 modules
|
||||
/// (sssi: id name path loaded), 4 instances (sss: slot module name), 5 wallpapers (s), 6 session settings (s).
|
||||
/// (sssi: id name path loaded), 4 instances (sss: slot module name), 5 wallpapers (s), 6 session
|
||||
/// settings (s), 7 icons (si: app id, raster image handle from `raster.load-image`) served by `icons.app-icon`.
|
||||
publish-table: func(which: u32, rows: list<u8>);
|
||||
/// Layout mode (0 tiling, 1 monocle, 2 floating) and whether the Interface Explorer is on.
|
||||
publish-state: func(layout-mode: s32, inspector-on: bool);
|
||||
|
||||
@@ -14,6 +14,8 @@ interface raster {
|
||||
record disc { cx: s32, cy: s32, radius: s32, color: color, filled: bool }
|
||||
/// `align`: 0 left, 1 centre, 2 right of `x`; `y` is the text's vertical centre.
|
||||
record label { x: s32, y: s32, text: string, size: s32, color: color, align: u8, bold: bool, mono: bool }
|
||||
/// An image from `load-image`, scaled to fill `area`.
|
||||
record picture { area: rect, image: u32 }
|
||||
variant op {
|
||||
fill-rect(fill),
|
||||
stroke-rect(stroke),
|
||||
@@ -22,6 +24,7 @@ interface raster {
|
||||
draw-text(label),
|
||||
push-clip(rect),
|
||||
pop-clip,
|
||||
draw-image(picture),
|
||||
}
|
||||
|
||||
/// A toplevel: its decoration (drawn at `geometry` minus the insets), then its client surface.
|
||||
@@ -52,6 +55,9 @@ interface raster {
|
||||
/// host surface. `format` is the wl_shm format (0 ARGB8888, 1 XRGB8888). 0 on failure.
|
||||
capture: func(fd: s32, offset: s32, stride: s32, width: s32, height: s32, format: s32) -> u32;
|
||||
release: func(id: u32);
|
||||
/// Decode the PNG or SVG file at `path` into a host image (an app icon), for `draw-image`.
|
||||
/// Loading the same path again returns the same handle. 0 when it can't be read or decoded.
|
||||
load-image: func(path: string) -> u32;
|
||||
/// Draw a frame into the host framebuffer.
|
||||
submit: func(f: frame);
|
||||
/// The framebuffer as RGBA8888 (for screenshots and tests; the display path never needs it).
|
||||
|
||||
@@ -26,6 +26,9 @@ interface types {
|
||||
/// `origin` is the left edge (align=left), centre (center) or right edge
|
||||
/// (right) of the text, at the vertical *middle* of the line box.
|
||||
record text-op { origin: point, text: string, style: text-style }
|
||||
/// An image the host holds, scaled to fill `rect`. `image` is a handle a capability handed
|
||||
/// out (`icons.app-icon`); 0 or an unknown handle draws nothing.
|
||||
record image-op { rect: rect, image: u32 }
|
||||
|
||||
/// The render-list vocabulary. Components never touch pixels: they return
|
||||
/// a list of these in their own local coordinate space (origin top-left),
|
||||
@@ -38,6 +41,7 @@ interface types {
|
||||
text(text-op),
|
||||
push-clip(rect),
|
||||
pop-clip,
|
||||
image(image-op),
|
||||
}
|
||||
|
||||
variant input-event {
|
||||
|
||||
@@ -40,6 +40,7 @@ world pulse-widget {
|
||||
world taskbar-widget {
|
||||
include widget;
|
||||
import windows;
|
||||
import icons;
|
||||
}
|
||||
|
||||
/// Layout switcher.
|
||||
@@ -70,6 +71,7 @@ world plasmoid-host {
|
||||
import session;
|
||||
import wallpaper;
|
||||
import session-settings;
|
||||
import icons;
|
||||
export plasmoid;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user