Launcher: pick up web apps as they are installed, categories, scrolling
CI / test (push) Failing after 49s

- Read the app catalog again when the Applications menu opens if .desktop files were added or removed (and on Reload); it was only read at login, so a PWA installed during the session was missing from the menu and its search
- List a Chromium browser's web apps in their own category ("Chrome Apps", "Chromium Apps", ...), as Plasma does; don't take one for the default browser
- Category column and a scrollable list (wheel, scrollbar) when the catalog doesn't fit the menu
- Show menu-spec main category names instead of the first Categories= entry; sort apps A-Z (they were sorted shortest name first)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-28 23:42:10 -08:00
1 parent aa92aaac6f
commit 68baf1a467
11 files changed
+578 -109

No files matched your search

+41 -19
View File
@@ -419,6 +419,10 @@ pub(all) struct DesktopShell {
mut menu_anchor_y : Int
/// Extra bottom inset reserved for panel popups (e.g. an open on-screen keyboard).
mut popup_bottom_inset : Int
/// The .desktop files there were when the catalog was read (`refresh_apps`).
mut app_files : Array[String]
/// Touchpad scrolling over the launcher's popup not yet worth a row, in pixels.
mut popup_scroll : Double
}
///|
@@ -428,23 +432,6 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
let wm_classes : Map[String, String] = {}
let icon_names : Map[String, String] = {}
let terminal_apps : Map[String, Bool] = {}
for a in scan_desktop_apps() {
if a.terminal {
terminal_apps.set(a.id, true)
}
if a.icon.length() > 0 {
icon_names.set(a.id, a.icon)
}
if a.wm_class.length() > 0 {
wm_classes.set(a.wm_class.to_lower(), a.id)
}
let glyph = match a.name.to_array().get(0) {
Some(c) => c.to_string().to_upper()
None => "?"
}
apps.push({ id: a.id, name: a.name, comment: a.comment, category: a.category, glyph })
exec.set(a.id, a.command)
}
let zero : @scene.Rect = { x: 0, y: 0, w: 0, h: 0 }
let sh : DesktopShell = {
apps,
@@ -559,8 +546,10 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
desk_saved: {},
menu_anchor_y: -1,
popup_bottom_inset: 0,
app_files: [],
popup_scroll: 0.0,
}
sh.order_apps()
sh.load_apps()
sh
}
@@ -624,7 +613,9 @@ fn DesktopShell::order_apps(self : DesktopShell) -> Unit {
for key in g {
if !found {
for a in self.apps {
if !found && a.id.to_lower().contains(key) {
// A web app's id holds its browser's name (chrome-<app id>-Default): not the browser.
let web = web_app_category(self.exec.get(a.id).unwrap_or("")) is Some(_)
if !found && !web && a.id.to_lower().contains(key) {
take(a, out, seen)
found = true
}
@@ -762,6 +753,9 @@ fn Widget::has_cap(self : Widget, cap : String) -> Bool {
///| Hand an event to a module, then carry out whatever it asked of the host.
fn DesktopShell::deliver(self : DesktopShell, w : Widget, popup : Bool, ev : @wasm.PlasmoidEvent) -> Bool {
if w.module_id == launcher_module && !popup && w.popup_rect.w == 0 && ev is PointerDown(_, _) {
self.refresh_apps() // the menu is about to open
}
self.publish_host_data()
let changed = w.pl.on_event(popup, ev)
self.process_requests()
@@ -816,6 +810,34 @@ pub fn DesktopShell::launcher_open(self : DesktopShell) -> Bool {
self.launcher_rect() is Some(_)
}
///| Wheel or touchpad over an open panel popup: `notches` wheel clicks, or (0 of those) `px`
/// pixels; + is down. The launcher's list scrolls by rows. False when (x, y) is on no popup.
pub fn DesktopShell::scroll_popup(self : DesktopShell, x : Int, y : Int, px : Double, notches : Int) -> Bool {
let w = match self.popup_at(x, y) {
Some(w) => w
None => return false
}
if w.module_id != launcher_module || (self.menu_open && inside(self.menu_rect, x, y)) {
return true
}
let mut rows = notches * 3
if notches == 0 {
self.popup_scroll = self.popup_scroll + px
rows = (self.popup_scroll / 15.0).to_int()
self.popup_scroll = self.popup_scroll - rows.to_double() * 15.0
}
let key = if rows < 0 { "ScrollUp" } else { "ScrollDown" }
let n = if rows < 0 { -rows } else { rows }
for _ in 0..<n {
ignore(self.deliver(w, true, KeyDown(key)))
}
if n > 0 {
// The rows moved under a still pointer.
ignore(self.deliver(w, true, PointerMove(x - w.popup_rect.x, y - w.popup_rect.y)))
}
true
}
///| Close the launcher's popup if it is open.
pub fn DesktopShell::close_launcher(self : DesktopShell) -> Unit {
for w in self.widgets {