Skip to content

About

A small, efficient native image viewer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Image Viewer

A small, efficient native image viewer for Linux, written in Rust.

Features

  • Browse the previous and next supported image in the opened file's directory.
  • Sort the viewing list by filename or modification time, in ascending or descending order.
  • Zoom around the pointer and drag to pan.
  • Rotate the view in 90-degree steps without modifying the source file.
  • Show image dimensions and human-readable file size in the status bar.
  • Move an image to the desktop trash after confirmation.
  • Permanently delete an image with Shift+Delete after an irreversible-action warning.
  • Open images from the command line, a native file dialog, or drag-and-drop.
  • Decode the selected image off the UI thread before scanning its directory, then prefetch immediate neighbors.
  • Watch the open directory and automatically include newly created images or remove deleted ones.

Supported formats are JPEG, PNG, WebP, BMP, and the first frame of GIF files. JPEG EXIF orientation is applied when the image is displayed. Non-Latin filenames load a matching system font through Fontconfig on demand, so the corresponding language font must be installed on the system.

Build and run

Install a current stable Rust toolchain and the development libraries required by X11 or Wayland, then run:

cargo run --release -- [IMAGE_PATH]

The optimized executable is written to target/release/simple-image-viewer by:

cargo build --release

Install

User-local installation (recommended)

From the project directory, use Cargo to build and install the executable under ~/.local/bin:

cargo install --path . --root "$HOME/.local" --locked

Make sure ~/.local/bin is included in PATH. If it is not, add this line to your shell profile and log in again:

export PATH="$HOME/.local/bin:$PATH"

You can then open an image from any terminal:

simple-image-viewer ~/Pictures/example.jpg

Run the installation command again with --force after pulling a newer version. Cargo's installation locations and options are documented in the Cargo Book.

File-manager and “Open With” integration

Install a user-local desktop entry to make Simple Image Viewer available in application menus and file-manager “Open With” dialogs:

mkdir -p "$HOME/.local/share/applications" "$HOME/.local/share/icons"
install -m 644 logo.png "$HOME/.local/share/icons/simple-image-viewer.png"
cat > "$HOME/.local/share/applications/simple-image-viewer.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=Simple Image Viewer
GenericName=Image Viewer
Comment=View and browse images
Exec="$HOME/.local/bin/simple-image-viewer" %f
Terminal=false
Icon=$HOME/.local/share/icons/simple-image-viewer.png
Categories=Graphics;Viewer;
Keywords=image;photo;viewer;
MimeType=image/jpeg;image/png;image/webp;image/gif;image/bmp;image/x-bmp;
EOF

Most desktop environments discover this file automatically. If update-desktop-database is installed, refresh the application database immediately with:

update-desktop-database "$HOME/.local/share/applications"

The viewer should now appear when right-clicking a supported image and choosing Open With. To make it the default for all supported formats, run:

xdg-mime default simple-image-viewer.desktop image/jpeg image/png image/webp image/gif image/bmp image/x-bmp

Verify an association or launch through the desktop's normal file-opening path with:

xdg-mime query default image/png
xdg-open ~/Pictures/example.png

Changing defaults is optional and affects only the current user. See the xdg-mime documentation for association details.

Uninstall

Remove the Cargo-installed executable and desktop entry with:

cargo uninstall --root "$HOME/.local" simple-image-viewer
rm "$HOME/.local/share/applications/simple-image-viewer.desktop"
rm "$HOME/.local/share/icons/simple-image-viewer.png"

Run update-desktop-database "$HOME/.local/share/applications" afterward if that command is available.

Configuration

Sorting preferences are loaded at startup and saved whenever they change. The configuration file is stored at:

$XDG_CONFIG_HOME/simple-image-viewer/config.toml

If XDG_CONFIG_HOME is unset, the viewer uses $HOME/.config/simple-image-viewer/config.toml. A generated configuration looks like:

sort_mode = "filename"
filename_order = "ascending"
last_modified_order = "descending"

The filename and modification-time modes remember their own last-selected direction. Missing fields use the defaults shown above; an invalid configuration is reported in the status bar and left untouched.

Controls

Action Keyboard / mouse
Open Ctrl+O or drag-and-drop
Previous / next Left / Right or Page Up / Page Down
Sort viewing list Criterion and direction selectors in the toolbar
Zoom + / - or mouse wheel
Fit to window 0 or F
Pan Drag the image
Rotate clockwise R
Rotate counter-clockwise Shift+R
Move to trash Delete
Delete permanently Shift+Delete

Navigation is non-recursive and wraps between the first and last image. Opening or navigating to an image resets its temporary zoom, pan, and rotation.

About

A small, efficient native image viewer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages