-
-
Notifications
You must be signed in to change notification settings - Fork 6
Protocol Events
coe0718 edited this page May 23, 2026
·
3 revisions
Subscribe to real-time events from the desktop.
{"type": "events.subscribe", "events": ["window.*", "clipboard.*"]}Response:
{
"type": "response",
"status": "ok",
"data": {
"subscribed": ["window.*", "clipboard.*"]
}
}{"type": "events.unsubscribe", "events": ["window.*"]}{
"type": "event",
"event": "window.focused",
"data": {
"window_id": "12345678",
"app_id": "org.gnome.Terminal"
},
"timestamp": "2024-01-15T10:30:00Z"
}| Event | Description | Data |
|---|---|---|
window.focused |
Window gained focus |
window_id, app_id
|
window.unfocused |
Window lost focus |
window_id, app_id
|
window.opened |
New window opened |
window_id, title, app_id
|
window.closed |
Window closed |
window_id, app_id
|
window.moved |
Window moved |
window_id, x, y
|
window.resized |
Window resized |
window_id, width, height
|
| Event | Description | Data |
|---|---|---|
clipboard.changed |
Clipboard content changed |
content_type, preview |
clipboard.history.added |
History entry added |
entry_id, text
|
| Event | Description | Data |
|---|---|---|
input.keyboard |
Key pressed |
key, combo
|
input.mouse.click |
Mouse clicked |
x, y, button
|
input.mouse.scroll |
Mouse scrolled |
dx, dy
|
| Event | Description | Data |
|---|---|---|
monitor.connected |
Display connected |
output, width, height
|
monitor.disconnected |
Display disconnected | output |
monitor.changed |
Display settings changed |
output, scale, rotation
|
Use wildcards to subscribe to multiple events:
{"type": "events.subscribe", "events": ["window.*", "monitor.*"]}Subscribe to all events:
{"type": "events.subscribe", "events": ["*"]}import socket
import json
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect("/run/user/1000/deskbrid.sock")
# Subscribe to events
sock.send(b'{"type": "events.subscribe", "events": ["window.*"]}\n')
# Read events
while True:
data = sock.recv(4096)
for line in data.decode().strip().split('\n'):
event = json.loads(line)
if event.get("type") == "event":
print(f"{event['event']}: {event['data']}")import asyncio
import json
async def watch_events(client, patterns):
"""Watch for events matching patterns."""
await client.send({"type": "events.subscribe", "events": patterns})
while True:
event = await client.recv()
if event.get("type") == "event":
yield event["event"], event["data"]
# Usage
async for event_type, data in watch_events(client, ["window.*"]):
print(f"Event: {event_type}")- Accessibility
- Apps
- Audio
- Backlight (LED driver)
- Bluetooth
- Clipboard
- Color Picker
- Desktop Portal
- Desktop Settings
- Files
- Hotkeys
- Input
- Keyboard Layouts
- Media (MPRIS)
- Monitors
- Network
- Notifications
- Print (CUPS)
- Screenshots
- Screen Recording
- Screencast
- Self-Update
- System
- System Tray
- Systemd Units & Timers
- Terminals (PTY)
- Windows & Workspaces