no all icons are shown #1

Open
opened 2026-08-25 11:26:56 +03:00 by zordsdavini · 1 comment
Owner

some icons are missing but in other menu drawer apps they have.

some icons are missing but in other menu drawer apps they have.
debesielis added
wip
and removed
plan
labels 2026-08-25 16:17:02 +03:00
Collaborator

STATUS: DONE

Goal

Restore missing application icons by fixing path resolution logic and implementing standard XDG icon fallback mechanisms.

Analysis

  • Current Behavior: Some apps display no icon; other launchers handle this using XDG_DATA_DIRS search paths for both absolute and relative icon names defined in .desktop files.
  • Root Cause: Likely, the current implementation resolves icon paths strictly without searching standard system theme directories (/usr/share/icons, /usr/share/pixmaps) or handling relative path fallbacks properly.
  • Strategy: Audit desktop.go extraction logic to validate both absolute and icon-name-only strings. Add a function to search fallback locations. Update UI rendering to handle missing images gracefully by reverting to text label (as per project docs).

Implementation Steps

  • STEP-01: Identify Specific Missing Icon Scenarios

    • Action: Run tsTart -list and compare generated list against expected .desktop sources. Inspect specific app configurations in /usr/share/applications that fail to render icons locally.
    • Prerequisite: Go binary built and systemd/xdg environment variables populated.
    • Verification: Log a report of file paths where .desktop files claim an icon but the image does not exist at the exact path stored in memory.
  • STEP-02: Implement Icon Path Resolution Logic in desktop.go

    • Action: Update desktop.EntryIcon() function to check existence at ExecPath, then /usr/share/icons/hicolor/..., then $HOME/.icons. Handle relative paths (e.g., icon-name) by searching these directories.
    • Prerequisite: File system access and path resolution functions defined in Go standard library/path.
    • Verification: Unit tests verify that an app with icon name apps resolves to /usr/share/icons/hicolor/48x48/apps.png if absolute path is invalid.
  • STEP-03: Enhance Image Loading Handler in main.go

    • Action: Modify the Gio image loading callback to catch gio.Error when loading failed PNGs. If load fails after searching fallback directories, set state to "NoIcon".
    • Prerequisite: Access to main.go and Gio's Image.Load() API reference.
    • Verification: No panics occur when an app lacks a valid icon file; the image widget gracefully renders null or placeholder instead of crashing rendering loop.
  • STEP-04: Update UI Render Logic for Missing Icons (Fallback)

    • Action: In Gio render loop, check icon.Valid() status. If invalid, render application name text with selected font/color instead of empty space.
    • Prerequisite: Access to the rendering logic component (likely within main.go or ui.go).
    • Verification: Launcher grid displays app name text clearly when icon is missing, matching behavior described in project documentation ("fallback to first letter").
  • STEP-05: Add Unit Tests for Icon Fallback Scenarios

    • Action: Update desktop_test.go with test cases using mock .desktop files that specify non-existent icons. Assert that the parsing logic sets a correct fallback path or text.
    • Prerequisite: Go testing environment (go test ./...).
    • Verification: All existing tests pass; new tests for "Missing Icon" scenarios run successfully against testing.T without errors.

Acceptance Criteria

  • Apps with invalid relative icon paths in .desktop files now search standard XDG directories.
  • Apps with missing icons display text fallback instead of blank space.
  • No regression in apps that previously displayed valid absolute icons.
  • Code compiles without warnings or dependency errors.

Risks/Notes

  • Risk: System environment variables (e.g., $XDG_DATA_DIRS) vary per user setup; ensure logic defaults to standard paths rather than relying solely on env vars in tests.
  • Note: Gio framework may require specific image/vector configurations for scaling icons; verify that resolution search does not cause memory overhead issues during startup.
  • Risk: Performance impact of searching multiple directories should be minimized by caching path resolutions if feasible (keep within scope).
