Skip to content

feat(toolbar): add Windows plugin scope - #2016

Merged
eythaann merged 3 commits into
eythaann:masterfrom
kain-tm:feat/toolbar-windows-scope-workspace-icons
Nov 25, 2026
Merged

eythaann merged 3 commits into
eythaann:masterfrom
kain-tm:feat/toolbar-windows-scope-workspace-icons

Conversation

@kain-tm

@kain-tm kain-tm commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Toolbar plugins that render workspaces (the bundled @default/workspaces-* family) can only enumerate windows as raw handles: the Workspaces scope exposes DesktopWorkspace.windows: number[] (hwnds), while the AppIcon() helper needs an exe path or umid to resolve an icon. There is currently no way for a plugin script to map a window handle to its application, so per-workspace app icons (i3/polybar-style) are impossible to implement as a plugin — to get them today I have to run a local HTTP daemon that serves hwnd → PNG to the toolbar (see "Workaround this replaces" below). This scope removes the need for such hacks.

What this PR does

  1. New Windows scope — injects the full UserAppWindow[] (hwnd, title, umid, process.path, …) backed by GetUserAppWindows. Implemented with the same LazyScope pattern as the other scopes in scopes.svelte.ts; the resolver is shared with dock plugins, so the dock gets it for free. The toolbar already subscribes to this exact command/event internally (getters.svelte.ts → interactables), this change just exposes the data to plugin scripts as well.
  2. Docs — new row in the scope table of documentation/toolbar-plugins.md.

An earlier revision of this PR also bundled a @default/workspaces-icons toolbar module as a showcase for the scope. Per review it was removed in 29a7a25 — the module lives on as an external plugin, so nothing under src/ is touched anymore.

Testing

  • The repo's type-check script (tsc --noEmit, svelte-check, deno check) passes locally on the trimmed tree.
  • The scope change mirrors the existing focusedApp scope pattern verbatim.

Workaround this replaces (context)

With Seelen UI 2.8.10 I run the bundled-style module deployed locally against a small daemon: the toolbar template builds Image({ url: "http://127.0.0.1:6129/icon/<hwnd>.png" }) and a helper extracts SHDefExtractIcon PNGs per hwnd. It works, but it is an external process, misses UWP umid resolution and can't provide window titles. The scope in this PR makes all of that native and removes the daemon.

Related

The remoteData problem mentioned in the original description (state_unsafe_mutation on flush) was fixed in #2017.

The Workspaces scope only exposes raw window handles per workspace
(DesktopWorkspace.windows), while AppIcon() requires an exe path or
umid, so plugins cannot render per-workspace application icons.

- add a `Windows` scope injecting the full UserAppWindow[] from
  GetUserAppWindows (same LazyScope pattern as the other scopes; the
  toolbar already tracks this data internally for overlap detection)
- add bundled `@default/workspaces-icons` toolbar module: workspaces as
  pills with up to 5 real app icons each (joined by hwnd), window
  titles in the tooltip, dotted-style fallback for empty workspaces,
  click-to-switch preserved
- document the new scope

Screenshots and a sandbox-level simulation of the module template are
described in the PR.
@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes extend plugin data access and add a toolbar workspace option.

Satisfy the repository's theme and translation requirements before merging.

Summary

Adds a shared Windows scope and the bundled @default/workspaces-icons toolbar module.

  • Plugins can now read the full details for user app windows.
  • Workspace buttons can now show icons for their open apps.

Reviews (1) · Last reviewed commit: "feat(toolbar): add Windows plugin scope ..." · Reviewed by Greptile

Comment on lines +79 to +81
if (isActive) {
pillStyle.backgroundColor = "color-mix(in srgb, var(--system-accent-color) 22%, transparent)";
pillStyle.boxShadow = "0 0 0 1.5px var(--system-accent-color)";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Plugin breaks theme and translation rules

The new module violates requirements in AGENTS.md:

  • Widget visuals must live in the default theme. Move the pill decoration out of the template and replace the 22% color mix with --slu-std-ui-selected-overlay.
  • User-facing text must use i18n. Localize Workspace and more in the tooltips.
  • Only English translation entries may be edited directly. Leave the non-English entries in display_name.yml to the translation workflow.

These repository requirements must be satisfied before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

…ions

Review feedback on this PR:
- move static pill styling out of the template into the default theme
  (themes/default/styles/fancy-toolbar.scss, scoped by data-plugin-id);
  templates now carry state styles only (selected overlay token,
  dotted fallback for empty workspaces)
- replace the ad-hoc `color-mix(... 22%, transparent)` with the
  `--slu-std-ui-selected-overlay` token and drop the decorative
  box-shadow ring
- localize user-facing strings (`Workspace`, `+N more`) through `t()`
  with new `workspaces_icons` keys in the toolbar en.yml
- keep display_name.yml to its `en` entry; other locales belong to the
  translation workflow
@kain-tm

kain-tm commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @greptile-apps — all three points are addressed in 8cc6756:

  • Theme rule: static pill styling moved out of the template into the default theme (themes/default/styles/fancy-toolbar.scss, scoped by data-plugin-id); the template now only carries state styles — the active workspace uses the --slu-std-ui-selected-overlay token (the ad-hoc color-mix and the decorative box-shadow are gone), and the empty-workspace fallback keeps the dotted-module pattern.
  • i18n: user-facing strings now go through t() with new workspaces_icons keys added to the toolbar en.yml only.
  • Translations: display_name.yml reduced to its en entry, leaving the rest to the translation workflow.

Verified with a sandbox-level simulation of the template (20 assertions: scope join, caps, tokens, i18n fallbacks), the repo test suite, and the full type-check.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Perfect! All three concerns are now fully addressed:

✅ Theme rule: The static pill styling is properly extracted to fancy-toolbar.scss with data-plugin-id scoping. The template only retains state-dependent styles (the --slu-std-ui-selected-overlay token for active workspaces and the dotted fallback), which is exactly the right separation.

✅ i18n: User-facing strings now use t() with dedicated workspaces_icons keys in en.yml. The parameterized "+{{0}} more" for overflow titles is properly implemented.

✅ Translations: display_name.yml correctly contains only the en entry, leaving other languages to the translation workflow.

The implementation looks solid. The scope addition follows the established LazyScope pattern, and the module demonstrates the new capability cleanly.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@eythaann eythaann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

keep the new scope, but the changed done in the src folder remove them, keep the module for yourself in the fork or make it a external plugin so you could share it in the website.

… scope

Per review, the PR keeps only the new Windows scope and its docs row. The module,
its default-theme styles and its toolbar i18n keys are removed from the app;
the module will live on as an external plugin.
@kain-tm kain-tm changed the title feat(toolbar): add Windows plugin scope and workspaces-with-icons module feat(toolbar): add Windows plugin scope Nov 24, 2026
@kain-tm

kain-tm commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 29a7a25 — the module, its default-theme styles and its toolbar i18n keys are removed, so src/ is back to master. The PR now only adds the Windows scope in scopes.svelte.ts and its row in documentation/toolbar-plugins.md. type-check passes locally on the trimmed tree.

I'm keeping the module for myself as a local plugin for now.

@eythaann
eythaann merged commit 9954823 into eythaann:master Nov 25, 2026
1 check passed
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