Nucleus
OS integrationIcons

FreeDesktop icon names

Typed Kotlin constants for the names defined by the FreeDesktop Icon Naming Specification.

View as Markdown

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-iconsLinuxGradle plugin: Not neededWindow runtime: Not needed

Add the dependency

build.gradle.kts
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

CategoryExamples
FreedesktopIcon.ActionDOCUMENT_OPEN, EDIT_COPY, MEDIA_PLAYBACK_START
FreedesktopIcon.AnimationPROCESS_WORKING
FreedesktopIcon.ApplicationACCESSORIES_TEXT_EDITOR, MULTIMEDIA_VOLUME_CONTROL, UTILITIES_TERMINAL
FreedesktopIcon.CategoryAPPLICATIONS_INTERNET, PREFERENCES_DESKTOP, SYSTEM_HELP
FreedesktopIcon.DevicePRINTER, CAMERA_PHOTO, INPUT_KEYBOARD
FreedesktopIcon.EmblemIMPORTANT, FAVORITE, SHARED
FreedesktopIcon.EmoteFACE_SMILE, FACE_SAD, FACE_WINK
FreedesktopIcon.MimeTypeTEXT_X_GENERIC, IMAGE_X_GENERIC, X_OFFICE_DOCUMENT
FreedesktopIcon.PlaceFOLDER, USER_HOME, NETWORK_SERVER
FreedesktopIcon.StatusDIALOG_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

Was this page helpful?
Edit on GitHub

Last updated on