Skip to content

Latest commit

 

History

History
351 lines (301 loc) · 20.8 KB

LINUX.md

File metadata and controls

351 lines (301 loc) · 20.8 KB

Hemony for Linux

Hemony on the desktop: at home on GNOME, at ease everywhere else. It shares one codebase with the Apple apps. It works best on GNOME and runs well on Hyprland, Xfce and KDE, without forcing GNOME's look on anyone.

So: one codebase where it is not the screen, GNOME's own way where it is, and nothing of GNOME's desktop needed to run it.

One codebase

Swift on both. Swift runs on Linux as on the iPhone (the kit has been tested there from the first day). Linux lacks Apple's screens and sound, so those two are written per platform, each its own way.

iPhone and iPad Linux
Servers, library, radio, mixes, lyrics, play state JukeboxKit/, the same package the same
The app's stores: LibraryStore, RadioController, MixStore, HistoryStore, HandoffStore, OfflineStore, AppSettings, Stats, HomeShelves, LyricsFinder, the queue's types; the wide window's PanelState, DesktopMeasures and UpNextList Jukebox/ the same files, named in Package.swift's shared
Screens SwiftUI (Jukebox/) GTK 4 and libadwaita (Linux/App/)
Sound AVFoundation (Jukebox/Player/AudioPlayer.swift) GStreamer (Linux/App/AudioPlayer.swift), the same queue and rules
The session's secret the Keychain the desktop's keyring, or a file only the user reads
Songs kept Application Support, a background URLSession (docs/OFFLINE.md) $XDG_DATA_HOME/jukebox/offline, a URLSession while Hemony runs
System controls lock screen, remote commands MPRIS (Linux/CGlue/mpris.c)

The kit and the app's stores compile for both. Linux's own code is Swift, with a little C as glue only, for what Swift cannot call as it is (C functions with "…", macros, D-Bus by hand).

A shared file stays shared by importing only Foundation, Observation and JukeboxKit. Linux compiles them as project.yml does for the iPhone (Swift 5 mode, the main actor by default), so a change to one is checked here before CI's Mac sees it.

Building and running

dev/linux-build.sh            # in Docker: no Swift needed on the machine
.build-linux/debug/Jukebox
dev/linux-install.sh          # release build into ~/.local, with icon and desktop entry
dev/linux-flatpak.sh          # the release build as a Flatpak -> build/flatpak/
dev/linux-appimage.sh         # and as an AppImage -> build/appimage/

The image (dev/linux/Dockerfile) is Swift 6.2 on Ubuntu 24.04 with GTK 4.14, libadwaita 1.5 and GStreamer; those versions are the floor. Swift's own libraries are linked into the binary. A machine that runs it needs GTK 4, libadwaita, GStreamer (with its good and bad plugins, for MP3, FLAC, AAC and HLS), libsecret, libsoup 3 (the websocket, Play On) and libcurl (Foundation's networking): libraries, nothing of a desktop.

The Flatpak (Linux/data/io.github.simmmmm.Jukebox.yml) is that same binary in GNOME's runtime, for a distribution below the floor, attached to each release since 15 November 2026. It is not built again there: Flathub's Swift is 6.3, and one toolchain means a release is what was run here. dev/linux-flatpak.sh install installs it, release attaches it to GitHub's release (docs/RELEASE.md).

The AppImage is the second file on a release, for people without Flatpak (16 November 2026). dev/linux-appimage.sh puts the same binary together in Docker with Ubuntu 24.04's own libraries: GTK, libadwaita, GStreamer with the plugins the player uses (MP3, FLAC, AAC, ALAC through libav, HLS, PulseAudio, which PipeWire serves too), libsoup and GLib's TLS, the Adwaita icons, the settings schemas, the MIME database. Linux/data/AppRun points each at its own copy, and every library finds the others beside it (an rpath, not LD_LIBRARY_PATH). The few the graphics drivers share (X11, Wayland, libdrm, zlib) are the computer's own where it has them, so Mesa finds the versions it was built with; the file lends its copies only to a system without them. appimagetool 1.9.1 and the type2 runtime 20251108 come from their GitHub releases, checked by sha256. It is 126 MB, most of it the binary, ICU's data and libav. It carries the AppStream metainfo too (usr/share/metainfo), which appimagetool checks. dev/linux-appimage.sh release attaches it to GitHub's release, beside the Flatpak.

The computer brings glibc 2.38 and GCC 13's libstdc++ or newer (Ubuntu 24.04, Debian 13, Fedora 39 and up, Arch), and what every desktop has: fonts, the graphics drivers, and a sound server (PulseAudio, or PipeWire's Pulse; without one Hemony plays in silence).

What in the AppImage is not MIT, with the GPL notices (16 November 2026). Hemony's own code is MIT (LICENSE). Beside it, the file carries:

  • GPL-2.0-or-later: FFmpeg's libraries (libav), Ubuntu's build with x264, x265 and libpostproc; the shared-mime-info database.
  • LGPL: GTK, GLib, GStreamer and its plugins, libsoup, libadwaita.
  • LGPL-3.0 or CC-BY-SA-3.0: the Adwaita icons.
  • Apache-2.0 with the Runtime Library Exception: Swift's runtime and Foundation, in the binary; with them ICU, under the Unicode licence.
  • The other libraries under their own licences, as Ubuntu ships them.

They are Ubuntu 24.04's (noble) packages, unchanged. The file carries, in usr/share/doc/jukebox/ (--appimage-extract shows it), LICENSE, PACKAGES (each package's name and version, and its source package), each package's copyright file under copyright/, and the licence texts they point to under common-licenses/. The corresponding source comes from Ubuntu: apt-get source <source>=<version> on noble, or launchpad.net/ubuntu/+source/. Swift's is at github.com/swiftlang.

Tried, 16 November 2026: on this machine under Xvfb and under mutter, headless, on Wayland (drawn with OpenGL), and in a bare Fedora 44 container (no GTK, no GStreamer, no X11; this machine's fonts lent to it), it signs in to the fake Jellyfin, walks every screen and plays song after song; in the container through a PulseAudio server beside it. HTTPS verifies on Fedora and Arch with their own certificates (curl and GStreamer on the file's libraries). Not yet tried: HLS from a real Jellyfin, a real desktop session with sound.

JUKEBOX_AUDIO_SINK=fakesink plays to nowhere, in time, for trying things without sound.

How it is made

  • GTK from Swift, directly (Linux/App/Gtk.swift). GTK is C, and Swift calls C. A page of helpers makes it read like the rest of the app: on(button, "clicked") { … }, and observe(widget) { … }, which runs again whenever something @Observable it read changes, as SwiftUI does for a view's body. No binding library in between: C's GTK is the one that is looked after.
  • The main actor on GLib's loop (main.swift). Swift's main actor is libdispatch's main queue; GTK has the main thread. The queue signals through a file descriptor when it has work, and GLib's loop watches it. Every await comes back between two GTK events.
  • Lists that make only what shows (ItemList): GtkListView and GtkGridView, so Songs is as quick with 20 000 songs as with 20.
  • Gapless (AudioPlayer). GStreamer asks for the next address a moment before a song ends; the queue follows when the new stream starts, as it follows AVQueuePlayer on the iPhone. A short song over a quick network is fetched whole at once, and GStreamer asks as it starts, before its own start reaches the main loop: the first start after a song is loaded is always that song's (until 16 November 2026 the queue took it for the next one's, and ran one song ahead).

At home on GNOME

GNOME's Human Interface Guidelines, with libadwaita's own widgets:

  • a sidebar of places that folds away in a narrow window;
  • each page with its header bar and Back, and the search field at the header's end, the same on every page: a click in it (or Ctrl+F) shows the Search page, which is not in the sidebar;
  • the primary menu (F10) with Preferences, Keyboard Shortcuts and About;
  • GNOME's own context menus, in sections with a line between them (20 November 2026, trackMenu, menuSections), the same order in every song's menu and the Mac's TrackMenu: what its list does with it (Move Up, Move Down, Remove from Queue or Playlist, and on a station Don't Play X Here and Dislike) · Play Next, Add to Queue · Add to Playlist…, the heart, Rating, Start Radio · Go to Album, Go to Artist, Credits · the links and Don't Count Plays. An album's the same, with Play first on its tile. Menus and dialogs sit on Hemony's ground, a step lifted (popover_bg_color, dialog_bg_color in Style.swift);
  • on a server with ratings a song's and an album's menu have Rating, a submenu of None and one to five stars with GNOME's check mark (ratingItems, as the Mac's RatingMenu);
  • toasts for a moment's news, a dialog before signing out;
  • more than one account (17 November 2026, Jukebox/App/Accounts.swift): with two or more, the primary menu lists them as check items, every one on checked (several on are one library, docs/MULTI-SERVER.md); Add Account… shows the sign-in page over the window with Cancel. Preferences › Accounts lists them as AdwSwitchRows, the last one on insensitive, each with its own Sign Out…; the dialog names the account and, for the one signed in, the account Hemony goes on with;
  • Sign In with Plex under Sign In (17 November 2026, SignInPage.swift): plex.tv's page in the default browser (gtk_uri_launcher), the button Cancel while it waits, an alert to choose when the account has more than one server; a Plex address with a password asks for its token instead;
  • Use Quick Connect at sign-in where the server has it on (18 November 2026, SignInPage.swift), as on the iPhone;
  • Play On (17 November 2026, docs/ARCHITECTURE.md): the bar's glyph where the Mac has AirPlay opens a popover of this computer, the Chromecasts Avahi finds and the user's other Jellyfin clients; while the music plays elsewhere the glyph is in the accent, the level is the device's and Full Player says where it plays. The Flatpak may talk to Avahi on the system bus for it (--system-talk-name=org.freedesktop.Avahi). JUKEBOX_CAST_DEVICE="Name@host:port" lists one Chromecast by hand instead, for trying it against a fake one. The Sonos rooms and other UPnP renderers are in it too (19 November 2026, UPnP.swift), found by Avahi and SSDP; JUKEBOX_UPNP_DEVICE=<description URL on 127.0.0.1> lists a fake one instead (dev/fake-upnp-renderer.py). The popover is a libadwaita menu (popover.menu with a list): heading and rows on one edge, the check at the row's end;
  • header capitals on buttons and rows;
  • a playlist of the listener's own edited in place, as on the Mac (since 16 November 2026): a song's menu has Move Up, Move Down and Remove from Playlist in its first section; a song dragged onto another takes its place; the same calls as the Mac's (LibraryStore.remove, move). Moving only where the server can reorder, none of it on someone else's playlist.

Songs are picked with Ctrl and Shift in any list of songs and in Up Next, lit as libadwaita's selected rows; the menu on a pick is for all of them (Move to Top, Move to Bottom and Remove where the list allows). Copy Link is in a song's, an album's and an artist's menu; Choose Picture… in a playlist's ⋮ (an administrator on Jellyfin or Emby); Mini Player in the primary menu (Extras.swift, docs/ARCHITECTURE.md). Picking was tried by mouse under Xvfb (XTest): Ctrl, Shift, the menu, a plain click picking nothing and a double-click or Enter playing (24 November 2026).

The sleep timer is a moon at the end of Full Player's header, beside ⋮, as on the iPhone and the Mac: its menu sets 15 to 60 minutes, End of Song or End of Album, and before the moon stand the time left or what it waits for. The timer is the queue's (PlayQueue, docs/ARCHITECTURE.md); MPRIS knows nothing of it. One limit of gapless: set in a song's last seconds, when GStreamer has already taken the next address, End of Song stops after that next one.

Crossfade is in Preferences' Playing, as the queue's (PlayQueue, docs/ARCHITECTURE.md): playbin's own volume, on the player's ticks, so the handover and gapless albums are as they were.

Keys: Space plays and pauses wherever the focus is, except in a field typed in (Ctrl+Space everywhere), Ctrl+Right and Ctrl+Left skip, Ctrl+F goes to the search field, Ctrl+, opens Preferences, Ctrl+? shows them all. In a list of songs Shift+F10 or the Menu key opens the song's menu, and in a playlist of one's own Delete removes the song.

GNOME's media controls (the clock's menu, the lock screen, the keyboard's keys) see Hemony through MPRIS, with the cover. The Play key (and Space) with nothing loaded goes on where this computer, or another device, left off, else plays Your Station; so Play is always there in GNOME's controls. The icon's menu (a right-click in the dash) has Play Your Station, with Hemony closed too (jukebox --play-station, GApplication's play-station action).

Closing the window while the music plays hides it, and the music plays on, as GNOME's players do; the launcher or the media controls bring it back. Closed with nothing playing, Hemony quits; paused while hidden it stays, so the Play key goes on. Downloads under way (chosen songs, the keep's) hide it too, and hold the app while they run; done, with nothing playing, Hemony ends. Ctrl+Q quits always. A Flatpak asks the background portal once, so GNOME shows it under Background Apps, with a way to end it.

Hemony's soul is in the content, as on the iPhone (docs/BRAND.md, docs/design/tells.md): Copper by day and Glow by night as the accent, Paper and Night as the grounds, titles in a serif, the arch for a station and light for the one on air. Every measure is on the 4-point grid (dev/grid-check.sh walks both platforms).

At ease everywhere else

Hyprland, KDE, XFCE and the rest run it as it is: a GTK app with its own header bar. Their media widgets and playerctl read the same MPRIS.

The sessions go in the keyring where there is one (GNOME Keyring, KWallet): the one signed in as "credentials", as before, and the list of accounts as "accounts". Where there is none, or it does not answer, they go in ~/.local/share/Jukebox/credentials.json and accounts.json, readable by their user alone. A keyring that does not answer is asked once a launch. Measured on a session bus without a keyring: the app starts at once and stays signed in. The Flatpak goes through the desktop's Secret portal instead: libsecret keeps the sessions in the app's own keyring file, with its key from the portal, and the desktop's whole keyring stays shut to it.

It looks like a GNOME app on every desktop: libadwaita does not take another desktop's theme.

The 2027 layout (14 November 2026)

