Now you can view images directly in the current terminal window!
The program uses Sway IPC to determine the geometry of the currently focused container. This data is used to calculate the position and size of the new "overlay" window that will be used to draw the image. In the next step, swayimg adds two Sway rules for the self window: "floating enable" and "move position". Then it creates a new Wayland window and draws the image from the specified file.
- JPEG (via libjpeg);
- JPEG XL (via libjxl);
- PNG (via libpng);
- GIF (via giflib);
- SVG (via librsvg);
- WebP (via libwebp);
- AV1 (via libavif);
- BMP (built-in).
- Animation is not supported, only the first frame is displayed;
- Image width or height cannot exceed 32767 pixels (Cairo limit);
- BMP compressed images are not supported.
swayimg [OPTIONS]... [FILE]...
See man swayimg
for details.
Examples:
- View multiple files:
swayimg photo.jpg logo.png
- View all files (recursively) in the current directory in random order:
swayimg -rR
- View using pipes:
wget -O- https://www.kernel.org/theme/images/logos/tux.png 2> /dev/null | swayimg -
Arrows
and vim-like moving keys (hjkl
): Move view point;+
or=
: Zoom in;-
: Zoom out;0
: Set scale to 100%;Backspace
: Reset scale to default;F5
or[
: Rotate 90 degrees anticlockwise;F6
or]
: Rotate 90 degrees clockwise;F7
: Flip vertical;F8
: Flip horizontal;i
: Show/hide image properties;F11
orf
: Toggle full screen mode;PgDown
,Space
, orn
: Open next file;PgUp
orp
: Open previous file;N
: Open file from next directory;P
: Open file from previous directory;Esc
,Enter
,F10
orq
: Exit the program.
The viewer searches for the configuration file with name config
in the
following directories:
$XDG_CONFIG_HOME/swayimg
$HOME/.config/swayimg
$XDG_CONFIG_DIRS/swayimg
/etc/xdg/swayimg
Sample file is available here.
See man swayimgrc
for details.
Arch users can install the program from AUR: swayimg or swayimg-git package.
Alpine users can install the program from swayimg or swayimg-full package.
Other users can build from sources.
The project uses Meson build system:
meson build
ninja -C build
sudo ninja -C build install