Repository navigation
7 Profiles
The control bar can show a different set of buttons per situation — fullscreen, a media type (anime, music, …). The mechanism: an auto-profile changes ucm's default state, and all buttons follow.
An auto-profile is a standard mpv feature — a named set of settings that activates when a condition is true. Its profile-cond is a Lua expression mpv evaluates continuously; while it's truthy the profile is on. Put an IIFE inside to send ucm the message:
[anime-profile]
# "media_type" = whatever property marks anime in your setup
profile-cond=(function() if get("media_type") == "anime" then mp.commandv("script-message-to", "ucm", "set-default", "anime") return true end end)()
[windowed-profile]
profile-cond=(function() if not get("fullscreen") then mp.commandv("script-message-to", "ucm", "revert-default") return true end end)()
revert-default restores the original default state (the one from startup) — that's what puts the buttons back when you leave fullscreen. (The property in profile-cond is up to your setup; fullscreen is a regular mpv property.) The not get("fullscreen") profile fires its IIFE twice at mpv startup — harmless, revert-default is idempotent.
Name a state per situation and switch every button to it with one message:
# ucm.conf
state_map=windowed:default,anime,music,fullscreen
- Anime — subtitle/language buttons, a codec button.
- Music — loop, shuffle.
- Fullscreen — fewer, bigger buttons.
When [anime-profile] activates, set-default anime runs and every button with an anime state switches to it; deactivate it and revert-default restores the windowed layout. Modifier keys still work on top — a held key still shows that modifier's state, and releasing reverts to the current default (which is now the profile's state).