FreeDesktop icon names
Typed Kotlin constants for the FreeDesktop Icon Naming Specification — used by notification-linux, launcher-linux, and any Linux UI that resolves icons by theme.
Linux icon themes work by name: instead of shipping info.png, you reference dialog-information and the user's theme renders its own version. The FreeDesktop spec defines the canonical names. freedesktop-icons exposes them as typed Kotlin constants.
TL;DR
- Sealed
FreedesktopIconhierarchy mirrors the spec's categories. - Custom names, file paths,
file://URIs, ISO country flags supported. - Shared by
notification-linuxandlauncher-linux— usually pulled in transitively.
Install
dependencies {
implementation("dev.nucleusframework:nucleus.freedesktop-icons:<version>")
}Transitive
If you already depend on notification-linux or launcher-linux, freedesktop-icons is included via api() — no separate declaration needed.
Quickstart
import dev.nucleusframework.freedesktop.icons.FreedesktopIcon
val info = FreedesktopIcon.Status.DIALOG_INFORMATION
val open = FreedesktopIcon.Action.DOCUMENT_OPEN
val printer = FreedesktopIcon.Device.PRINTER
val custom = FreedesktopIcon.Custom("my-app-icon") // theme lookup
val path = FreedesktopIcon.Custom("/home/me/icon.png") // absolute path
val uri = FreedesktopIcon.Custom("file:///home/me/icon.png")
val flag = FreedesktopIcon.flag("fr") // "flag-fr"How it works
Every constant compiles down to its spec name (e.g. dialog-information). When you pass it to a Linux toolkit module — notifications, launcher quicklists, tray icons — the value is serialised over D-Bus or written into a .desktop file as plain text. The OS's active icon theme resolves it to a concrete image at render time, so your app picks up the user's theme automatically.
Reference
Categories
FreedesktopIcon is a sealed interface with these subtypes (each mirroring a section of the spec):
| Category | Examples |
|---|---|
FreedesktopIcon.Action | DOCUMENT_OPEN, EDIT_COPY, MEDIA_PLAYBACK_START |
FreedesktopIcon.Status | DIALOG_INFORMATION, DIALOG_WARNING, BATTERY_LOW |
FreedesktopIcon.Device | PRINTER, CAMERA_PHOTO, INPUT_KEYBOARD |
FreedesktopIcon.Application | INTERNET_WEB_BROWSER, MULTIMEDIA_VOLUME_CONTROL |
FreedesktopIcon.MimeType | TEXT_PLAIN, APPLICATION_PDF, IMAGE_PNG |
FreedesktopIcon.Place | FOLDER, USER_HOME, NETWORK_SERVER |
FreedesktopIcon.Emblem | EMBLEM_IMPORTANT, EMBLEM_FAVORITE |
FreedesktopIcon.Custom(value) | inline value class for raw strings / paths / URIs |
Country flags
FreedesktopIcon.flag("us") // "flag-us"
FreedesktopIcon.flag("jp") // "flag-jp"Use cases
- Tray icons that match the user's theme on Linux — pair with
composenativetrayusingFreedesktopIcon.Custom("my-app")for a per-theme symbolic icon. - Notification icons — pass directly to
notification-linux. - Launcher quicklists — reuse the same constants in your
.desktopactions.
Notes
- Not every theme implements every icon name. Stick to the canonical FreeDesktop set for highest hit rate.
- On non-Linux platforms the constants still compile (they are just strings) but produce no visible effect.
macOS menu bar
Build the native macOS menu bar declaratively from Compose — SF Symbols, keyboard shortcuts, badges, submenus, checkboxes, radio buttons.
App lifecycle, from cold launch to sleep
The OS-facing surface of a Nucleus app — instance locking, deep links, login launch, background work, energy.