Skip to content

Notify, copy, open links and launch apps ​

Call these from an event handler: a press, a toggle, a submitted entry. Each returns at once and reports nothing back.

Send a notification and copy text ​

notify runs notify-send and copy runs wl-copy from your applet's process, so install libnotify and wl-clipboard. A missing tool prints one line to stderr; the applet keeps running.

tsx
import { copy, notify } from "glimpse-sdk";

notify({ summary: "Todo saved", body: "Your list is ready.", urgency: "normal" });
copy("Buy groceries");
python
ctx.notify("Todo saved", body="Your list is ready.", urgency="normal")
ctx.copy("Buy groceries")
go
ctx.Notify(sdk.Notification{Summary: "Todo saved", Body: "Your list is ready.", Urgency: "normal"})
ctx.Copy("Buy groceries")
rust
ctx.notify("Todo saved", Some("Your list is ready."), None, Some("normal"));
ctx.copy("Buy groceries");

The notification uses your desktop entry's name and icon unless you pass an icon. Urgency is low, normal or critical; anything else is normal.

tsx
openUri("https://github.com/alex-oleshkevich/glimpse");
python
ctx.open_uri("https://github.com/alex-oleshkevich/glimpse")
go
ctx.OpenURI("https://github.com/alex-oleshkevich/glimpse")
rust
ctx.open_uri("https://github.com/alex-oleshkevich/glimpse");

The panel opens http, https, mailto and file URIs up to 2,048 bytes in your default application. A file URI opens a folder or a document; the panel refuses anything that would run a program, such as a script, a binary, a desktop entry or an installer.

Launch an app and close the popover ​

tsx
import { ActionRow, launch, usePopover } from "glimpse-sdk";

function Files() {
  const popover = usePopover();
  return (
    <ActionRow
      title="Files"
      onActivate={() => {
        launch("org.gnome.Nautilus");
        popover.close();
      }}
    />
  );
}
python
ctx.launch("org.gnome.Nautilus")
ctx.close_popover()
go
ctx.Launch("org.gnome.Nautilus")
ctx.ClosePopover()
rust
ctx.launch("org.gnome.Nautilus");
ctx.close_popover();

launch takes an installed desktop-file id, with or without .desktop, not a command line. The panel starts the app, so it gets focus and keeps running when your applet restarts.

Released under the BSD 3-Clause license.