### Scripting Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Examples demonstrating scripting capabilities, including batch conversion, viewing images matching a pattern, and multi-monitor setups. ```bash # Batch conversion using swayimg export for file in *.tiff; do swayimg -e "swayimg.viewer.export('$file.png')" "$file" done # View images matching pattern find ~/Pictures -name "*.jpg" -newer ~/marker | \ xargs swayimg --from-file=- # Multi-monitor setup # Terminal 1: Full screen image viewer on monitor 1 swayimg -F -P 0,0 image.jpg # Terminal 2: Gallery on monitor 2 swayimg -g -S 1920,1080 -P 1920,0 ~/Pictures ``` -------------------------------- ### Event Callbacks Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Demonstrates callback functions for window resize events and application initialization completion. ```lua -- Window resize swayimg.on_window_resize(function() local size = swayimg.get_window_size() print(string.format("Resized to %dx%d", size.width, size.height)) end) -- Initialization complete swayimg.on_initialized(function() print("Application initialized") local size = swayimg.get_window_size() print(string.format("Window: %dx%d", size.width, size.height)) end) ``` -------------------------------- ### Multi-Monitor Setup Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Shows how to configure Swayimg for specific monitors using different application IDs, demonstrated with a 'monitor2' example. ```lua -- Configuration for specific monitor via different appid -- Start with: swayimg --appid=monitor2 image.jpg if swayimg.get_appid() == "monitor2" then -- Monitor 2 specific settings swayimg.gallery.set_thumb_size(200) end ``` -------------------------------- ### Basic Key Binding Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Demonstrates how to bind simple keys and keys with modifiers to specific actions in swayimg. ```lua -- Simple key swayimg.viewer.on_key("q", function() swayimg.exit() end) -- Key with modifiers swayimg.viewer.on_key("Ctrl-s", function() swayimg.text.set_status("Shortcut works!") end) swayimg.viewer.on_key("Shift-Delete", function() -- Handle shift+delete end) ``` -------------------------------- ### Basic Configuration Structure Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md An example of a basic Swayimg configuration file using Lua, demonstrating how to set default viewer and text properties. ```lua -- ~/.config/swayimg/init.lua -- Example configuration swayimg.viewer.set_default_scale("fit") swayimg.viewer.set_default_position("center") swayimg.text.set_font("Monospace") swayimg.text.set_size(14) ``` -------------------------------- ### Configuration Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Examples showing how to configure swayimg for dark themes, optimal RAW image viewing, and high-performance galleries. ```bash # Start with dark theme swayimg -e " swayimg.text.set_foreground(0xffffffff) swayimg.text.set_background(0xff000000) swayimg.viewer.set_window_background(0xff0a0a0a) " image.jpg # Optimal viewing settings for RAW images swayimg -e " swayimg.set_format_params('raw', { camera_wb = true }) swayimg.viewer.set_default_scale('fit') swayimg.enable_antialiasing(true) " photo.raw # High-performance gallery swayimg -g -e " swayimg.gallery.set_thumb_size(64) swayimg.gallery.limit_cache(20) swayimg.gallery.enable_pstore(false) " ~/Pictures ``` -------------------------------- ### Mouse Bindings Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Illustrates how to bind mouse actions, including clicks and scroll events, with and without modifiers, for both viewer and gallery modes. ```lua -- Simple click swayimg.viewer.on_mouse("MouseLeft", function() -- Handle left click end) -- With modifiers swayimg.viewer.on_mouse("Ctrl-MouseRight", function() -- Handle Ctrl+Right click end) -- Scroll events swayimg.viewer.on_mouse("ScrollUp", function() -- Scroll up - could pan image end) swayimg.viewer.on_mouse("Ctrl-ScrollUp", function() -- Zoom in end) -- Gallery mouse swayimg.gallery.on_mouse("MouseLeft", function() swayimg.set_mode("viewer") end) ``` -------------------------------- ### Complete Configuration Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md A comprehensive Lua configuration file for Swayimg, covering text appearance, viewer settings, image lists, galleries, slideshows, display options, and keyboard bindings. ```lua -- ~/.config/swayimg/init.lua -- Comprehensive configuration example -- Text appearance swayimg.text.set_font("Monospace") swayimg.text.set_size(14) swayimg.text.set_spacing(2) swayimg.text.set_padding(10) -- Dark theme swayimg.text.set_foreground(0xffffffff) swayimg.text.set_background(0x80000000) swayimg.text.set_shadow(0xff000000) -- Timeouts swayimg.text.set_timeout(5) swayimg.text.set_status_timeout(3) -- Viewer settings swayimg.viewer.set_default_scale("fit") swayimg.viewer.set_default_position("center") swayimg.viewer.set_window_background(0xff1a1a1a) swayimg.viewer.set_image_chessboard(8, 0xff333333, 0xff555555) swayimg.viewer.enable_centering(true) swayimg.viewer.enable_loop(true) swayimg.viewer.set_drag_button("MouseLeft") -- Image list swayimg.imagelist.set_order("numeric") swayimg.imagelist.enable_reverse(false) swayimg.imagelist.enable_recursive(true) swayimg.imagelist.enable_fsmon(true) -- Gallery swayimg.gallery.set_thumb_size(128) swayimg.gallery.set_aspect("fit") swayimg.gallery.set_padding_size(8) swayimg.gallery.set_border_size(2) swayimg.gallery.set_border_color(0xffffff00) swayimg.gallery.set_window_color(0xff2a2a2a) swayimg.gallery.limit_cache(50) -- Slideshow swayimg.slideshow.set_timeout(3) -- Display swayimg.enable_antialiasing(true) swayimg.enable_exif_orientation(true) swayimg.enable_decoration(false) swayimg.set_appid("swayimg") -- Text display swayimg.viewer.set_text("topleft", { "{name}", "{sizehr} - {format}", "{width}x{height} @ {scale}" }) -- Keyboard bindings local function setup_viewer_keys() swayimg.viewer.on_key("q", function() swayimg.exit() end) swayimg.viewer.on_key("Escape", function() swayimg.exit() end) swayimg.viewer.on_key("n", function() swayimg.viewer.switch_image("next") end) swayimg.viewer.on_key("p", function() swayimg.viewer.switch_image("prev") end) swayimg.viewer.on_key("Home", function() swayimg.viewer.switch_image("first") end) swayimg.viewer.on_key("End", function() swayimg.viewer.switch_image("last") end) swayimg.viewer.on_key("plus", function() swayimg.viewer.set_abs_scale(swayimg.viewer.get_scale() * 1.2) end) swayimg.viewer.on_key("minus", function() swayimg.viewer.set_abs_scale(swayimg.viewer.get_scale() / 1.2) end) swayimg.viewer.on_key("BackSpace", function() swayimg.viewer.reset() end) swayimg.viewer.on_key("bracketright", function() swayimg.viewer.rotate(90) end) swayimg.viewer.on_key("bracketleft", function() swayimg.viewer.rotate(270) end) swayimg.viewer.on_key("m", function() swayimg.viewer.flip_vertical() end) swayimg.viewer.on_key("M", function() swayimg.viewer.flip_horizontal() end) swayimg.viewer.on_key("f", function() swayimg.set_fullscreen() end) swayimg.viewer.on_key("t", function() if swayimg.text.visible() then swayimg.text.hide() else swayimg.text.show() end end) swayimg.viewer.on_key("Insert", function() swayimg.viewer.mark_image() end) swayimg.viewer.on_key("g", function() swayimg.set_mode("gallery") end) swayimg.viewer.on_key("s", function() swayimg.set_mode("slideshow") end) end -- Setup callbacks swayimg.on_initialized(function() setup_viewer_keys() end) swayimg.viewer.on_image_change(function() local image = swayimg.viewer.get_image() -- Custom image change handling here end) ``` -------------------------------- ### Basic Usage Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Common examples for viewing single images, all images in a directory, and multiple files. ```bash # View single image swayimg photo.jpg # View all images in directory (recursive) swayimg ~/Pictures # View multiple files swayimg ~/Pictures/vacation.jpg ~/Pictures/family.jpg ``` -------------------------------- ### Custom Controls Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Provides examples of custom keybindings for navigation, including Vim-like and Emacs-like controls. ```lua -- Vim-like navigation swayimg.viewer.on_key("j", function() swayimg.viewer.switch_image("next") end) swayimg.viewer.on_key("k", function() swayimg.viewer.switch_image("prev") end) swayimg.viewer.on_key("g", function() swayimg.viewer.switch_image("first") end) swayimg.viewer.on_key("G", function() swayimg.viewer.switch_image("last") end) -- Emacs-like keybindings swayimg.viewer.on_key("Ctrl-f", function() swayimg.viewer.switch_image("next") end) swayimg.viewer.on_key("Ctrl-b", function() swayimg.viewer.switch_image("prev") end) swayimg.viewer.on_key("Ctrl-a", function() swayimg.viewer.reset() end) ``` -------------------------------- ### Window Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for controlling window decorations, enabling overlay mode, setting application ID, and configuring drag-and-drop and mouse drag buttons. ```lua -- Window decoration (title bar, borders) swayimg.enable_decoration(false) -- Overlay mode (simulate image in terminal) swayimg.enable_overlay(true) -- Application ID (window class) swayimg.set_appid("swayimg") -- Drag-and-drop button swayimg.set_dnd_button("MouseRight") -- Mouse drag button in viewer swayimg.viewer.set_drag_button("MouseLeft") ``` -------------------------------- ### Advanced Usage Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Examples showcasing advanced features like gallery mode, custom configurations, web image loading, slideshows, and high DPI settings. ```bash # Start in gallery mode, specific window size and position swayimg -g -S 1920,1080 -P 0,0 ~/Pictures # Load from custom config, execute additional setup swayimg -c ~/.config/swayimg/hd.lua \ -e "swayimg.text.set_size(18)" \ ~/Pictures # View images from web with custom configuration swayimg --appid=web-viewer \ "exec://wget -qO- https://example.com/image.jpg" \ "exec://curl -so- https://example.com/photo.png" # Slideshow mode with piped images swayimg -s - < image_stream.jpg # Load image list from file, start in viewer swayimg -f ~/my_images.txt -v # High DPI configuration swayimg -S 3840,2160 \ -e "swayimg.text.set_size(24)" \ -e "swayimg.gallery.set_thumb_size(256)" \ ~/Pictures # Fullscreen slideshow with custom timing swayimg -F -s \ -e "swayimg.slideshow.set_timeout(2)" \ ~/Pictures ``` -------------------------------- ### Configuration - Execute Lua Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of overriding multiple settings using the -e option. ```bash swayimg -e "swayimg.viewer.set_default_scale('fit')" \ -e "swayimg.text.set_size(14)" \ -e "swayimg.enable_antialiasing(true)" \ image.jpg ``` -------------------------------- ### Viewer Display Settings Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for configuring default scaling, positioning, window background, image background, and centering in the Swayimg viewer. ```lua -- Default scale for new images swayimg.viewer.set_default_scale("fit") -- Options: optimal, width, height, fit, fill, real, keep, or number -- Default position swayimg.viewer.set_default_position("center") -- Window background color swayimg.viewer.set_window_background(0xff1a1a1a) -- Or use special modes swayimg.viewer.set_window_background("extend") -- Blur current image to fill swayimg.viewer.set_window_background("mirror") -- Mirrored image blur swayimg.viewer.set_window_background("auto") -- Choose based on aspect ratio -- Transparent image background (default: chessboard) swayimg.viewer.set_image_background(0xffffffff) -- White background -- Or use chessboard (more common) swayimg.viewer.set_image_chessboard(8, 0xff808080, 0xffb0b0b0) -- Enable automatic image centering swayimg.viewer.enable_centering(true) -- Loop image list swayimg.viewer.enable_loop(true) -- Image rendering quality swayimg.enable_antialiasing(true) swayimg.enable_exif_orientation(true) ``` -------------------------------- ### Basic Swayimg Configuration Example Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md A simple example demonstrating how to set text size, foreground color, default scale, and define a keybinding for deleting images. ```lua swayimg.text.set_size(32) swayimg.text.set_foreground(0xffff0000) swayimg.viewer.set_default_scale("fill") swayimg.gallery.on_key("Delete", function() local image = swayimg.gallery.get_image() os.remove(image.path) end) ``` -------------------------------- ### Image List Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for setting image list order, recursion, adjacent file loading, filesystem monitoring, and adding initial image sources. ```lua -- Sort order for image list swayimg.imagelist.set_order("numeric") -- Options: none, alpha, numeric, mtime, size, random -- Reverse sort order swayimg.imagelist.enable_reverse(false) -- Include subdirectories when opening directory swayimg.imagelist.enable_recursive(true) -- Automatically load adjacent files when opening single file swayimg.imagelist.enable_adjacent(true) -- Monitor filesystem for changes swayimg.imagelist.enable_fsmon(true) -- Add initial image sources swayimg.on_initialized(function() swayimg.imagelist.add("/home/user/Pictures") swayimg.imagelist.add("/home/user/Downloads") end) ``` -------------------------------- ### Image Change Callback Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md An example of a callback function that is executed whenever the currently displayed image in the viewer changes. ```lua -- Called when image changes swayimg.viewer.on_image_change(function() local image = swayimg.viewer.get_image() print("Opened: " .. image.path) print(string.format("Size: %dx%d", image.width, image.height)) end) ``` -------------------------------- ### Signal Bindings Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Shows how to bind signals, such as SIGUSR1 and SIGUSR2, to trigger specific Lua functions within swayimg. ```lua -- SIGUSR1 swayimg.viewer.on_signal("USR1", function() print("Received SIGUSR1") end) -- SIGUSR2 swayimg.viewer.on_signal("USR2", function() print("Received SIGUSR2") swayimg.viewer.reload() end) ``` -------------------------------- ### Configuration File Format Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md An example of a Lua configuration file for swayimg, demonstrating how to set initial settings, setup key bindings, configure colors, and enable features. ```lua -- Example: ~/.config/swayimg/init.lua -- Configure initial settings swayimg.viewer.set_default_scale("fit") swayimg.viewer.set_default_position("center") swayimg.text.set_font("Monospace") swayimg.text.set_size(14) -- Setup key bindings swayimg.viewer.on_key("q", function() swayimg.exit() end) -- Configure colors swayimg.text.set_foreground(0xffffffff) swayimg.text.set_background(0x80000000) -- Enable features swayimg.enable_antialiasing(true) swayimg.enable_exif_orientation(true) ``` -------------------------------- ### Gallery Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for customizing thumbnail size, aspect ratio, padding, selection styling, window background, and performance settings for the Swayimg gallery. ```lua -- Thumbnail size in pixels swayimg.gallery.set_thumb_size(128) -- Thumbnail aspect ratio swayimg.gallery.set_aspect("fit") -- Options: fit, fill, keep -- Padding between thumbnails swayimg.gallery.set_padding_size(8) -- Selection styling swayimg.gallery.set_border_size(2) swayimg.gallery.set_border_color(0xffffff00) -- Yellow swayimg.gallery.set_selected_scale(1.05) -- Slightly enlarge swayimg.gallery.set_selected_color(0x40ffffff) -- Semi-transparent white swayimg.gallery.set_unselected_color(0x20ffffff) -- Window background swayimg.gallery.set_window_color(0xff2a2a2a) -- Select on hover vs click swayimg.gallery.enable_hover(true) -- Performance settings swayimg.gallery.limit_cache(50) -- Max thumbnails in memory swayimg.gallery.enable_preload(true) -- Preload off-screen swayimg.gallery.enable_pstore(true) -- Cache to disk swayimg.gallery.set_pstore_path(os.getenv("HOME") .. "/.cache/swayimg") ``` -------------------------------- ### Window Configuration - Fullscreen Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to start in fullscreen mode. ```bash swayimg -F image.jpg ``` ```bash swayimg --fullscreen image.jpg ``` -------------------------------- ### Command Line Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/README.md Examples of common Swayimg command-line invocations for viewing single images, directories, and starting in different modes. ```bash # View single image swayimg photo.jpg # View directory swayimg ~/ # Start in gallery mode swayimg -g ~/ # Slideshow mode swayimg -s ~/ # Custom window size swayimg -S 1920,1080 image.jpg ``` -------------------------------- ### Build Process Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/architecture.md Commands for setting up, compiling, and installing the project using Meson. ```bash meson setup build_dir meson compile -C build_dir Meson install -C build_dir ``` -------------------------------- ### Slideshow Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for setting the auto-advance interval and display settings for the slideshow feature in Swayimg. ```lua -- Auto-advance interval in seconds swayimg.slideshow.set_timeout(3) -- Configure display (inherits viewer settings) swayimg.slideshow.set_default_scale("fit") swayimg.slideshow.enable_loop(true) ``` -------------------------------- ### Font and Text Appearance Settings Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Lua code examples for customizing font, size, line spacing, padding, colors, and timeouts for text display in Swayimg. ```lua -- Set font swayimg.text.set_font("DejaVu Sans Mono") -- Font size in pixels swayimg.text.set_size(16) -- Line spacing (can be negative) swayimg.text.set_spacing(2) -- Padding from window edges swayimg.text.set_padding(10) -- Text colors (ARGB format) swayimg.text.set_foreground(0xffffffff) -- White swayimg.text.set_background(0x80000000) -- Semi-transparent black swayimg.text.set_shadow(0xff000000) -- Black shadow -- Auto-hide text after 5 seconds swayimg.text.set_timeout(5) -- Status message hide after 3 seconds swayimg.text.set_status_timeout(3) ``` -------------------------------- ### View from multiple sources Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of combining different input sources. ```bash swayimg image.jpg /path/to/directory other.png ``` -------------------------------- ### View multiple files Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of viewing multiple image files. ```bash swayimg photo1.jpg photo2.png image3.gif ``` -------------------------------- ### Mode Selection - Gallery Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to force start in gallery mode. ```bash swayimg -g /path/to/photos ``` ```bash swayimg --gallery image.jpg ``` -------------------------------- ### Custom Key Binding Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/INDEX.md Example of how to bind a custom action to a specific key combination. ```lua swayimg.viewer.on_key("Ctrl-e", function() -- Custom action end) ``` -------------------------------- ### View single file Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of viewing a single image file. ```bash swayimg image.jpg ``` -------------------------------- ### text_template_t examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/types.md Examples of text template strings. ```lua "{name}" "{name} - {sizehr}" "{width}x{height} @ {scale}" "File: {name}\t{path}" "Camera: {meta.Camera}\nDate: {meta.DateTime}" ``` -------------------------------- ### View all images in directory Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of viewing all images within a directory. ```bash swayimg /path/to/photos ``` -------------------------------- ### Transparency Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/types.md Examples of color values with varying transparency. ```lua 0xffffffff -- Fully opaque white 0x80ffffff -- 50% transparent white 0x40ffffff -- 25% transparent white 0x20ffffff -- 12% transparent white 0x00ffffff -- Fully transparent white ``` -------------------------------- ### Mode Selection - Viewer Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to force start in viewer mode. ```bash swayimg -v image.jpg ``` ```bash swayimg --viewer image.jpg ``` -------------------------------- ### Input Binding Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-gallery-slideshow.md Provides an example of binding keyboard keys for image deletion and mode switching in the gallery. ```lua swayimg.gallery.on_key("Delete", function() local entry = swayimg.gallery.get_image() os.remove(entry.path) swayimg.imagelist.remove(entry.path) swayimg.gallery.reload() end) swayimg.gallery.on_key("Return", function() swayimg.set_mode("viewer") end) ``` -------------------------------- ### View multiple files Source: https://github.com/artemsen/swayimg/blob/master/README.md Example of how to view multiple image files. ```bash swayimg photo.jpg logo.png ``` -------------------------------- ### Multiple external sources Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of loading images from multiple external command outputs. ```bash swayimg "exec://curl -so- https://url1.com/img.jpg" \ "exec://wget -qO- https://url2.com/img.png" ``` -------------------------------- ### Mode Selection - Slideshow Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to force start in slideshow mode. ```bash swayimg -s /path/to/photos ``` ```bash swayimg --slideshow image.jpg ``` -------------------------------- ### Local command Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of using a local command to generate an image. ```bash swayimg "exec://convert image.tiff png:-" ``` -------------------------------- ### Color Format Examples Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/README.md Examples of ARGB hexadecimal color format used in Swayimg. ```lua 0xffffffff -- Opaque white 0xff000000 -- Opaque black 0x80ffffff -- 50% transparent white ``` -------------------------------- ### View using pipes Source: https://github.com/artemsen/swayimg/blob/master/README.md Example of how to view an image piped from wget. ```bash wget -qO- https://www.kernel.org/theme/images/logos/tux.png | swayimg - ``` -------------------------------- ### Key Binding Syntax Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/README.md Examples demonstrating the syntax for defining key bindings in Swayimg. ```lua "q" -- Simple key "Ctrl-a" -- Control modifier "Shift-Return" -- Multiple modifiers "Alt-F4" -- Function key with modifier "Ctrl-Alt-Shift-Delete" -- Multiple modifiers ``` -------------------------------- ### swayimg.get_mode Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get the current application mode. ```lua swayimg.get_mode() -> appmode_t ``` -------------------------------- ### XDG_CONFIG_DIRS Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of setting XDG_CONFIG_DIRS to include additional configuration directories. ```bash XDG_CONFIG_DIRS=/etc/swayimg:/usr/local/etc/swayimg swayimg image.jpg ``` -------------------------------- ### WAYLAND_DISPLAY Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of explicitly setting the WAYLAND_DISPLAY environment variable. ```bash WAYLAND_DISPLAY=wayland-0 swayimg image.jpg ``` -------------------------------- ### Initialize Image List at Startup Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-imagelist.md Example of initializing the image list at startup, including configuring list behavior and adding image sources. ```lua swayimg.on_initialized(function() -- Configure list behavior swayimg.imagelist.set_order("numeric") swayimg.imagelist.enable_reverse(false) swayimg.imagelist.enable_recursive(true) swayimg.imagelist.enable_fsmon(true) -- Add image sources swayimg.imagelist.add("/home/user/photos") swayimg.imagelist.add("/home/user/downloads") print("Image list initialized with " .. swayimg.imagelist.size() .. " entries") end) ``` -------------------------------- ### XDG_CONFIG_HOME Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of setting XDG_CONFIG_HOME to a custom directory for swayimg configuration. ```bash XDG_CONFIG_HOME=/etc/custom swayimg image.jpg ``` -------------------------------- ### Chain multiple images from stdin Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of piping multiple image files to swayimg. ```bash cat image1.jpg image2.jpg | swayimg - ``` -------------------------------- ### swayimg.get_window_size Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get the application window size in pixels. ```lua swayimg.get_window_size() -> { width: integer, height: integer } ``` -------------------------------- ### Template with Metadata Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Sets up text display in the viewer to include file metadata like camera model and date, in addition to basic file information. ```lua swayimg.viewer.set_text("bottomright", { "File: {name}", "Size: {sizehr}", "Format: {format}", "Camera: {meta.Camera}", "Date: {meta.DateTime}" }) ``` -------------------------------- ### swayimg.get_fullscreen Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get the current full screen mode status. ```lua swayimg.get_fullscreen() -> boolean ``` -------------------------------- ### get_image Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Gets information about the currently displayed image. ```lua swayimg.viewer.get_image() -> swayimg.image ``` -------------------------------- ### HOME Environment Variable Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of setting the HOME environment variable to change the default configuration location. ```bash HOME=/root swayimg image.jpg ``` -------------------------------- ### get_thumb_size Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get thumbnail size. ```lua swayimg.gallery.get_thumb_size() -> integer ``` -------------------------------- ### Basic Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/README.md Example of basic Swayimg configuration using Lua to set default scale, configure text, and add a keyboard shortcut. ```lua -- Set default scale swayimg.viewer.set_default_scale("fit") -- Configure text swayimg.text.set_font("Monospace") swayimg.text.set_size(14) -- Add keyboard shortcut swayimg.viewer.on_key("q", function() swayimg.exit() end) ``` -------------------------------- ### Load image from command output Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of loading an image generated by an external command. ```bash swayimg "exec://wget -qO- https://example.com/image.jpg" ``` -------------------------------- ### Light Theme Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Sets up a light theme with black text, white background, and a light gray chessboard pattern for the viewer background. ```lua -- Light background, dark text swayimg.text.set_foreground(0xff000000) -- Black text swayimg.text.set_background(0xffffffff) -- White background swayimg.text.set_shadow(0x00000000) swayimg.viewer.set_window_background(0xfff5f5f5) swayimg.viewer.set_image_chessboard(8, 0xffe0e0e0, 0xffc0c0c0) ``` -------------------------------- ### Key Combinations Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/types.md Examples of combining modifier keys with other keys. ```lua "Ctrl-a" -- Control + A "Shift-q" -- Shift + Q "Alt-Tab" -- Alt + Tab "Ctrl-Shift-s" -- Control + Shift + S "Ctrl-Alt-Delete" -- Control + Alt + Delete ``` -------------------------------- ### Loading stdout from external commands Source: https://github.com/artemsen/swayimg/blob/master/USAGE.md Example of how to load image data from the standard output of external commands using the 'exec://' prefix. ```bash swayimg "exec://wget -qO- https://www.kernel.org/theme/images/logos/tux.png" \ "exec://curl -so- https://www.kernel.org/theme/images/logos/tux.png" ``` -------------------------------- ### Read from pipe Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of reading image data from standard input via a pipe. ```bash wget -qO- https://example.com/image.jpg | swayimg - ``` -------------------------------- ### Get list of all entries in the image list Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Fetches an array containing all file entries currently in the image list. ```lua swayimg.imagelist.get() -- Returns: swayimg.entry[] -- Array with all file entries ``` -------------------------------- ### Viewer Key Bindings Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Provides a comprehensive list of key bindings for navigating and manipulating images within the swayimg viewer mode. ```lua -- Navigation swayimg.viewer.on_key("n", function() swayimg.viewer.switch_image("next") end) swayimg.viewer.on_key("p", function() swayimg.viewer.switch_image("prev") end) swayimg.viewer.on_key("Home", function() swayimg.viewer.switch_image("first") end) swayimg.viewer.on_key("End", function() swayimg.viewer.switch_image("last") end) -- Zoom swayimg.viewer.on_key("plus", function() swayimg.viewer.set_abs_scale(swayimg.viewer.get_scale() * 1.2) end) swayimg.viewer.on_key("minus", function() swayimg.viewer.set_abs_scale(swayimg.viewer.get_scale() / 1.2) end) -- Transform swayimg.viewer.on_key("bracketright", function() swayimg.viewer.rotate(90) end) -- ] swayimg.viewer.on_key("bracketleft", function() swayimg.viewer.rotate(270) end) -- [ swayimg.viewer.on_key("m", function() swayimg.viewer.flip_vertical() end) swayimg.viewer.on_key("M", function() swayimg.viewer.flip_horizontal() end) -- Reset swayimg.viewer.on_key("BackSpace", function() swayimg.viewer.reset() end) -- Mode switching swayimg.viewer.on_key("g", function() swayimg.set_mode("gallery") end) swayimg.viewer.on_key("s", function() swayimg.set_mode("slideshow") end) -- Display swayimg.viewer.on_key("t", function() if swayimg.text.visible() then swayimg.text.hide() else swayimg.text.show() end end) swayimg.viewer.on_key("f", function() swayimg.set_fullscreen() end) swayimg.viewer.on_key("a", function() swayimg.enable_antialiasing(not swayimg.viewer.get_scale()) -- toggle end) -- Mark swayimg.viewer.on_key("Insert", function() swayimg.viewer.mark_image() end) -- Exit swayimg.viewer.on_key("Escape", function() swayimg.exit() end) ``` -------------------------------- ### Loading stdout from external commands Source: https://github.com/artemsen/swayimg/blob/master/README.md Example of loading images from the stdout of external commands using 'exec://'. ```bash swayimg "exec://wget -qO- https://www.kernel.org/theme/images/logos/tux.png" \ "exec://curl -so- https://www.kernel.org/theme/images/logos/tux.png" ``` -------------------------------- ### XDG_RUNTIME_DIR Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of setting XDG_RUNTIME_DIR for swayimg to use a specific runtime directory. ```bash XDG_RUNTIME_DIR=/run/user/1000 swayimg image.jpg ``` -------------------------------- ### Configure Gallery Appearance and Performance Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-gallery-slideshow.md An example of initializing the gallery with custom appearance settings like aspect ratio, thumbnail size, padding, border, selection styling, and window color, along with performance options like hover, preload, and persistent storage. ```lua swayimg.on_initialized(function() -- Set up gallery appearance swayimg.gallery.set_aspect("fit") swayimg.gallery.set_thumb_size(128) swayimg.gallery.set_padding_size(8) -- Selection styling swayimg.gallery.set_border_size(3) swayimg.gallery.set_border_color(0xffffff00) -- yellow swayimg.gallery.set_selected_scale(1.05) swayimg.gallery.set_selected_color(0x40ffffff) swayimg.gallery.set_unselected_color(0x20ffffff) -- Window swayimg.gallery.set_window_color(0xff1a1a1a) -- Performance swayimg.gallery.enable_hover(true) swayimg.gallery.enable_preload(true) swayimg.gallery.enable_pstore(true) end) ``` -------------------------------- ### Gallery Key Bindings Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Details the key bindings available for navigating and managing images within the swayimg gallery mode. ```lua -- Navigation swayimg.gallery.on_key("Up", function() swayimg.gallery.switch_image("up") end) swayimg.gallery.on_key("Down", function() swayimg.gallery.switch_image("down") end) swayimg.gallery.on_key("Left", function() swayimg.gallery.switch_image("left") end) swayimg.gallery.on_key("Right", function() swayimg.gallery.switch_image("right") end) swayimg.gallery.on_key("Home", function() swayimg.gallery.switch_image("first") end) swayimg.gallery.on_key("End", function() swayimg.gallery.switch_image("last") end) swayimg.gallery.on_key("Page_Up", function() swayimg.gallery.switch_image("pgup") end) swayimg.gallery.on_key("Page_Down", function() swayimg.gallery.switch_image("pgdown") end) -- Size swayimg.gallery.on_key("plus", function() swayimg.gallery.set_thumb_size(swayimg.gallery.get_thumb_size() + 32) end) swayimg.gallery.on_key("minus", function() swayimg.gallery.set_thumb_size(math.max(32, swayimg.gallery.get_thumb_size() - 32)) end) -- Delete image swayimg.gallery.on_key("Delete", function() local entry = swayimg.gallery.get_image() os.remove(entry.path) swayimg.imagelist.remove(entry.path) swayimg.gallery.reload() end) -- Open in viewer swayimg.gallery.on_key("Return", function() swayimg.set_mode("viewer") end) -- Mark swayimg.gallery.on_key("Insert", function() swayimg.gallery.mark_image() end) -- Exit swayimg.gallery.on_key("Escape", function() swayimg.exit() end) ``` -------------------------------- ### Text Template Placeholders Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/README.md Examples of placeholders that can be used in text overlays within Swayimg. ```lua "{name}" -- Filename "{path}" -- Full path "{size}" -- File size "{width}x{height}" -- Image dimensions "{scale}" -- Zoom level "{meta.Camera}" -- EXIF metadata ``` -------------------------------- ### Text Overlay Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/INDEX.md Example of configuring text overlays to display image information like name, size, and dimensions. ```lua swayimg.viewer.set_text("topleft", { "{name}", "{sizehr}", "{width}x{height}" }) ``` -------------------------------- ### Navigate Gallery Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-gallery-slideshow.md Examples of navigating through thumbnails in gallery mode using various directional and page-based commands. ```lua -- Navigate gallery swayimg.gallery.switch_image("next") swayimg.gallery.switch_image("prev") swayimg.gallery.switch_image("up") swayimg.gallery.switch_image("down") -- Jump pages swayimg.gallery.switch_image("pgup") swayimg.gallery.switch_image("pgdown") ``` -------------------------------- ### For Low-Memory Systems Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Optimizes for low-memory systems by limiting image and gallery caches, disabling persistent storage, and turning off antialiasing. ```lua -- Limit image cache swayimg.viewer.limit_preload(1) -- Only preload current swayimg.viewer.limit_history(5) -- Keep few in cache -- Small gallery cache swayimg.gallery.limit_cache(10) -- Disable persistent storage swayimg.gallery.enable_pstore(false) -- Disable antialiasing swayimg.enable_antialiasing(false) ``` -------------------------------- ### Setup Slideshow with Custom Bindings Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-gallery-slideshow.md Configures slideshow timing, display settings, and includes a custom key binding for pausing/playing the slideshow animation. ```lua swayimg.on_initialized(function() -- Slideshow timing swayimg.slideshow.set_timeout(3) -- Display settings (same as viewer) swayimg.slideshow.set_default_scale("fit") swayimg.slideshow.enable_loop(true) -- Custom key bindings swayimg.slideshow.on_key("Space", function() if swayimg.slideshow.get_animation() then swayimg.slideshow.set_animation(false) swayimg.text.set_status("Slideshow paused") else swayimg.slideshow.set_animation(true) swayimg.text.set_status("Slideshow playing") end end) end) ``` -------------------------------- ### Animation Info Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Configures text display for animations, showing current frame, total frames, dimensions, and scale. ```lua swayimg.slideshow.set_text("topright", { "Frame {frame.index}/{frame.total}", "{width}x{height}", "{scale}" }) ``` -------------------------------- ### Setup Text Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-text.md Configures various text properties like font, size, spacing, padding, colors, and timeouts when the application initializes. ```lua swayimg.on_initialized(function() -- Configure font and size swayimg.text.set_font("Monospace") swayimg.text.set_size(14) swayimg.text.set_spacing(2) swayimg.text.set_padding(10) -- Configure colors swayimg.text.set_foreground(0xffffffff) -- White text swayimg.text.set_background(0x80000000) -- Semi-transparent black swayimg.text.set_shadow(0xff000000) -- Black shadow -- Configure timeouts swayimg.text.set_timeout(5) -- Hide after 5 seconds swayimg.text.set_status_timeout(3) -- Status hides after 3 seconds end) ``` -------------------------------- ### Dark Theme Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Sets up a dark theme with white text, black background, and a dark chessboard pattern for the viewer background. ```lua -- Dark background, light text swayimg.text.set_foreground(0xffffffff) -- White text swayimg.text.set_background(0xff000000) -- Black background swayimg.text.set_shadow(0x00000000) -- No shadow (good contrast) swayimg.viewer.set_window_background(0xff0a0a0a) swayimg.viewer.set_image_chessboard(8, 0xff333333, 0xff555555) ``` -------------------------------- ### SHELL Environment Variable Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Example of setting the SHELL environment variable for executing external commands. ```bash SHELL=/bin/bash swayimg "exec://command" ``` -------------------------------- ### Enable and disable filesystem monitoring Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-imagelist.md Example of enabling and disabling filesystem monitoring. ```lua -- Enable filesystem monitoring swayimg.imagelist.enable_fsmon(true) -- Now if you add images to the watched directories, they will automatically appear in the image list -- Disable filesystem monitoring swayimg.imagelist.enable_fsmon(false) -- Manual list management only ``` -------------------------------- ### High Contrast Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Configures a high-contrast theme with yellow text on a black background and a black shadow for maximum visibility. ```lua -- Maximum visibility swayimg.text.set_foreground(0xffffff00) -- Yellow text swayimg.text.set_background(0xff000000) -- Black background swayimg.text.set_shadow(0xff000000) -- Black shadow swayimg.viewer.set_window_background(0xff000000) ``` -------------------------------- ### For High-End Systems Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Optimizes for high-end systems by aggressively preloading images, using large caches, larger thumbnails, and enabling all features. ```lua -- Aggressive preloading swayimg.viewer.limit_preload(5) swayimg.viewer.limit_history(50) -- Large gallery cache swayimg.gallery.limit_cache(200) -- Larger thumbnails swayimg.gallery.set_thumb_size(256) -- Enable all features swayimg.gallery.enable_preload(true) swayimg.gallery.enable_pstore(true) swayimg.enable_antialiasing(true) ``` -------------------------------- ### Help and Version - Help Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to display the help message. ```bash swayimg -h ``` ```bash swayimg --help ``` -------------------------------- ### Dark Theme Configuration Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/INDEX.md Example configuration for setting a dark theme by adjusting foreground, background, and viewer background colors. ```lua swayimg.text.set_foreground(0xffffffff) swayimg.text.set_background(0x80000000) swayimg.viewer.set_window_background(0xff1a1a1a) ``` -------------------------------- ### Help and Version - Version Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to display version information. ```bash swayimg -V ``` ```bash swayimg --version ``` -------------------------------- ### Build with Meson Source: https://github.com/artemsen/swayimg/blob/master/README.md Instructions for building the project using the Meson build system. ```bash meson setup my_build_dir meson compile -C my_build_dir meson install -C my_build_dir ``` -------------------------------- ### color_t Example Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/types.md ARGB color in hexadecimal format. Examples of color_t usage. ```lua 0xffffffff -- White (fully opaque) 0xff000000 -- Black (fully opaque) 0xff00ff00 -- Green (fully opaque) 0x80ffffff -- White (semi-transparent) 0x00000000 -- Transparent 0xffff0000 -- Red (fully opaque) 0xffffff00 -- Yellow (fully opaque) ``` -------------------------------- ### Get Window Size Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-core.md Gets the current dimensions of the application window. ```lua local size = swayimg.get_window_size() print(string.format("Window size: %dx%d", size.width, size.height)) if size.width > 1920 then -- Use larger thumbnail size in gallery swayimg.gallery.set_thumb_size(256) end ``` -------------------------------- ### RAW Photo Workflow Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Configures Swayimg for RAW photo processing, including camera white balance, default scaling, antialiasing, and EXIF orientation. Also includes a custom keybinding for deleting images. ```lua -- Optimize for RAW photos swayimg.set_format_params("raw", { camera_wb = true }) swayimg.viewer.set_default_scale("fit") swayimg.enable_antialiasing(true) swayimg.enable_exif_orientation(true) -- Setup for photo review swayimg.viewer.on_key("Delete", function() local image = swayimg.viewer.get_image() os.remove(image.path) swayimg.imagelist.remove(image.path) swayimg.viewer.switch_image("next") end) ``` -------------------------------- ### Aligned Key-Value Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Demonstrates using tab characters (`\t`) to align key-value pairs for text display in the gallery. ```lua swayimg.gallery.set_text("topleft", { "File:\t{name}", "Path:\t{path}", "Size:\t{sizehr}", "Scale:\t{scale}" }) ``` -------------------------------- ### open Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Opens the file at the specified path, adding it to the image list. ```lua swayimg.viewer.open(path: string) ``` -------------------------------- ### Presentation Mode Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/configuration-guide.md Configures Swayimg for presentation mode, disabling decorations, enabling fullscreen, setting slideshow timeouts and scaling, and hiding text. ```lua -- Configure for presentations swayimg.enable_decoration(false) swayimg.set_fullscreen(true) swayimg.slideshow.set_timeout(5) swayimg.slideshow.set_default_scale("fit") swayimg.slideshow.set_default_position("center") swayimg.text.hide() ``` -------------------------------- ### Window Configuration - Size Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to set the initial window size. ```bash swayimg -S 1280,720 image.jpg ``` ```bash swayimg --size=1920,1080 image.jpg ``` -------------------------------- ### swayimg.get_appid Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get application Id. ```lua swayimg.get_appid() -> string ``` -------------------------------- ### swayimg.viewer.get_animation Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get current status of animation. ```lua swayimg.viewer.get_animation() -> boolean ``` -------------------------------- ### get_position Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Gets the current image position. ```lua swayimg.viewer.get_position() -> { x :integer, y: integer } ``` -------------------------------- ### get_scale Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Gets the current image scale. ```lua swayimg.viewer.get_scale() -> number ``` -------------------------------- ### swayimg.get_mouse_pos Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Get the mouse pointer coordinates. ```lua swayimg.get_mouse_pos() -> { x :integer, y: integer } ``` -------------------------------- ### enable_pstore Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Enable or disable persistent storage for thumbnails. ```lua swayimg.gallery.enable_pstore(enable: boolean) ``` -------------------------------- ### Run two instances with different window rules Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Demonstrates running two instances of swayimg with distinct application IDs to manage different window behaviors. ```bash swayimg --appid=swayimg-fullscreen image1.jpg swayimg --appid=swayimg-floating image2.jpg ``` -------------------------------- ### Configuration - Execute Lua Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to execute Lua script after loading configuration. ```bash swayimg -e "swayimg.viewer.set_default_scale('fit')" image.jpg ``` ```bash swayimg --execute="swayimg.text.set_size(16)" image.jpg ``` -------------------------------- ### Application Startup Data Flow Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/architecture.md A step-by-step representation of the application startup process. ```text main() └─> Application::self() └─> ui_initialize() ├─> Create Wayland/DRM UI ├─> Create window └─> Register input event handlers └─> il_initialize() ├─> Load image list from files/directories └─> Return first entry to display └─> LuaEngine::initialize() ├─> Load Lua configuration └─> Execute startup scripts └─> set_mode() -> activate viewer/slideshow/gallery └─> AppMode::activate() with first image └─> event_loop() ``` -------------------------------- ### Window Configuration - Position Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to set the initial window position. ```bash swayimg -P 0,0 image.jpg ``` ```bash swayimg --position=1920,1080 image.jpg ``` -------------------------------- ### Configuration - Config File Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md Commands to load a custom Lua configuration file. ```bash swayimg -c ~/.config/swayimg/custom.lua image.jpg ``` ```bash swayimg --config=/etc/swayimg/config.lua image.jpg ``` -------------------------------- ### Usage Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/command-line-interface.md The general command structure for swayimg. ```bash swayimg [OPTIONS]... [FILE]... ``` -------------------------------- ### open Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Opens the file at the specified path. This function adds a file to the image list and then opens it in the viewer. Available since 5.2. ```lua swayimg.slideshow.open(path: string) ``` -------------------------------- ### switch_image Source: https://github.com/artemsen/swayimg/blob/master/CONFIG.md Select the next thumbnail from the gallery. ```lua swayimg.gallery.switch_image(dir: gdir_t) ``` -------------------------------- ### Get Animation Status Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-viewer.md Retrieves the current status of animation playback. ```lua if swayimg.viewer.get_animation() then print("Animation is playing") else print("Animation is stopped") end ``` -------------------------------- ### Get Application Mode Source: https://github.com/artemsen/swayimg/blob/master/_autodocs/lua-api-core.md Retrieves the currently active application mode. ```lua local current_mode = swayimg.get_mode() print("Current mode: " .. current_mode) if current_mode == "gallery" then -- Do something gallery-specific end ```