SWAYIMGRC(5) | Swayimg configuration | SWAYIMGRC(5) |
NAME¶
swayimgrc - configuration file for the Swayimg viewer
SYNOPSIS¶
The Swayimg configuration file is a text-based INI file used to override the default settings.
LOCATION¶
Swayimg searches for a config file in the following locations, in this order:
- $XDG_CONFIG_HOME/swayimg/config
- $HOME/.config/swayimg/config
- $XDG_CONFIG_DIRS/swayimg/config
- /etc/xdg/swayimg/config
DESCRIPTION¶
The structure of the INI file consists of key-value pairs for properties and sections that organize properties.
The number sign (#) at the beginning of the line indicates a comment. Empty lines and comments are ignored.
The basic element contained in the INI file is the key or property. Every key has a name and a value, delimited by an equals sign (=). The name appears to the left of the equals sign. The value can contain any characters.
Keys are grouped into named sections. The section name appears on a line by itself, in square brackets. All keys after the section declaration are associated with that section.
Special directive include allows to load another config file. The directive must contain the path or name of the file to load the configuration.
Any option can be overridden using the --config argument in the command line, for instance: swayimg --config="general.mode=gallery".
SECTIONS¶
General¶
General configuration for the entire application: [general].
mode = viewer|slideshow|gallery
size = fullscreen|image|W,H
- fullscreen: use full screen mode;
- image: set size from the first frame of the first image;
- W,H: absolute size of the window in pixels, default is 1280,720.
position = auto|X,Y
- auto: let the window manager control the window position (default);
- X,Y: absolute coordinates of the top left corner, e.g. 100,200.
overlay = yes|no
decoration = yes|no
sigusr1 = ACTION
sigusr2 = ACTION
app_id = NAME
Viewer¶
Configuration specific to the viewer mode: [viewer].
window = auto|extend|mirror|#COLOR
- auto: fill the window background in extend or mirror mode depending on the image aspect ratio;
- extend: fill window with the current image and blur it;
- mirror: fill window with the mirrored current image and blur it;
- #COLOR: solid color in RGB or RGBA, #00000000 by default;
transparency = grid|#COLOR
- grid: draw chessboard (default);
- #COLOR: solid color in RGB or RGBA, e.g #10ff4280.
scale = MODE
- optimal: 100% or less to fit to window (default);
- width: fit image width to window width;
- height: fit image height to window height;
- fit: fit to window;
- fill: crop image to fill the window;
- real: real size (100%);
- keep: keep the same scale as for previously viewed image.
position = POSITION
- center: center of the window (default);
- top: top and center horizontally;
- bottom: bottom and center horizontally;
- left: left and center vertically;
- right: right and center vertically;
- top_left: upper left corner of the window;
- top_right: upper right corner of the window;
- bottom_left: lower left corner of the window;
- bottom_right: lower right corner of the window;
- free: like center, but freely movable (not fixed).
antialiasing = METHOD
- none: nearest-neighbor, or no anti-aliasing;
- box: nearest-neighbor on upscale, average in a box on downscale;
- bilinear: bilinear;
- bicubic: bicubic with the Catmull-Rom spline;
- mks13: Magic Kernel with the 2013 Sharp approximation (default).
loop = yes|no
history = SIZE
preload = SIZE
Slide show¶
Configuration specific to the slide show mode: [slideshow].
time = SECONDS
window
transparency
scale
position
antialiasing
Gallery¶
Configuration specific to the gallery mode: [gallery].
size = PIXELS
cache = SIZE
preload = yes|no
pstore = yes|no
fill = yes|no
antialiasing = METHOD
- none: nearest-neighbor, or no anti-aliasing;
- box: nearest-neighbor on upscale, average in a box on downscale;
- bilinear: bilinear;
- bicubic: bicubic with the Catmull-Rom spline;
- mks13: Magic Kernel with the 2013 Sharp approximation (default).
window = #COLOR
background = #COLOR
select = #COLOR
border = #COLOR
shadow = #COLOR
Image list¶
Configuration of the image list: [list].
order = ORDER
- none: unsorted;
- alpha: sorted alphabetically (default);
- numeric: sorted numerically;
- mtime: sorted by file modification time;
- size: sorted by file size;
- random: randomize list.
reverse = yes|no
recursive = yes|no
all = yes|no
fsmon = yes|no
Font¶
Font configuration: [font].
name = NAME
size = SIZE
color = #COLOR
shadow = #COLOR
background = #COLOR
Text info: general configuration¶
General configuration of the displayed text layer: [info].
show = yes|no
info_timeout = SECONDS
status_timeout = SECONDS
Text info: viewer mode¶
Layout of fields for displaying text info in viewer mode: [info.viewer]. The layout describes what metadata should be displayed in each corner of the window. The list can contain any number of fields separated by commas. A plus sign preceding a field name adds the field title to the display.
top_left = LIST
top_right = LIST
bottom_left = LIST
bottom_right = LIST
Avalable fields:
- name: File name of the currently viewed/selected image.
- dir: Parent directory name of the currently viewed/selected image.
- path: Absolute path or special source string of the currently viewed/selected image.
- filesize: File size in human-readable format.
- format: Brief image format description.
- imagesize: Size of the image (or its current frame) in pixels.
- exif: List of EXIF data.
- frame: Current and total number of frames.
- index: Current and total index of image in the image list.
- scale: Current image scale in percent.
- status: Status message.
- none: Empty field (ignored).
Text info: slide show mode¶
Layout of fields for displaying text info in slide show mode: [info.slideshow]. The format is the same as [info.viewer].
Text info: gallery mode¶
Layout of fields for displaying text info in gallery mode: [info.gallery]. The format is the same as [info.viewer].
Key bindings¶
Key bindings configurations are stored in sections [keys.viewer], [keys.slideshow] and [keys.gallery]. Each line associates a key with a list of actions and optional parameters. Actions are separated by semicolons. One or more key modifiers (Ctrl, Alt, Shift) can be specified in the key name. The key name can be obtained with the xkbcli tool: xkbcli interactive-wayland.
Predefined names for mouse buttons/scroll:
- MouseLeft: Left button;
- MouseRight: Right button;
- MouseMiddle: Middle button;
- MouseSide: Side button;
- MouseExtra: Extra button;
- ScrollUp: Mouse wheel up;
- ScrollDown: Mouse wheel down;
- ScrollLeft: Mouse scroll left;
- ScrollRight: Mouse scroll right.
Actions¶
none
help
first_file
last_file
prev_file
next_file
prev_dir
next_dir
rand_file
step_left
step_right
step_up
step_down
page_up
page_down
skip_file
prev_frame
next_frame
animation
fullscreen
mode [viewer|slideshow|gallery]
step_left [PERCENT]
step_right [PERCENT]
step_up [PERCENT]
step_down [PERCENT]
zoom [SCALE]
- one of the viewer.scale modes (fit/fill/etc);
- percentage number with + or - sign (e.g. +10) to zoom in or out;
- absolute value in percentage to set the scale, e.g. 200;
- empty value to switch to the next available scaling mode.
rotate_left
rotate_right
flip_vertical
flip_horizontal
thumb SIZE
- delta in pixels with + or - sign (e.g. +10);
- absolute size in pixels, e.g. 200.
reload
antialiasing [MODE]
- one of the viewer.antialiasing modes (none/mks13/etc);
- empty value to toggle AA on/off.
info [MODE]
exec COMMAND
- Sway: `swaymsg exec ...`;
- Hyprland: `hyprctl dispatch exec ...`;
- Niri: `niri msg action spawn ...`.
drag
export FILE
pause
status TEXT
exit
EXAMPLES¶
Sample file is available on the project repository: https://github.com/artemsen/swayimg/blob/master/extra/swayimgrc or locally after installation: /usr/share/swayimg/swayimgrc.
# comment [list] order = random [font] size = 16 [keys] Ctrl+Alt+e = exec echo "%" > mylist.txt
SEE ALSO¶
BUGS¶
For suggestions, comments, bug reports, etc. visit the project homepage https://github.com/artemsen/swayimg.
2025-07-07 | swayimg |