Skip to content

android.windows and open(w.key): bring a Linux window back to the front from a widget - #286

Open
petrzpav wants to merge 3 commits into
SimonSchubert:mainfrom
petrzpav:linux-windows
Open

petrzpav wants to merge 3 commits into
SimonSchubert:mainfrom
petrzpav:linux-windows

Conversation

@petrzpav

Copy link
Copy Markdown
Contributor

What

Widgets can see the Linux windows the launcher shows, and bring one back to the front.

  • source w = android.windows (owl 23): the open Linux windows, oldest first, each {key, appId, title, name, icon}. name and icon are what the window's card in Android's recents shows.
  • open(w.key) moves that window's task to the front, and leaves the drawer or a panel as opening an app does. A key for a window that has closed since does nothing.

Why

My home screen has a widget that shows my coding agents, the herdr ones and Claude Code sessions running in launcher terminals (foot --app-id=omarchy.claude-edit-<name>). Tapping an agent should take me to it. herdr agents can be focused with a command, but nothing a widget can do brings a particular Linux window forward:

  • open() only reaches drawer apps.
  • launch() re-fronts a window only for a desktop entry, and terminal apps return before that.
  • The compositor has no xdg-activation.

The launcher already knows the windows (wm.appWindows) and how to front one (Runtime.bringToFront); this hands that to widgets.

How

  • WidgetServices.windows() lists wm.appWindows, with each window's key w:<handle> (the handle its Recents card carries). The flow is a snapshotFlow throttled like android.drawer's, to at most once a second, because a busy terminal retitles with every frame of its program's spinner.
  • openApp takes w: keys before the app lookup. Runtime.showWindow(handle) reuses bringToFront, and on success AppHandlers.leave (the part of launch that clears the bar and closes the panel) runs.
  • It never starts a new task for the window: a second activity would draw the same toplevel, and finishing either closes it. A window without a task has nothing to come back to anyway.
  • icon:w:<handle> resolves in appIconOf through Runtime.appOfWindow, the same lookup LinuxWindowActivity uses for its Recents card.
  • Compiler: windows in ANDROID, SINCE 23, LEVEL 23. Its command line is "read the open Linux windows (names and titles)", and Review flags it, since titles carry folders, file names and commands. The privacy policy gets a sentence too, per ARCHITECTURE.md's recipe for a private android.* source.
  • Docs: android.md, handlers.md (open), versions.md and the README's level.

What to look at

  • owl 23 is shared with notification: and onNotification: a widget's own notification, counting down on the lock screen, with buttons #280 (notification:). AGENTS.md says to add to an unreleased level, so both are at 23. Whichever lands second only conflicts on the SINCE tail and the versions.md line, which become one **23** bullet.
  • Throttle. One second for title changes is a guess. Without it, an agent's spinner re-evaluated every widget reading the source on each retitle.
  • No app-side unit test. windows() needs a Runtime with live toplevels. LangTest covers the compiler side, the command line and the review warning.
  • No focused. I left it out on purpose: MainActivity clears focus on every home resume, so a widget on home would always see it false.

Testing

  • :owl:test :app:testDebugUnitTest :app:assembleDebug :app:lintDebug pass on my PC. That includes the new LangTest.androidWindows (compile, owl 22 rejected, the command line, the review warning). Lint reports nothing new in the changed files.
  • Not tested on a device. I had no adb connection to the phone when this went up. Still unproven:
    • open(w.key) bringing a foot window forward from a home widget and from a panel;
    • the panel closing after it;
    • a closed window's key doing nothing;
    • icon:w:<handle> drawing the Recents icon;
    • the one-second throttle under an agent's spinner.

🤖 Generated with Claude Code

petrzpav and others added 2 commits November 13, 2026 09:22
…nt: `android.windows` (owl 23) gives each window's app_id, title, name and icon as its Recents card has them, and `open(w.key)` moves its task forward and leaves the drawer as opening an app does, so a widget listing agent sessions can go to the terminal one runs in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y on the runner (its 40 matches finished inside the budget); it passes locally and nothing here touches regexes or the budget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@petrzpav
petrzpav marked this pull request as ready for review November 13, 2026 08:44
… not yet released, as 23 and 24 have shipped (1.7.0 has 24), and sit beside android.strip in the sources; the drawer's and the launcher's changes follow AppDrawer.kt and Launcher.kt to ui/home, where the source tree reorganisation moved them (40c8a10)

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.

1 participant