Tabs, spaces and containers
Find tabs, organise them and work with separate browsing contexts.
Developer preview · macOS · Python SDK 1.1Find and open tabs
from browse import command, tabs
@command("Count GitHub tabs", id="github-count")
async def count_github():
found = await tabs.query(url="*.github.com")
return f"{len(found)} GitHub tabs"| Call | Result |
|---|---|
| await tabs.all() | All visible tab records returned by Browse. |
| await tabs.current() / tabs.get(id) | A Tab, or None when unavailable. |
| await tabs.query(...) | Tabs matching every supplied filter: space, container, section, pinned, loaded, url, title and older_than. |
| await tabs.open(url, container=None, space=None, background=False) | A new Today tab; defaults to the current space and its container. |
query title matching is case-insensitive; url accepts a pattern or list of patterns. older_than accepts durations such as "1h" and uses the tab’s last-active time. A Tab is a snapshot: fetch it again when you need current values.
Change a tab
| Operation | Behaviour |
|---|---|
| await tab.close() / tab.archive() | Archive Today tabs. Pinned tabs and favourites unload and reset to their home address. |
| await tab.select() | Select the tab. Little Browse tabs cannot be selected or closed by extensions. |
| await tab.pin() / tab.unpin() | Change whether the tab is pinned. |
| await tab.navigate(url) / tab.reload() | Navigate or reload. |
| await tab.move(container) | Reopen in another container; cookies do not follow it. |
| tab.page | A Page for page APIs; pages:<pattern> is still required. |
Tab fields are id, url, title, container_id, space_id, section, loaded, selected and last_active. section is favourite, pinned, today or little. pinned is true for pinned tabs and favourites. last_active_at exposes the timestamp as a UTC datetime. url and space_id can be absent.
Spaces and containers
| Call | Permission |
|---|---|
| await spaces.list(); await spaces.current() | spaces |
| await spaces.create("Reading"); await space.select(); await space.tabs() | spaces; space.tabs() also uses tabs |
| await containers.list(); await containers.create("Shopping", color="#FF5BA8") | containers |
Import spaces and containers from browse. Use an object or its id when passing a space or container to tab methods. Containers separate browsing sessions. Moving a tab does not transfer its existing signed-in session.
Search history
from browse import command, history
@command("Find Python in history", id="python-history")
async def find_python():
visits = await history.search("python", limit=20)
return f"Found {len(visits)} visits"Visits expose url, title, container_id and visited_at. The default limit is 20; Browse bounds it between 1 and 200.