STATUS: DONE ## Goal Restore missing application icons by fixing path resolution logic and implementing standard XDG icon fallback mechanisms. ## Analysis - **Current Behavior:** Some apps display no icon; other launchers handle this using `XDG_DATA_DIRS` search paths for both absolute and relative icon names defined in `.desktop` files. - **Root Cause:** Likely, the current implementation resolves icon paths strictly without searching standard system theme directories (`/usr/share/icons`, `/usr/share/pixmaps`) or handling relative path fallbacks properly. - **Strategy:** Audit `desktop.go` extraction logic to validate both absolute and icon-name-only strings. Add a function to search fallback locations. Update UI rendering to handle missing images gracefully by reverting to text label (as per project docs). ## Implementation Steps - [ ] STEP-01: Identify Specific Missing Icon Scenarios - **Action:** Run `tsTart -list` and compare generated list against expected `.desktop` sources. Inspect specific app configurations in `/usr/share/applications` that fail to render icons locally. - **Prerequisite:** Go binary built and `systemd/xdg` environment variables populated. - **Verification:** Log a report of file paths where `.desktop` files claim an icon but the image does not exist at the exact path stored in memory. - [ ] STEP-02: Implement Icon Path Resolution Logic in `desktop.go` - **Action:** Update `desktop.EntryIcon()` function to check existence at `ExecPath`, then `/usr/share/icons/hicolor/...`, then `$HOME/.icons`. Handle relative paths (e.g., `icon-name`) by searching these directories. - **Prerequisite:** File system access and path resolution functions defined in Go standard library/path. - **Verification:** Unit tests verify that an app with icon name `apps` resolves to `/usr/share/icons/hicolor/48x48/apps.png` if absolute path is invalid. - [ ] STEP-03: Enhance Image Loading Handler in `main.go` - **Action:** Modify the Gio image loading callback to catch `gio.Error` when loading failed PNGs. If load fails after searching fallback directories, set state to "NoIcon". - **Prerequisite:** Access to `main.go` and Gio's `Image.Load()` API reference. - **Verification:** No panics occur when an app lacks a valid icon file; the image widget gracefully renders null or placeholder instead of crashing rendering loop. - [ ] STEP-04: Update UI Render Logic for Missing Icons (Fallback) - **Action:** In Gio render loop, check `icon.Valid()` status. If invalid, render application name text with selected font/color instead of empty space. - **Prerequisite:** Access to the rendering logic component (likely within `main.go` or `ui.go`). - **Verification:** Launcher grid displays app name text clearly when icon is missing, matching behavior described in project documentation ("fallback to first letter"). - [ ] STEP-05: Add Unit Tests for Icon Fallback Scenarios - **Action:** Update `desktop_test.go` with test cases using mock `.desktop` files that specify non-existent icons. Assert that the parsing logic sets a correct fallback path or text. - **Prerequisite:** Go testing environment (`go test ./...`). - **Verification:** All existing tests pass; new tests for "Missing Icon" scenarios run successfully against `testing.T` without errors. ## Acceptance Criteria - [ ] Apps with invalid relative icon paths in `.desktop` files now search standard XDG directories. - [ ] Apps with missing icons display text fallback instead of blank space. - [ ] No regression in apps that previously displayed valid absolute icons. - [ ] Code compiles without warnings or dependency errors. ## Risks/Notes - **Risk:** System environment variables (e.g., `$XDG_DATA_DIRS`) vary per user setup; ensure logic defaults to standard paths rather than relying solely on env vars in tests. - **Note:** Gio framework may require specific `image/vector` configurations for scaling icons; verify that resolution search does not cause memory overhead issues during startup. - **Risk:** Performance impact of searching multiple directories should be minimized by caching path resolutions if feasible (keep within scope).
Sign in to join this conversation.
No labels
comment
dev
plan
stuck
wip
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
zordsdavini/tstart#1
No description provided.