Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

306.7. swayimg-5.6

Image viewer for Wayland and the console — no toolkit, Lua-configured

Version 5.6, release 1
Shelf graphics — Graphics applications: painting, vector, photo development and management, image viewers, screenshot and image optimisers
Phase 44_apps (Applications), 227 of 422 in build order
Licence MIT
Homepage https://github.com/artemsen/swayimg
Build time 0.9 SBU
Installed size 1.6 MiB in 11 files
Recipe ports/core/graphics/swayimg/kpkgbuild

About

swayimg is an image viewer that draws its own window straight on Wayland, or on the console through DRM with no compositor at all. It shows single images, a gallery of thumbnails and slideshows, and is configured and scripted in Lua. It is one of the applications here that need no toolkit. Its desktop entry is hidden from the menu: it is a handler that pictures are opened in by type.

Sources

Dependencies

Depends on: meson, ninja, pkgconf, wayland, wayland-protocols, libxkbcommon, fontconfig, freetype2, luajit, libdrm, openexr, libheif, libavif, libjpeg-turbo, openjpeg, libjxl, libpng, giflib, librsvg, libtiff, libsixel, libraw, libwebp, ffmpeg, exiv2, bash-completion.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install swayimg'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/graphics/swayimg.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/graphics/swayimg
echo '0f70cbc665217a747e8a098e1a881239e96df270930f47c262ab2ecff290e428  swayimg-5.6.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/swayimg
SRC=$SRC_ROOT/swayimg-5.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf swayimg-5.6.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

meson setup build \
	--prefix=/usr --sysconfdir=/etc --libdir=lib \
	--buildtype=release \
	-Dversion=$version \
	-Dwayland=enabled \
	-Ddrm=enabled \
	-Dcompositor=disabled \
	-Dliblua=luajit \
	-Dexr=enabled \
	-Dgif=enabled \
	-Dheif=enabled \
	-Davif=enabled \
	-Djpeg=enabled \
	-Djp2=enabled \
	-Djxl=enabled \
	-Dpng=enabled \
	-Dsvg=enabled \
	-Dtiff=enabled \
	-Dsixel=enabled \
	-Draw=enabled \
	-Dwebp=enabled \
	-Dvideo=enabled \
	-Dexif=enabled \
	-Dbash=enabled \
	-Dzsh=enabled \
	-Ddesktop=true \
	-Dman=true \
	-Dluameta=true \
	-Ddoc=false \
	-Dtests=disabled
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

cat > "$PKG/usr/share/applications/swayimg.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Swayimg
GenericName=Image Viewer
Comment=Image viewer for Wayland
TryExec=swayimg
Exec=swayimg %F
Icon=swayimg
Terminal=false
NoDisplay=true
StartupNotify=false
StartupWMClass=swayimg
Categories=Graphics;Viewer;
MimeType=image/avif;image/bmp;image/gif;image/heif;image/jpeg;image/jpg;image/jxl;image/pbm;image/pjpeg;image/png;image/svg+xml;image/tiff;image/webp;image/x-bmp;image/x-exr;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-targa;image/x-tga;
DESKTOP
chmod 644 "$PKG/usr/share/applications/swayimg.desktop"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/swayimg, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf swayimg-5.6-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/swayimg, and runs the triggers its paths call for.

Contents

Installed programs: swayimg.

Installed directories: /usr/share/licenses/swayimg, /usr/share/swayimg.

Short descriptions

swayimg image viewer for Wayland/DRM with Lua scripting support

Notes

Upstream’s desktop entry is replaced by one that adds TryExec=swayimg and StartupWMClass=swayimg, the app_id the window carries unless --appid or its configuration names another. It stays NoDisplay=true, as upstream ships it, and keeps upstream’s MimeType= list.