Skip to content

Conversation

@frye
Copy link

@frye frye commented Nov 3, 2025

100% Vibe coded. But seems to work on my badge (and simulator)

This pull request adds support for organizing badge apps into subfolders within the launcher, allowing users to navigate nested menus and group apps by category. The changes update both the documentation and the launcher logic to support folders, submenus, and improved icon handling.

Launcher navigation and folder support:

  • The launcher now recognizes folders (directories without __init__.py) as navigable submenus, automatically adding a "back" entry at the top of each submenu and hiding system apps like menu and startup from the user-facing list. (badge/apps/menu/__init__.py, .github/copilot-instructions.md) [1] [2]
  • Users can navigate into folders and back out using the menu, with the launcher tracking the current path and updating the displayed entries and icons accordingly. (badge/apps/menu/__init__.py)

Icon and entry improvements:

  • The icon loader and entry scanner have been refactored to support custom icons for apps, folders, and back navigation, using new default icons for folders and back entries. (badge/apps/menu/__init__.py, badge/apps/menu/icon.py) [1] [2]
  • The code now uses an entry dictionary for each menu item, simplifying the logic for rendering, navigation, and launching apps. (badge/apps/menu/__init__.py)

Documentation updates:

  • The project documentation has been updated to describe both the default and submenu-enabled launcher structures, with explanations of how folders and hidden apps are handled. (.github/copilot-instructions.md) [1] [2]

Note: Some existing apps may not support being placed into a subfolder. If an app fails to launch from within a subfolder, it needs to be updated—most likely because it has a hardcoded path to the app directory instead of detecting it during launch.

Copilot AI review requested due to automatic review settings November 3, 2025 05:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds subfolder navigation support to the badge menu launcher, allowing apps to be organized into directories. The menu can now browse into folders without __init__.py files, display folder-specific icons, and navigate back using a ".." entry.

  • Implements hierarchical folder navigation with path stack management
  • Adds folder and back navigation icons with fallback handling
  • Refactors app discovery to support nested directory structures

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
badge/apps/menu/init.py Replaces flat app list with recursive folder scanning, adds navigation functions and refactors update loop to handle folder/back entries
badge/apps/menu/icon.py Adds sprite_for() function to load appropriate icons based on entry kind with fallback logic
badge/apps/menu/folder_icon.png New PNG icon for folder entries
badge/apps/menu/folder_up_icon.png New PNG icon for back navigation
.github/copilot-instructions.md Documents the new subfolder structure and navigation behavior

@frye frye changed the title Subfolder support Subfolder support in the menu Nov 3, 2025
@frye
Copy link
Author

frye commented Nov 3, 2025

I went on and added quick fixes to the existing apps so that they should launch also from subfolders. I also updated the simulator to support these changes.

@frye frye marked this pull request as draft November 3, 2025 08:18
@frye
Copy link
Author

frye commented Nov 3, 2025

There is a fundamental problem with updating the main.py. It is overwritten when the badge is woken up from deep sleep which causes the subfolder support to fail and the badge to not boot properly. I need to fix this before this can be considered ready to merge.

@frye
Copy link
Author

frye commented Nov 3, 2025

Ok, the full restart issue should now have been fixed as well.

@frye frye marked this pull request as ready for review November 3, 2025 09:39
@frye frye requested a review from Copilot November 3, 2025 09:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.

frye and others added 4 commits November 3, 2025 01:43
Removing duplicate import.

Co-authored-by: Copilot <[email protected]>
Removing duplicate imports.

Co-authored-by: Copilot <[email protected]>
Removing unused imports

Co-authored-by: Copilot <[email protected]>
Adding comments

Co-authored-by: Copilot <[email protected]>
@frye
Copy link
Author

frye commented Nov 3, 2025

  • Added badge/badge_app_runtime.py with ensure_app_path plus prepare_app_path fallback so apps resolve their directory and update sys.path/cwd whether they live at the root or inside subfolders.
  • Updated every bundled app (badge, copilot-loop, crypto, flappy, gallery, invaders, monapet, quest, sketch, stocks, weather, wifi) to guard /system on sys.path, import the helper with legacy fallback, and call ensure_app_path; badge now tolerates missing GITHUB_TOKEN.
  • Hardened menu launcher: safer folder scanning, smoother pagination when browsing multi-page folders, and new default folder/back icons.
  • Brought simulator in line with device behavior by loading badge_app_runtime before running apps.
  • Left firmware main.py untouched (deep-sleep resets), keeping all subfolder support within the menu and helper.

@martinwoodward
Copy link
Contributor

Hey @frye - given the limited storage on the badge, is subfolder support something you've found yourself needing already?

@martinwoodward
Copy link
Contributor

Fairly big change, so going to hold off bringing this in for now as I quite like the simplicity of not having apps in subfolders especially given the limited storage on the device.

@martinwoodward martinwoodward marked this pull request as draft November 3, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants