# uosc provides seeking & volume indicators (via flash-timeline and flash-volume commands)
# if you decide to use them, you don't need osd-bar
osd-bar=no

# uosc will draw its own window controls and border if you disable window border
border=no

# Ensure uosc texture/icon fonts are discoverable by libass.
osd-fonts-dir=~~/scripts/uosc/fonts
sub-fonts-dir=~~/scripts/uosc/

ontop=yes  
autofit=45%
# Avoid showing embedded cover art for audio-only files if uosc isn't working,
# but we keep it enabled for now to ensure a window exists.
audio-display=yes
keepaspect=no
video-unscaled=no
cursor-autohide=1000

# modern gpu-next is preferred in recent mpv builds
vo=gpu-next,gpu,direct3d

# Show this after loading a new file.
osd-playing-msg=${!playlist-count==1:[${playlist-pos-1}/${playlist-count}] }${media-title} ${?width:${width}x${height}} ${?current-tracks/video/image==no:${?percent-pos==0:${duration}}${!percent-pos==0:${time-pos} / ${duration} (${percent-pos}%)}}
osd-playing-msg-duration=7000

# Restore transparency options
background=none
background-color=0/0

# Without transparency, these options may be useful:
# background-color=.2 # don't use pure black (disabled to keep video background transparent)
force-window-position # recenter the window when changing playlist position on X11 and macOS
auto-window-resize=no # preserve the window size when changing playlist entry

# Set options for stand-alone images.
# The condition is written not to restore and reapply the options on each image
# because that is inefficient, especially for toggling --d3d11-flip which
# reinits the VO.
[image]
profile-cond=get('current-tracks/video', {}).image or (not get('current-tracks/video') and get('user-data/mpv/image'))
profile-restore=copy

# Stand-alone images.
image-display-duration=inf # don't stop displaying images after 5 second
prefetch-playlist # load the next image before viewing it
reset-on-next-file=video-zoom,panscan,video-unscaled,video-align-x,video-align-y,video-rotate # reset zoom, alignment and rotation between images

d3d11-flip=no # enable background transparency if on d3d11/Windows
video-recenter # recenter after zooming out
input-preprocess-wheel=no # pan diagonally with a touchpad
taskbar-progress=no # don't show a full green progress in Windows' taskbar

[non-image]
profile-cond=get('user-data/mpv/image') and (not get('current-tracks/video', {image = true}).image or get('current-tracks/audio'))
input-commands=no-osd del user-data/mpv/image; disable-section image # disable image key bindings

# Loop short videos like gifs.
[loop-short]
profile-cond=get('duration', 100) < 30 and p['current-tracks/video/image'] == false
profile-restore=copy
loop-file

# Enable the screensaver when images are kept open forever.
[screensaver]
profile-cond=p['current-tracks/video'].image and image_display_duration == math.huge
profile-restore=copy
stop-screensaver=no

[manga]
profile-cond=get('path', ''):find('manga')
video-align-y=-1 # start from the top
reset-on-next-file-remove=video-zoom # preserve the zoom when changing file
reset-on-next-file-remove=panscan
reset-on-next-file-remove=video-unscaled
linear-downscaling=no # don't make black and white manga brighter
