Skip to content

feat(grouper): remember collapsed state across restarts - #1216

Open
berkay8987 wants to merge 1 commit into
amnweb:mainfrom
berkay8987:feat/grouper-remember-collapsed
Open

berkay8987 wants to merge 1 commit into
amnweb:mainfrom
berkay8987:feat/grouper-remember-collapsed

Conversation

@berkay8987

Copy link
Copy Markdown

Summary

Closes #1081.

The grouper always started collapsed, so every restart (including config/stylesheet changes with watching off) hid widgets that had been expanded. This saves the collapsed state and restores it on start, like the systray does since #1019.

  • State is saved to grouper_state.json under %LOCALAPPDATA%\Yasb, keyed by screen_name:widget_name, so each monitor keeps its own state.
  • It's restored on the grouper's first show, since screen_name and widget_name aren't set yet during construction, and saved on every toggle (button click or toggle_collapse callback).
  • Only groupers with a collapse button read or write state. A missing or unreadable file falls back to the old default (collapsed), and the next toggle rewrites it.
  • Docs for collapse_options.enabled describe the new behavior.

Testing

  • New tests/widgets/test_grouper.py: default collapsed, expanded and re-collapsed state survive a restart, state is per screen, a corrupt file falls back to collapsed, and nothing is saved without a collapse button.
  • ruff format, ruff check and pyright (strict) are clean; the full suite passes (2144 passed, 1 skipped).

AI usage

Claude Code was used to help write and review this change. I have reviewed every line and tested it.

🤖 Generated with Claude Code

The grouper always started collapsed, so every restart (including
config or stylesheet reloads with watching off) hid widgets the user
had expanded. The state is now saved to grouper_state.json in the app
data folder, keyed by screen and widget name, and restored on first
show. A missing or unreadable file falls back to collapsed.

Closes amnweb#1081

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Remember the grouper's collapsed state across restarts

1 participant