Skip to content

About

Fast picture viewer for aliasOS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Alias View

aliasOS's media viewer ("Media Viewer" in the launcher): pictures, and video and music (ALI-2358, to replace mpv). It replaces imv as the default for pictures. Rust, drawn on the CPU straight onto Wayland with no toolkit, in the style of Gannet, aliasOS's file manager.

alias-view FILE...     # those pictures (or videos and songs), in that order
alias-view FILE        # that picture, then the rest of its folder
alias-view FOLDER      # the folder, from its first picture

The window floats, sized to the picture within 80% of the screen, and its first frame already has the picture in it.

Keys

Keys What they do
Right, Page Down, n Next picture; a press on the last goes round to the first
Left, Page Up, p Previous picture; a press on the first goes round to the last
Home, End First, last picture
+, -, wheel, pinch Zoom in and out about the pointer
0, 1 Fit to the window, actual size
Arrows, drag Move around when zoomed
Space Pause or play an animation
g, then arrows and Enter Folder grid; Enter opens the focused picture
i Picture info: name, size, file size, format, date taken, camera
Ctrl+C Copy the picture (as PNG, as the file's own bytes for common types, and as the file for pasting into a file manager)
Delete, Ctrl+Z Move to the Trash (the home Trash, or the disk's own on another disk), put the last one back
? The key list
Escape, q Escape closes a panel, leaves zoom or the grid, then quits; q quits

In a video or song

From the design canvas's player boards, with Mike's decisions of 2026-12-02.

Keys What they do
Space, k Play or pause; after the end, play again from the start
Left, Right Back or forward 5 s. Pictures keep Left and Right for the previous and next file
Up, Down Volume down or up by 5
m Mute or unmute
f, double-click Full screen, or back (videos)
n, Page Down / p, Page Up Next or previous file in the folder
Home Back to the start
t Says the position to a screen reader: "1:23 of 4:56"
Tab, Shift+Tab Through the control bar: Previous, Play, Next, Position, Mute, Volume, Full screen. Enter or Space presses a button; arrows move a slider
? The key list
Escape, q Escape leaves full screen, then quits

The media keys (play, pause, next, previous, volume, mute) work while the window has the keyboard.

The control bar hides 2 s after the pointer last moved or a key was pressed while a video plays, in a window and in full screen. It stays while the video is paused or has ended, for music, while the keyboard focus is in it, and while the pointer rests on it. The mouse pointer hides with the bar and comes back with it: on any pointer motion, and on a key, a click or a pause. It hides only where the desktop offers cursor-shape-v1, without which its shape couldn't be set again. A video stops on its last frame with a replay icon and never goes on by itself; a song plays on to the next song in the folder and stops after the last.

Formats

JPEG, PNG, WebP (still and animated), GIF (animated), BMP, TIFF, ICO, AVIF, HEIC/HEIF, JPEG XL and SVG (and .svgz, up to 64 MB unpacked). EXIF orientation is applied for JPEG, WebP and TIFF; for HEIC and AVIF, libheif applies the file's own rotation and mirroring, which HEIF uses in place of EXIF's.

Any picture up to 268 megapixels (2^28 pixels, 1 GiB decoded) opens at full size. A file that claims more is shown at screen size where its format allows that without holding the whole picture (baseline JPEG, PNG that isn't interlaced); zooming in then enlarges the screen copy and says why, and copying offers only the file itself.

Video: mp4, m4v, f4v, lrv and lrf, mkv, webm, mov, qt and moov, avi, divx and avf, flv, wmv, mpeg, mpg, mpe and vob, ogv, ogm, 3gp and 3gpp, 3g2, 3gp2 and 3gpp2, and asf. Music: mp3 and mpga, mp2, flac, ogg, oga, opus and spx, m4a and f4a, aac and adts, wav, wma, aiff and aif, mka, wv and wvp, ape, and 3ga, with the cover art the file holds. A video or song is known by its extension, and the desktop file (packaging/com.aliasproject.view.desktop) lists those extensions' MIME types, so "Open with" offers Alias View for them and xdg-open can use it once it's set as the default. They play in alias-playback's GPU helper: libmpv in a bubblewrap jail (with Landlock and a seccomp filter), decoding on the graphics card where it can (NVDEC, VA-API or V4L2, else the CPU) and drawing into buffers it hands over as dmabufs. They show in a subsurface above the window, so video never decodes in this process and its frames never pass through it. Sound goes through the session's PulseAudio socket (PipeWire serves it), bound into the jail read-only. Needs bwrap, libmpv, and a compositor with linux-dmabuf.

How it's fast

Measured with make startup in a headless sway (1920x1080, pixman), three runs each, on the brief's 24 MP plasma JPEG and its HEIC conversion. "Window shown" is spawn to sway listing the window, which it does on the first committed buffer.

Case imv 5.0.1 mpv 0.42 Alias View Target
JPEG: window shown, picture drawn 43-87 ms 242-253 ms 21-24 ms <= 50 ms
JPEG: RSS after 1 s 369-377 MB 284-295 MB 21.4-21.8 MB <= 60 MB
JPEG: CPU in the first second 0.51-0.62 s 0.82-0.84 s 0.115-0.120 s <= 0.15 s
HEIC: window shown 631-636 ms 436-444 ms 76-79 ms (picture at 97-104 ms) <= 400 ms
HEIC: RSS after 1 s 467 MB 290-301 MB 19.0-19.2 MB <= 80 MB
Idle, picture shown 0 wakeups, 0 CPU over 5 s, with or without a session bus 0 CPU, no timers

With neighbours in the folder, the two either side are preloaded once the first is on screen: the same JPEG opened among three copies of itself shows in 21-23 ms with 30-31 MB after 1 s, and 0.33 s of CPU, most of it decoding the two neighbours.

  • A JPEG decoder that uses every core. Every other decoder reads a JPEG's compressed stream on one thread, and on a 24 MP photo that alone takes about 55 ms here, even in libjpeg-turbo at 1/8 scale. src/decode/jpeg.rs splits the stream into a piece per core and starts each piece blind. Huffman codes fall back into step within a few blocks, so a short serial pass walks the true stream across each seam until it meets the blind decoder's path, and DC prediction is corrected by a constant per component. The tests check the result is identical whatever the thread count, and within rounding of jpeg-decoder's at every scale and chroma sampling.
  • Only the pixels the window needs. The inverse transform runs at N/8 scale from each block's lowest NxN coefficients, so the 6000x4000 photo becomes 1500x1000 without ever existing at full size, and colour conversion and area-averaging down to the window's 1296x864 happen in one pass. The full-resolution copy is made only when you zoom past the screen copy, and dropped when you zoom back.
  • The window and the decode overlap. The file's headers are read on a thread while the Wayland connection comes up; once the size is known the window opens around the picture and the decode, already under way, lands before the compositor's configure.
  • Nothing runs when nothing changes. No timers, no polling: the loop sleeps in poll with no timeout. Animations use one deadline, only while playing and while the compositor is showing frames. Text and fonts load only when an overlay first opens.
  • HEIC and AVIF decode in a helper process (alias-view --decode-helper), with the codec's own threads, and come back as YCbCr converted and shrunk a row at a time. libheif leaves tens of megabytes in the C allocator after a big picture; the helper gives it all back when it exits. A crash in libheif or its codecs ends the helper, not the window, and a helper that hangs is killed after 30 s; it may write to 4 GiB. Every other format decodes in the viewer's own process, where a decoder bug that panics still closes the window (release builds abort on panic).

make benchmark (decode alone, 24 MP, median of three runs, in milliseconds and MB; RSS is after the decode with the result held, peak includes the HEIC/AVIF helper):

Format File 1920x1080 screen: ms, RSS, peak Full size: ms, RSS, peak 256 px thumbnail: ms, RSS, peak
JPEG 7.8 MB 12.7, 16, 39 70.9, 103, 178 11.1, 14, 29
PNG 34.1 MB 145.8, 14, 14 124.1, 101, 101 130.0, 9, 9
WebP 4.0 MB 395.8, 16, 117 405.8, 106, 174 402.0, 15, 117
GIF 11.3 MB 143.8, 15, 219 158.6, 100, 306 142.2, 10, 215
BMP 72.0 MB 80.4, 15, 82 86.1, 100, 169 78.7, 10, 78
TIFF 72.0 MB 20.9, 15, 146 29.5, 101, 169 18.6, 10, 146
AVIF 4.3 MB 116.1, 13, 232 155.9, 100, 231 119.0, 9, 234
HEIC 3.1 MB 97.8, 13, 109 136.0, 100, 169 98.4, 9, 110
JPEG XL 4.1 MB 419.6, 28, 577 391.4, 115, 663 393.4, 23, 577
ICO (256x256, its limit) 0.2 MB 0.5, 9, 9 0.8, 9, 9 0.7, 9, 9
SVG 0.03 MB 13.6, 15, 19 169.4, 102, 193 3.6, 11, 11

Building

make                    # cargo build --release
make check              # cargo test, then clippy with warnings as errors
make benchmark          # needs ImageMagick (magick) and heif-enc
make startup            # needs Docker; see below
make install PREFIX=/usr DESTDIR=...

Needs Rust 1.88 or later (edition 2024), and libheif and libxkbcommon at run time.

make startup and the screenshots in development run in a throwaway container with its own headless sway (bench/sway.sh), never on the session you're in.

Dependencies

Each is here for one job, and the crate itself has no unsafe code (#![forbid(unsafe_code)]): the FFI that needs unsafe lives inside libheif-rs, xkbcommon and wayland-client.

Crate Why
wayland-client, wayland-protocols The window: xdg-shell, viewporter, fractional scale, cursor shape, xdg-decoration, xdg-output for the screen size, pointer gestures for pinch
xkbcommon Keymaps, through the system's libxkbcommon, as Gannet does
rustix memfd, poll, eventfd, timerfd and clocks, without unsafe code
bytemuck Pixels as bytes, for writing wl_shm buffers with pwrite and for the helper's pipe, without unsafe code
swash Text for the overlays, as Gannet does
jpeg-decoder JPEGs the fast decoder leaves alone: progressive, CMYK, 12-bit, arithmetic coding. It can still decode at reduced scale.
png PNG, read a row at a time so a big one never sits in memory at full size; also writes the PNG that Ctrl+C offers
gif GIF frames
image-webp WebP, still and animated
image (BMP, ICO and TIFF only) BMP, ICO and TIFF, and TIFF's orientation
jxl-oxide JPEG XL, pure Rust
resvg SVG, drawn at the window's size
libheif-rs HEIC and AVIF through libheif. No pure Rust HEVC decoder exists, and libheif with its codec threads decodes the 24 MP HEIC in about 100 ms.
accesskit, accesskit_unix Screen readers, over AT-SPI
alias-playback Video and music: libmpv in a jailed helper, its frames as dmabufs (Alias Project's own crate; its unsafe FFI lives there)
blocking Not used directly; pinned to 1.6.2 for zbus under accesskit_unix, because 1.7.0's last pool thread never exits and wakes twice a second

Test-only: jpeg-encoder and zune-jpegxl make test pictures; zune-core is the latter's options.

Accessibility

  • Everything works from the keyboard; ? lists the keys.
  • Screen readers see the window through AccessKit: the picture is an image named by file and position ("photo.jpg, 3 of 12", or "loading", or why it can't be shown); the info panel and the key list are read as lines; the grid is a list whose focused tile carries the focus, so it's announced as it moves; messages go to a status node. Checked with libatspi in the container (bench/ has the scripts used).
  • The grid's focus ring is 3 px in the theme's accent, held to 3:1 against the background and the tiles; all text is held to 4.5:1 on what it sits on. A theme whose colours fall short is pulled up to those ratios, and a unit test checks the built-in palettes with the WCAG formula.
  • The player's controls are AccessKit buttons, toggle buttons (Play, Mute, Full screen, pressed or not) and sliders (Position "1:23 of 4:56", Volume "80%" or "Muted, 80% when unmuted") in Tab order, with the focus ring on the focused one. Opening, pausing, playing, the end, a failure, a change of volume and a seek by key (once the keys stop) are announced politely; nothing is announced by itself while a video plays.
  • Nothing in the player is told by colour alone: play, pause and replay are different icons, the played part of a slider is 4 px against the rest's 2 px, and hover fills a button behind its icon. The bar is opaque, so its text and icons keep their contrast over any video.
  • Grid tiles are 168 px; nothing clickable is smaller than 44x44. Overlays rearrange themselves to fit (two columns, or label above value), and a test checks the key list fits the smallest window at 100%, 125% and 200%.

Design values

design/tokens.json holds every design value: the colour roles, the font and text size, spacing, the corner radius, sizes (the 168 px grid tile, the 44 px touch target, the 3 px focus ring, the 560x420 smallest window) and timings such as the toast's 4 s. design/build writes them to src/tokens.rs, which is generated and never edited by hand, and the drawing code takes every size, timing and font from it. Behaviour stays in the code: zoom steps (src/view.rs) and how far a key or the wheel pans or scrolls (src/app.rs). See design/README.md.

Colours aren't fixed values here: like Gannet, the viewer takes them from the aliasOS theme at run time and derives the rest, held to WCAG AA (src/theme.rs). The token file lists what it derives in every theme aliasOS ships and in the built-in light and dark, and CI checks every text and focus pair in each of them (design/build --check), and that the list matches what the viewer derives (cargo test).

Layout

src/main.rs            startup, the event loop, --headless-decode
src/app.rs             state, keys, pointer, drawing the frame
src/wl.rs              Wayland: window, input, buffers, clipboard (from Gannet)
src/decode/jpeg.rs     the parallel baseline JPEG decoder
src/decode/heif.rs     HEIC and AVIF through libheif, in a helper process
src/decode/anim.rs     GIF and WebP, still and moving
src/decode/mod.rs      format detection and the other formats
src/pixels.rs          premultiplied pixels and area-average resampling
src/render.rs          the picture into the window at any zoom
src/view.rs            fit and zoom maths
src/ui.rs              overlays and the grid's layout
src/a11y.rs            the AccessKit tree
src/player/            video and music: the helper (gpu.rs), the bar (bar.rs), icons
src/app/player_ui.rs   the player's keys, pointer, bar hiding and announcements
src/exif.rs            orientation, date and camera
src/trash.rs           the freedesktop Trash, and putting things back
src/theme.rs, text.rs, canvas.rs, sort.rs   Gannet's, trimmed
bench/                 make benchmark, make startup and their helpers
tests/cli.rs           --headless-decode on every format

Licence

MIT. Copyright (c) 2026 Alias Project, Inc. The player's icons are Lucide's, under the ISC licence (see LICENSE).

About

Fast picture viewer for aliasOS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages