sway-icon-to-go
- #Go
- #Sway
- #Font Awesome
Sway workspace renaming from running apps — Font Awesome icons, event-driven IPC.
github.com/vicdeo/sway-icon-to-go →
Why this exists
Sway workspace labels default to whatever windows happen to be open. With a dozen apps across nine workspaces, manual renaming does not scale. This daemon keeps workspace names in sync with what is actually running — optionally as Font Awesome glyphs instead of raw app names.
Inspired by i3-workspace-names-daemon, rewritten in Go for a Sway daily driver.
How it works
A long-lived process subscribes to Sway window events via go-sway (window move, new, title, close). On each relevant event it walks the window tree, resolves app names per window, maps them to icons, and issues batched rename workspace commands — only when the formatted name actually changed.
No polling loop. The IPC connection is event-driven.
Icon resolution
- Match window title against
app-icons.yaml(exact name, then regex patterns). - Fall back to process name from
/procvia PID. - Map app name → Font Awesome UTF-8 glyph via
fa-icons.yaml.
An in-memory LRU cache (default capacity 50) avoids repeated map/regex lookups for hot apps. Config reload clears the cache.
Configuration
YAML files live under ~/.config/sway/ (or ~/.config/i3/ — Sway takes precedence):
| File | Purpose |
|---|---|
app-icons.yaml |
App name → icon name (one-to-many, lowercase) |
fa-icons.yaml |
Icon name → UTF-8 code point |
Generate a default fa-icons.yaml from upstream Font Awesome CSS:
sway-icon-to-go parse > ~/.config/sway/fa-icons.yaml
Hot reload without restart: pkill -HUP sway-icon-to-go
Deployment
exec sway-icon-to-go # sway config
make install-service # user systemd unit
Formatting flags: unique icons only (-u), name trim length (-l), separator (-d).
What it is not
Not a general Wayland compositor plugin. Sway-specific, with i3 config directory compatibility for the YAML files. Requires Font Awesome installed on the system for icon glyphs to render.