Skip to main content

Typed async framework for Glimpse exec applets

Project description

Glimpse Applet Python SDK

Small async framework for building Glimpse exec applets without touching stdio or raw JSON.

Requires Python 3.14+.

Install

pip install glimpse-applet-sdk
# or with uv:
uv add glimpse-applet-sdk

The distribution is named glimpse-applet-sdk on PyPI; the import name is glimpse_sdk.

Develop

Create and live-run a Python applet project with the Glimpse tooling:

glimpse-applet new counter --lang python
cd counter
glimpse-applet dev

Read docs/custom-applets/tooling.md for project layout, applet.toml, dev applets, linking, and diagnostics.

Goals

  • typed protocol models
  • typed widget builders
  • async runtime
  • widget callbacks such as Button(on_click=...), plus decorator-based callbacks for explicit ids
  • separate status(state) and popover(state) methods; state mutation via await self.set_state(...)

Example

from dataclasses import dataclass

from glimpse_sdk import (
    Applet,
    AppletState,
    Box,
    Button,
    ButtonVariant,
    Hero,
    Icon,
    StatusItem,
    Label,
)


@dataclass
class DeployState(AppletState):
    version: str = "2026.04.07"
    status: str = "Ready"


class DeployApplet(Applet[DeployState]):
    def initial_state(self) -> DeployState:
        return DeployState()

    async def status(self, state: DeployState):
        return [
            StatusItem(
                id="deploy",
                icon=Icon.name("software-update-available-symbolic"),
                label=state.status,
            )
        ]

    async def popover(self, state: DeployState):
        return Box.vertical(
            [
                Hero(
                    icon=Icon.name("software-update-available-symbolic"),
                    title="Deploy",
                    subtitle=state.version,
                ),
                Label(label="Version"),
                Button(
                    label="Deploy now",
                    on_click=self.on_deploy,
                    icon="media-playback-start-symbolic",
                    variant=ButtonVariant.PRIMARY,
                ),
            ]
        )

    async def on_deploy(self, state: DeployState, _event) -> None:
        await self.set_state(status="Deploying")


if __name__ == "__main__":
    DeployApplet().run()

IPC client

Talk to a running Glimpse daemon: subscribe to event channels and dispatch actions. ipc(service) only resolves the socket path — the connection is opened lazily.

import glimpse_sdk

sub = glimpse_sdk.ipc(service="shell")  # "shell" | "wallpaper" | "idle" | "lock"

# Fire an action; awaits the ack, raises IpcError if the server rejects it.
ack = await sub.dispatch("open_uri", {"uri": "https://example.com"})

# Stream events until the socket closes.
async for ev in sub.listen("audio.*"):
    print(ev.name, ev.fields)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glimpse_applet_sdk-0.7.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glimpse_applet_sdk-0.7.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file glimpse_applet_sdk-0.7.0.tar.gz.

File metadata

  • Download URL: glimpse_applet_sdk-0.7.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glimpse_applet_sdk-0.7.0.tar.gz
Algorithm Hash digest
SHA256 041402ac6fb21173121b3801ff877058e9bc68f178c5fac2c94f19fb4b20a0bf
MD5 1f291a1e1d42667fbb3f51c19618a17d
BLAKE2b-256 32a204147738968cfb0c9cad26e24b23ccb51ca0f493e7fd86cc267f4a0d6afe

See more details on using hashes here.

Provenance

The following attestation bundles were made for glimpse_applet_sdk-0.7.0.tar.gz:

Publisher: release-sdk-py.yml on alex-oleshkevich/glimpse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file glimpse_applet_sdk-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for glimpse_applet_sdk-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9422cd18f06de6be693317ee9776c7f45b1ecfee079aeb9c4fc73d3bba61edb6
MD5 96a602046a9db97666ed8af30375b2aa
BLAKE2b-256 c84d39165c3679069a617ba48fe3a1e920b58b0bcbc6b065add79c36aaf96ed3

See more details on using hashes here.

Provenance

The following attestation bundles were made for glimpse_applet_sdk-0.7.0-py3-none-any.whl:

Publisher: release-sdk-py.yml on alex-oleshkevich/glimpse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page