mpvpaper kept running over the new theme's static wallpaper because nothing was watching the omarchy-theme symlink. Add a small sibling script that polls ~/.config/omarchy/current/background and, when the target changes, runs `motion-wallpaper-toggle stop` — which tears down mpvpaper and respawns swaybg with the new symlink target so the new theme's bg becomes visible. - motion-wallpaper-theme-watcher: polls readlink every 2s, exits silently on non-Omarchy systems where the symlink doesn't exist. - toggle: spawn alongside the auto-pause watcher; kill alongside it. - wallpaper.sh: install the new binary. |
||
|---|---|---|
| icons | ||
| motion-wallpaper-theme-watcher | ||
| motion-wallpaper-toggle | ||
| motion-wallpaper-watcher | ||
| motion-wallpaper.service | ||
| README.md | ||
| wallpaper.sh | ||
Motion Wallpaper - Omarchy
Animated video wallpapers for Omarchy (Arch Linux + Hyprland).
Uses mpvpaper to play any video file as your desktop wallpaper. Features a gum-powered TUI with Stop / Change-video / autostart toggle, a quick-pick library folder, a systemd autostart unit so the wallpaper survives reboots, and an auto-pause watcher that subscribes to Hyprland's event socket and pauses the video whenever a fullscreen window covers the wallpaper — so games and full-screen video don't pay the decode cost.
Quick Start
git clone https://git.no-signal.uk/nosignal/Motion-Wallpaper-Omarchy.git
cd Motion-Wallpaper-Omarchy
chmod +x wallpaper.sh
./wallpaper.sh
The installer handles all dependencies automatically.
Requirements
- OS: Omarchy (Arch Linux)
- Compositor: Hyprland
- AUR Helper: yay or paru (for mpvpaper)
What It Installs
Packages
| Package | Source | Purpose |
|---|---|---|
mpv |
Official repos | Video player engine (decodes and renders video) |
jq |
Official repos | Parses monitor info from Hyprland |
gum |
Official repos | TUI toolkit (action menus, monitor picker, file browser) |
socat |
Official repos | UNIX-socket bridge used by the auto-pause watcher |
libnotify |
Official repos | notify-send for post-action desktop notifications |
mpvpaper |
AUR | Wayland wallpaper daemon that uses mpv as its backend |
Files Created
| Path | Purpose |
|---|---|
~/.local/bin/motion-wallpaper-toggle |
Runtime TUI (toggle / start / stop / change / status) |
~/.local/bin/motion-wallpaper-watcher |
Auto-pause watcher — pauses mpv on fullscreen |
~/.local/share/applications/motion-wallpaper-toggle.desktop |
App launcher entry (Terminal=true) |
~/.local/share/icons/hicolor/scalable/apps/motion-wallpaper.svg |
Launcher icon |
~/.config/systemd/user/motion-wallpaper.service |
Autostart unit (not enabled by default) |
~/.config/motion-wallpaper/state |
Last video, target monitor, and last-used directory |
~/.cache/motion-wallpaper.log |
Runtime log |
Usage
From App Launcher
Search for "Motion Wallpaper" in Walker or your app launcher. Because the entry is a TUI, your launcher spawns a terminal window (Terminal=true in the .desktop entry) and runs the gum interface inside it. The terminal closes automatically when the action finishes.
From Terminal
motion-wallpaper-toggle # interactive — toggle, or Stop/Change if running
motion-wallpaper-toggle change # pick a new video without stopping first
motion-wallpaper-toggle stop # stop and restore the normal wallpaper
motion-wallpaper-toggle status # print current state
motion-wallpaper-toggle start # non-interactive start from saved state (used by systemd)
With a Keybind
Add this to ~/.config/hypr/bindings.conf:
bind = SUPER ALT, W, exec, ~/.local/bin/motion-wallpaper-toggle
Note
:
SUPER+Wis already bound to "Close window" in Omarchy. UseSUPER ALT+Wor another free combination.
Video library folder
Drop videos in ~/Videos/Wallpapers/ and the picker shows that folder as a quick list instead of opening the full filesystem browser. A Browse… entry is always available for picking something outside the library. The last directory you picked from is remembered (LAST_DIR in the state file) — next time you Browse…, gum file opens there instead of $HOME.
Persist across reboots (autostart)
The first time you start a wallpaper, the TUI asks whether to enable autostart. Say yes and the bundled systemd user unit is enabled — on next login it calls motion-wallpaper-toggle start, which loads the saved video + target and starts mpvpaper non-interactively.
You can flip autostart any time from the running-state menu (Turn autostart ON / OFF). The header always shows the current state. If you click Stop while autostart is still on, the TUI offers to disable it too so "stop" really means stop. If you disable autostart while the wallpaper is running, it offers to stop the current instance.
CLI alternative:
systemctl --user enable --now motion-wallpaper.service
systemctl --user disable --now motion-wallpaper.service
If no state has been saved yet, the unit exits cleanly without error.
How It Works
Toggle — not running
- Detects monitors via
hyprctl monitors -j. - If multiple monitors, offers a picker with an All monitors option (passes
*to mpvpaper). - Shows the video library (if any) or a
gum filebrowser starting atLAST_DIR. - Stops the current wallpaper daemon (
swaybgon Omarchy, orhyprpaperon generic Hyprland) so mpvpaper is visible, then runssetsid uwsm-app -- mpvpaper -o "..."with--loop --no-audio --mute=yes --vo=gpu --profile=high-quality --input-ipc-server=…and spawns the watcher.setsid+uwsm-appdetaches mpvpaper from the TUI terminal so it survives the window closing. - Verifies mpvpaper is alive after 0.8s; surfaces failures inline and holds the terminal open until you press enter.
- Saves video, target, and last-used directory to
~/.config/motion-wallpaper/state(atomic write, parsed back withoutsourceso it can't execute code from the state file). - If autostart isn't already enabled, asks whether to enable it.
Toggle — already running
Shows a menu with four entries:
- Stop motion wallpaper — kill the watcher + mpvpaper and restore the previous static wallpaper. On Omarchy this respawns
swaybg -i ~/.config/omarchy/current/background -m fillviauwsm-app, matching how Omarchy autostarts it; on generic Hyprland it re-execshyprpaper. Stop isflock-guarded, so the TUI path and systemd'sExecStopcan't race. - Change video — pick a new video, keep the same target, swap in place (
LAST_DIRupdates if you browsed). - Turn autostart ON / OFF — toggles the systemd unit. Label reflects current state.
- Cancel — bail without changes.
Auto-pause (the watcher)
motion-wallpaper-watcher subscribes to Hyprland's event socket ($XDG_RUNTIME_DIR/hypr/<instance>/.socket2.sock) and, on fullscreen>>1, sends {"command":["set_property","pause",true]} to mpv's IPC socket (--input-ipc-server). On fullscreen>>0 it resumes. The watcher is started and killed alongside mpvpaper by the toggle script. mpvpaper's own -p flag was flaky on Hyprland 0.54.x, hence this external approach.
Supported Video Formats
Any format mpv supports, including:
.mp4(H.264, H.265).mkv(Matroska).webm(VP9, AV1).mov(QuickTime).avi
Finding Video Wallpapers
Search for "live wallpaper" or "motion desktop" videos. Good sources include:
- YouTube (download with
yt-dlp) - Wallpaper Engine workshop (some can be extracted)
- Free stock video sites (Pexels, Pixabay)
Tips for best results:
- Match your monitor resolution (e.g. 3840x2160 for 4K)
- Seamless loops look best (no visible cut at the loop point)
- Shorter videos (10-30 seconds) use less memory
- H.264
.mp4has the best hardware decode support
Performance
mpvpaper uses GPU-accelerated rendering (--vo=gpu) so CPU usage is minimal. The watcher also pauses playback whenever a fullscreen window covers the wallpaper, so games and full-screen video don't pay the decode cost.
- Higher resolution videos use more VRAM.
- Shorter seamless loops (10–30s) use less memory.
- If you still notice impact, toggle the wallpaper off or disable autostart.
Troubleshooting
First stop: ~/.cache/motion-wallpaper.log — both the toggle script and mpvpaper write there.
Video wallpaper doesn't appear / shows black
- Check the log. Codec issues and "no such monitor" errors both show up there.
- Make sure hyprpaper and swaybg are not running:
pgrep hyprpaper && pkill hyprpaper
TUI fails with "gum is not installed"
sudo pacman -S gum
Launcher runs it but no terminal opens
- Make sure your default terminal is XDG-registered. Omarchy's alacritty works out of the box.
- As a fallback, run
motion-wallpaper-toggledirectly from any terminal.
"No monitors detected" error
- Make sure you're running Hyprland:
echo $XDG_CURRENT_DESKTOP - Check hyprctl works:
hyprctl monitors
Autostart unit fails
journalctl --user -u motion-wallpaper.service- If the saved video was moved or deleted, the unit exits non-zero. Run the toggle interactively once to save fresh state.
Auto-pause isn't pausing on fullscreen
- Make sure the window is truly fullscreen (
hyprctl activewindow -j | jq '.fullscreen'should be non-zero). On Omarchy, SUPER+F is true fullscreen; SUPER+ALT+F is only "full width" and won't trigger pause. grep watcher: ~/.cache/motion-wallpaper.logshould showfullscreen entered — pause/fullscreen left — resumelines.- If the watcher isn't running:
pgrep -af motion-wallpaper-watcher. If missing, the toggle script failed to spawn it — check the log around the start time.
Normal wallpaper doesn't come back after toggling off
- Omarchy:
pkill -x swaybg; setsid uwsm-app -- swaybg -i ~/.config/omarchy/current/background -m fill & - Or just cycle the background:
omarchy-theme-bg-nextthen back withSUPER CTRL SPACE. - Generic Hyprland:
hyprctl dispatch exec hyprpaper.
Uninstalling
# Stop and disable autostart if enabled
systemctl --user disable --now motion-wallpaper.service 2>/dev/null || true
# Remove installed files
rm -f ~/.local/bin/motion-wallpaper-toggle
rm -f ~/.local/bin/motion-wallpaper-watcher
rm -f ~/.local/share/applications/motion-wallpaper-toggle.desktop
rm -f ~/.local/share/icons/hicolor/scalable/apps/motion-wallpaper.svg
rm -f ~/.config/systemd/user/motion-wallpaper.service
rm -rf ~/.config/motion-wallpaper
rm -f ~/.cache/motion-wallpaper.log
systemctl --user daemon-reload
# Optionally remove packages (skip any you want to keep for other uses)
sudo pacman -Rns mpvpaper gum socat
Credits
- Omarchy - The Arch Linux distribution this was built for
- mpvpaper - Wayland video wallpaper daemon
- mpv - The video player engine
- Hyprland - Wayland compositor
License
This project is provided as-is for the Omarchy community.
