OS integrationIcons
FreeDesktop icon names
Typed Kotlin constants for the names defined by the FreeDesktop Icon Naming Specification.
freedesktop-icons provides the names of the
FreeDesktop Icon Naming Specification
as typed Kotlin constants. You send dialog-information instead of shipping info.png, and the
user's Linux icon theme draws its own version.
freedesktop-iconsGradle plugin: Not neededWindow runtime: Not neededAdd the dependency
dependencies {
implementation("dev.nucleusframework:nucleus.freedesktop-icons:3.0.0")
}notification-linux and launcher-linux already bring it.
Reference an icon
Pick the constant from the category enum that matches its context:
val info = FreedesktopIcon.Status.DIALOG_INFORMATION
val printer = FreedesktopIcon.Device.PRINTER
// A name outside the specification, an absolute path, or a file:// URI
val named = FreedesktopIcon.Custom("my-app-icon")
val path = FreedesktopIcon.Custom("/home/user/icon.png")
// Country flag from an ISO 3166-1 alpha-2 code
val flag = FreedesktopIcon.flag("FR") // Custom("flag-fr")- Themes do not implement every name. Names from the core specification have the best chance of a match.
- Flag names are not part of the specification. They resolve only in themes that ship
flag-<code>icons. - The module compiles on every OS, but no theme resolves the names outside Linux.
API reference
| Category | Examples |
|---|---|
FreedesktopIcon.Action | DOCUMENT_OPEN, EDIT_COPY, MEDIA_PLAYBACK_START |
FreedesktopIcon.Animation | PROCESS_WORKING |
FreedesktopIcon.Application | ACCESSORIES_TEXT_EDITOR, MULTIMEDIA_VOLUME_CONTROL, UTILITIES_TERMINAL |
FreedesktopIcon.Category | APPLICATIONS_INTERNET, PREFERENCES_DESKTOP, SYSTEM_HELP |
FreedesktopIcon.Device | PRINTER, CAMERA_PHOTO, INPUT_KEYBOARD |
FreedesktopIcon.Emblem | IMPORTANT, FAVORITE, SHARED |
FreedesktopIcon.Emote | FACE_SMILE, FACE_SAD, FACE_WINK |
FreedesktopIcon.MimeType | TEXT_X_GENERIC, IMAGE_X_GENERIC, X_OFFICE_DOCUMENT |
FreedesktopIcon.Place | FOLDER, USER_HOME, NETWORK_SERVER |
FreedesktopIcon.Status | DIALOG_INFORMATION, DIALOG_WARNING, BATTERY_LOW |
FreedesktopIcon.Custom(value) | Inline value class, sent unchanged: theme name, absolute path or file:// URI |
FreedesktopIcon.flag(countryCode) | Lowercases the code and returns Custom("flag-<code>") |
Each constant holds its specification name in value.
What's next
- Notifications on Linux: pass a
FreedesktopIconas the notification icon. - Linux launcher: use the same constants in quicklist items.
- SF Symbols: the typed symbol names for macOS.
Was this page helpful?
Edit on GitHub
Last updated on