2.1 KiB
SimpleImageViewer
View images fast and without any hocus pocus, sometimes less is better
About
The inspiration was a YouTube video. I watched the beginning and thought to myself that this cannot be that hard to implement.
A Hyprland integration is included to open an image from the clipboard, either as a file path or as image data.
Disclaimer for Wayland / Hyprland users
Under Wayland, window placement is controlled by the compositor, so moving the window with the viewer's left-button drag does not work. The compositor may also override the requested window size. See the SDL Wayland notes for details.
Mouse-wheel zoom and right-button dragging operate on the image inside the window. On Hyprland, use your configured compositor bindings to move or resize the window, and configure it as floating if you want free window placement.
Requirements
- SDL3
Installations
macOS
brew install sdl3- clone this repo and navigate into it
gcc SimpleImageViewer.c -o SimpleImageViewer -Wall -Werror $(pkg-config --cflags --libs sdl3)or withclang- additional compiler arguments for ide:
-I/opt/homebrew/include -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -lSDL3
Linux
sudo pacman -S sdl3 --noconfirmgcc SimpleImageViewer.c -o SimpleImageViewer -Wall -Werror $(pkg-config --cflags --libs sdl3) -lmor withclang- when using Hyprland, move the scripts folder into your
~/.config/hypr/ - in
simple-image-viewer-clipboard.sh: setviewerto the binary path gcc created, I placed my binary beside this script - move the
hypr_simpleimageviewer.luafile into~/.config/hypr/ - open the file and replace [USER] with your user
- add
require(hypr_simpleimageviewer)at the top of your Hyprland config
Usage
If installed via Hyprland binding, SUPER + I is used to parse a file from clipboard (path or binary) as argument into SimpleImageViewer.
Via commandline ./SimpleImageViewer [path_to_image].
Mouse-/Keybinds:
- Close:
ESC, Enter, Space - Move image: press
right mouse buttonanddrag - Zoom image:
scroll mouse wheel