Nucleus
OS integration

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 FreedesktopIcon hierarchy mirrors the spec's categories.
  • Custom names, file paths, file:// URIs, ISO country flags supported.
  • Shared by notification-linux and launcher-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):

CategoryExamples
FreedesktopIcon.ActionDOCUMENT_OPEN, EDIT_COPY, MEDIA_PLAYBACK_START
FreedesktopIcon.StatusDIALOG_INFORMATION, DIALOG_WARNING, BATTERY_LOW
FreedesktopIcon.DevicePRINTER, CAMERA_PHOTO, INPUT_KEYBOARD
FreedesktopIcon.ApplicationINTERNET_WEB_BROWSER, MULTIMEDIA_VOLUME_CONTROL
FreedesktopIcon.MimeTypeTEXT_PLAIN, APPLICATION_PDF, IMAGE_PNG
FreedesktopIcon.PlaceFOLDER, USER_HOME, NETWORK_SERVER
FreedesktopIcon.EmblemEMBLEM_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 composenativetray using FreedesktopIcon.Custom("my-app") for a per-theme symbolic icon.
  • Notification icons — pass directly to notification-linux.
  • Launcher quicklists — reuse the same constants in your .desktop actions.

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.