Compare commits

..

2 Commits

Author SHA1 Message Date
daniil-berg 0731e78003 feat(media): add zathura pdf/document viewer
minimal keyboard-driven viewer; bundled mupdf backend covers PDFs out of the
box. yank selection to the wayland clipboard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:35:54 +02:00
daniil-berg 1e163fe025 feat(media): add mpv and imv media viewers
new `modules/media.nix`: mpv (with mpv-gallery-view) for video/audio, imv for
images. imv key binds run per-file actions — copy path via `wl-copy`, rotate/
flip via `magick`, delete, open in gimp, show `mediainfo`. wallpaper via awww
plus a `setbg` wrapper (symlink to ~/.local/share/bg + live push); awww-daemon
and boot restore wired as hyprland exec-once. add mako as the notification
daemon backing the notify-send toasts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:32:51 +02:00
2 changed files with 78 additions and 1 deletions
+18 -1
View File
@@ -11,7 +11,7 @@ let
editor = "nvim";
in
{
imports = [ ./gpg.nix ];
imports = [ ./gpg.nix ./media.nix ];
home.sessionVariables = {
TERMINAL = terminal;
@@ -332,10 +332,27 @@ in
# Uses foot's default socket, which footclient also defaults to.
# Tradeoff: if the server dies, all foot windows die with it.
"foot --server"
# wallpaper (see modules/media.nix): start the awww daemon, then restore
# the persisted choice. awww keeps no state across restarts, so re-push
# the ~/.local/share/bg symlink if it exists.
"awww-daemon"
"sh -c '[ -e \"$HOME/.local/share/bg\" ] && awww img \"$HOME/.local/share/bg\"'"
];
};
};
# Notification daemon. notify-send clients (e.g. imv's info/delete toasts in
# modules/media.nix, gpg-agent errors) need a running server on the bus.
# Minimal to match the desktop: Nerd Font, no rounding, square border.
services.mako = {
enable = true;
settings = {
font = "JetBrainsMono Nerd Font 10";
border-radius = 0;
default-timeout = 5000;
};
};
programs.waybar = {
enable = true;
settings = {
+60
View File
@@ -0,0 +1,60 @@
# Generic viewers. mpv for video/audio, imv for images, zathura for PDFs/docs —
# all 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'';
"<Shift+Y>" = ''exec readlink -f "$imv_current_file" | wl-copy'';
"<Shift+D>" = ''exec rm "$imv_current_file"''; # no confirm
"r" = ''exec magick "$imv_current_file" -rotate 90 "$imv_current_file"'';
"<Shift+R>" = ''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")"'';
};
};
# PDF/document viewer. pkgs.zathura bundles the mupdf backend, so enabling is
# enough. Route yanks to the wayland clipboard.
programs.zathura = {
enable = true;
options.selection-clipboard = "clipboard";
};
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
];
}