package chandra:desktop@0.1.0; /// Optional export that turns a module into a desktop module: instead of a box in the panel it /// owns the desktop itself, the whole output behind the windows (see docs/desktop-modules.md). /// /// A desktop module is still a plasmoid (it exports `plasmoid` as well, and may export /// `module-config` and import any capability a panel module can), so the same sandbox, draw ops /// and capability grants apply. What changes is how the shell drives it: /// /// - `plasmoid.render` is called with the output's full size (and again with the new size when /// the output is resized), in desktop coordinates: (0, 0) is the output's top-left corner. /// The panel and windows are drawn on top; the module draws the whole area. /// - `plasmoid.on-event` gets the pointer (move, press, release, leave) only where no window, /// panel, popup or menu covers the desktop, and keys only while the desktop has keyboard focus /// (after a click on it, until a window is focused: it then gets `focus-lost`). A right-click /// on the empty desktop always opens the shell's desktop menu (module settings, system /// settings), never reaches the module. /// - `plasmoid.popup` and `plasmoid.info`'s size fields are not used. /// - Hidden settings (a `module-config` item with an empty label) are saved by the shell in /// state.edn whenever their value changes after an event, and handed back at the next load: /// that is how a desktop module keeps state such as icon positions. interface desktop-module { use types.{point}; /// What happens to the wallpaper under the module. enum wallpaper-mode { /// The wallpaper is drawn first and the module draws over it (leaving parts transparent). over-wallpaper, /// The module draws the whole background itself; the wallpaper is not drawn. replace-wallpaper, } /// Read once, right after loading. backdrop: func() -> wallpaper-mode; /// Wheel or touchpad scroll over the empty desktop at `at`: `dx` / `dy` in pixels (positive: /// right / down; one wheel notch is about 10). True when the module wants a redraw. on-scroll: func(at: point, dx: s32, dy: s32) -> bool; /// The animation clock. `now-ms` counts milliseconds from when the module was loaded. It is /// called once after loading, after every event the module handled, and again when the delay it /// last returned has passed. The module is redrawn after each timed call (an animation frame) /// and after events that returned true; a call that follows an event only reschedules the /// clock and does not redraw by itself. Return how many ms until the /// next frame (16 for about 60 frames a second, 33 for 30), or 0 to sleep until the next event: /// an idle desktop module costs nothing, so return 0 whenever nothing moves. Frames are paused /// (no calls) while a window covers the whole desktop. tick: func(now-ms: u32) -> u32; }