Icons: follow the icon theme spec so KDE apps in the dock get real icons
CI / test (push) Failing after 19s
CI / test (push) Failing after 19s
Pinned KDE apps (Konsole, Dolphin, Kate, KWrite, System Settings) showed letter tiles because their Icon= names a theme icon (utilities-terminal, system-file-manager, preferences-system) that only breeze has, and breeze keeps icons in <context>/<size> (apps/48), which the hard-coded <size>x<size>/apps lookup never looked in. The lookup now reads each theme's index.theme (Directories, sizes, Type, Scale), picks the closest directory as the spec says, searches the user's theme (kdeglobals [Icons] Theme, GTK settings.ini, $CHANDRA_ICON_THEME) and its Inherits chain, then hicolor, then breeze and Adwaita. It also tries the desktop id and its last dotted part, and falls back to the theme's generic application-x-executable icon before the letter tile. Misses are logged. The dock's first pins are now the installed default browser, file manager, terminal and editor (Settings > Apps) instead of the catalog's first five. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hkNwArmSLRGcuxUMhw
This commit is contained in:
4 files changed
+553
-54
No files matched your search
@@ -86,6 +86,50 @@ fn DesktopShell::dock_app_ids(self : DesktopShell) -> Array[String] {
|
||||
out
|
||||
}
|
||||
|
||||
///| The dock's first pins: the default web browser, file manager, terminal and text editor (as
|
||||
/// Settings > Apps has them, `defaults` being each category's current app id or "") that are
|
||||
/// installed, topped up from the catalog's first apps when that gives fewer
|
||||
/// than three. Only apps in `apps` (the installed ones) are pinned.
|
||||
fn default_dock_pins(defaults : Array[String], apps : Array[@types.AppEntry]) -> Array[String] {
|
||||
let installed = apps.map(a => a.id)
|
||||
let out : Array[String] = []
|
||||
let add = fn(id : String) {
|
||||
if id.length() > 0 && installed.contains(id) && !out.contains(id) && out.length() < @dock.default_pin_count {
|
||||
out.push(id)
|
||||
}
|
||||
}
|
||||
for cat in ["browser", "files", "terminal", "editor"] {
|
||||
for i, c in app_categories {
|
||||
if c.id == cat && i < defaults.length() {
|
||||
add(defaults[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if out.length() < 3 {
|
||||
for a in apps {
|
||||
add(a.id)
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
///|
|
||||
test "the dock's first pins are the installed default apps" {
|
||||
let app = fn(id : String, cat : String) -> @types.AppEntry {
|
||||
{ id, name: id, comment: "", category: cat, glyph: "X" }
|
||||
}
|
||||
let apps = [
|
||||
app("org.kde.kate", "Utility"), app("org.kde.konsole", "System"), app("org.kde.dolphin", "System"),
|
||||
app("firefox", "Network"), app("systemsettings", "Settings"), app("org.kde.kwrite", "Utility"),
|
||||
]
|
||||
// browser, email, files, terminal, editor, ...; the email client isn't pinned, a missing editor
|
||||
// is skipped.
|
||||
let defaults = ["firefox", "thunderbird", "org.kde.dolphin", "org.kde.konsole", "gone-editor"]
|
||||
assert_eq(default_dock_pins(defaults, apps), ["firefox", "org.kde.dolphin", "org.kde.konsole"])
|
||||
// Nothing configured: the catalog's first apps.
|
||||
assert_eq(default_dock_pins([], apps[:2].to_array()), ["org.kde.kate", "org.kde.konsole"])
|
||||
}
|
||||
|
||||
///| Save the dock's first pinned list the first time it is seen without one (see the top).
|
||||
fn DesktopShell::settle_dock_pins(self : DesktopShell) -> Unit {
|
||||
if self.apps.length() == 0 {
|
||||
@@ -95,7 +139,8 @@ fn DesktopShell::settle_dock_pins(self : DesktopShell) -> Unit {
|
||||
if w.is_dock() {
|
||||
let cfg = dock_config(w)
|
||||
if cfg.pinned is None {
|
||||
self.set_module_setting(w.slot, "pinned", @dock.encode_pins(cfg.pins(self.apps)))
|
||||
let defaults = self.default_app_choices().map(c => c.current_id)
|
||||
self.set_module_setting(w.slot, "pinned", @dock.encode_pins(default_dock_pins(defaults, self.apps)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user