A layout with influences from Spotify and Feishin: like Feishin, a panel shows the lyrics or the queue, as optional additions, and the app must not get busy.

  • The bar is 88 tall and spans the whole window. Its centre (previous, play, next, progress) takes 40% of the window, held between 304 and 640, and sits on the window's centre. The song and tools zones are equal (ThreeZones in PlayerBar.swift).
  • The panel, Now playing, at the right is 360 wide. It shows the queue (shuffle, repeat, the radio's reasons) or Lyrics (synced; click a line to seek). A song to come has a remove button while the pointer is over it, and its menu (right click, or a long press on a touch screen) has Remove from Queue and, on a station, "Don't Play X Here" and Dislike, as the iPhone's swipe and long press. The bar's toggles open, switch and close it, and the app remembers it. It sits beside the page from 1280 wide and lies over it below.
  • The places at the left are 240 wide, the Mac's 1:1: Home, Radio, On Your Hemony; Albums, Artists, Songs, Playlists, Favorites, Genres, Recently Added, Downloaded; the playlists (15 November 2026). Below 900 they fold and lie over the page; F9 brings them back.
  • Preferences › Pages takes places out (AppSettings.hiddenPages, shared). The place shown switched off goes Home. Every one off, there is no sidebar: Home, the panel and the bar, with the main menu at the end of the page's header.
  • Full Player (the cover and the title in the bar open it) covers the places and the page. The bar and the panel stay. In the bar, the artist opens the artist and a station's name the panel.
  • Shelves have no scrollbar over their words. Under the pointer a round ‹ and › fade in, 32 wide, while there is more that way; a click moves on by what shows, less one tile. The keys go along the tiles.
  • A tile's hover lights the tile at its own size, 8 past its art on every side, corners 14, concentric with the art's 6. A grid's cell shows nothing (14 November 2026).

The iPad at regular width and the Mac draw the same window, 1:1 (Jukebox/App/WideShell.swift, docs/ARCHITECTURE.md).

Flathub

Flathub builds from source, so it has a manifest of its own: Linux/data/flathub/io.github.simmmmm.Jukebox.yml. GNOME 50's runtime, Flathub's Swift (org.freedesktop.Sdk.Extension.swift6, Swift 6.3 on the 25.08 base), and swift build offline: JukeboxKit is a path in the package and nothing else is fetched. Swift's own libraries are linked in. It installs the binary, the desktop file, the icon, the metainfo (the page in GNOME Software), the servers' marks and the licence. Linux/App/AppKeys.swift is written empty here, because this repository is public; the copy sent to Flathub gets Hemony's Last.fm key in that line, as every shipped build has it (3 December 2026).

dev/flathub-build.sh            # lint, then build the checkout as Flathub would
dev/flathub-build.sh install    # and install it

The first run fetches the Sdk and the Swift extension (1.2 GB). Sending it:

  1. Tag the release (v1.4) and push the tag; put its commit under the tag: in the manifest (Flathub's lint asks for both).
  2. App id io.github.simmmmm.Jukebox: Flathub checks it against the GitHub account, nothing to prove (the Apple apps keep com.tijmen.Jukebox).
  3. A pull request to github.com/flathub/flathub, branch new-pr, with the manifest; Flathub then makes the app's own repository.

What comes next

Ready, and waiting on a step outside this repository:

  • Flathub: the manifest is ready (below, "Flathub"); sending it is the maintainer's step.
  • Linux on GitHub's runners. CI's kit job builds it and runs its checks only where libadwaita is, the PC's runner (ci/kit.sh); GitHub's Ubuntu has none.

Tried so far

Each under Xvfb or Broadway on this machine, against the test Jellyfin or the fake one, unless it says otherwise.

  • Under Broadway: signing in from the keyring and from the file, Home, Radio, Albums, an album, Now Playing, the radio from song to song, MPRIS's Play, Next and metadata, the handoff both ways.
  • The walk (dev/linux-screens.sh, frames.txt says what came): downloading an album, a playlist and a mix by their buttons and playing one from its file; a station from Radio's +, saved as a playlist; a playlist made, filled and deleted; a song's station from Search.
  • Editing a playlist: Move Up and Down (also by Shift+F10), dragging, Delete, Remove from Playlist; after each, the server's order was the page's.
  • The Flatpak, in its sandbox: signs in from the file, loads the library and its covers.
  • Accounts, with a session bus and keyring of their own and the test Jellyfin's two users: a profile from the build before opened signed in with its history; a second added, switched both ways, playing on each; a server that does not answer kept the account with a toast; one with songs on the computer and its server away played them; signing out took that account's files alone. dev/linux-errors.sh runs AccountCheck after every build.
  • Play On: a fake Jellyfin client over the server's websocket and a fake Chromecast (TLS, castv2) followed, paused, skipped, sought and set the level; handed back here where it was; a TV switched off under it left the song here, paused ("Lost the connection to Fake TV."). JUKEBOX_CHECK=cast.
  • A Sonos: JUKEBOX_CHECK=upnp with a fake Sonos ("Fake Room + Fake Kitchen", its surround no row) given its queue, paused, played, sought, set the level, Up Next changed in it, and followed through four songs to the end alone; the fake's plain renderer (/xml/renderer.xml) the same with the next ahead. On a real network Avahi found a Sonos One SL; a ufw firewall dropped SSDP's answers.

Not yet tried: a real Wayland or GNOME session with sound, KDE, XFCE and Hyprland themselves; a Subsonic server in the app (its calls are tested in the kit) and a playlist someone else shared; adding and switching accounts with the keyring; sound, the keyring and the media controls in the Flatpak; a real Chromecast, a real Sonos played on, grouped rooms, a DLNA renderer, a Subsonic jukebox; offline on Linux (the iPhone's rules, ported, never run here); F10 with Preferences › Pages all off.