Add dock module: dock-style quick launcher with magnifying app tiles
CI / test (push) Failing after 23s
CI / test (push) Failing after 23s
- lib/dock: tile layout, hit-testing, magnification, per-app colours (tested) - components/dock: plasmoid module (imports only app-catalog + app-launch) - shell: panel widgets now get pointer-move / pointer-leave while hovered Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79321790a1
commit
6fc921b431
15 files changed
+930
No files matched your search
@@ -0,0 +1,42 @@
|
||||
///| Implementation of `moonplasma:desktop/plasmoid` for the dock: a row of app tiles
|
||||
/// that magnify under the pointer and start the app on click. The tile layout and
|
||||
/// hit-testing live in lib/dock; this adapts host capabilities.
|
||||
|
||||
///| Tile under the pointer, or -1.
|
||||
let hover : Ref[Int] = Ref::new(-1)
|
||||
|
||||
///| Height of the widget at its last render (events carry no size).
|
||||
let height : Ref[Int] = Ref::new(34)
|
||||
|
||||
///|
|
||||
pub fn info() -> PlasmoidInfo {
|
||||
{
|
||||
id: "org.moonplasma.dock",
|
||||
name: "Dock",
|
||||
preferred: { w: @logic.preferred_width(@app_catalog.list_apps().length()).reinterpret_as_uint(), h: 34U },
|
||||
min_width: 60,
|
||||
stretch: false,
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn render(size : @types.Size) -> Array[@types.DrawOp] {
|
||||
height.val = size.h.reinterpret_as_int()
|
||||
@logic.render(size, @theme.get_tokens(), @app_catalog.list_apps(), hover.val)
|
||||
}
|
||||
|
||||
///| Dock tiles have no popup.
|
||||
pub fn popup() -> PopupSurface? {
|
||||
None
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn on_event(_target : Surface, event : @types.InputEvent) -> Bool {
|
||||
let (h, redraw, launch) = @logic.handle(@app_catalog.list_apps(), hover.val, height.val, event)
|
||||
hover.val = h
|
||||
match launch {
|
||||
Some(id) => ignore(@app_launch.launch(id))
|
||||
None => ()
|
||||
}
|
||||
redraw
|
||||
}
|
||||
Reference in new issue
Block a user