# Generic media viewers. mpv for video/audio, imv for images — both minimal, # keyboard-driven, Wayland-native. No personal config here. # # imv key binds run external actions on the current file (yank path, rotate/flip, # delete, open in editor, info). Wallpaper uses awww (daemon + CLI): `setbg` # symlinks the chosen file to ~/.local/share/bg and pushes it live. The # awww-daemon and the boot-time restore from that symlink run as Hyprland # `exec-once` (see home.nix). { pkgs, ... }: let # setbg: persist the choice as an XDG-data symlink, then set it live. Startup # restore just re-runs `awww img` against the same symlink. setbg = pkgs.writeShellScriptBin "setbg" '' bgloc="''${XDG_DATA_HOME:-$HOME/.local/share}/bg" [ -n "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" ${pkgs.awww}/bin/awww img "$bgloc" ''; in { programs.mpv = { enable = true; # gallery/thumbnail grid for playlists. Ships the scripts; key bindings to # open it can be added later via programs.mpv.bindings (input.conf). scripts = [ pkgs.mpvScripts.mpv-gallery-view ]; }; programs.imv = { enable = true; settings.binds = { "w" = ''exec setbg "$imv_current_file"''; "y" = ''exec printf %s "$imv_current_file" | wl-copy''; "" = ''exec readlink -f "$imv_current_file" | wl-copy''; "" = ''exec rm "$imv_current_file"''; # no confirm "r" = ''exec magick "$imv_current_file" -rotate 90 "$imv_current_file"''; "" = ''exec magick "$imv_current_file" -rotate -90 "$imv_current_file"''; "f" = ''exec magick "$imv_current_file" -flop "$imv_current_file"''; "g" = ''exec gimp "$imv_current_file"''; "i" = ''exec notify-send "File info" "$(mediainfo "$imv_current_file")"''; }; }; home.packages = with pkgs; [ setbg awww # wayland wallpaper daemon (setbg backend) wl-clipboard # wl-copy, for the yank binds imagemagick # `magick`: rotate/flip binds mediainfo # `i` info bind libnotify # notify-send client (daemon = mako, in home.nix) gimp # `g` open-in-editor bind ]; }