Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/mpv/modernz.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var modernZRequiredFiles = []struct {
{source: "modernz.lua", target: filepath.Join("scripts", "modernz.lua")},
{source: "modernz.conf", target: filepath.Join("script-opts", "modernz.conf")},
{source: "modernz-icons.ttf", target: filepath.Join("fonts", "modernz-icons.ttf")},
{source: "thumbfast.lua", target: filepath.Join("scripts", "thumbfast.lua")},
{source: "thumbfast.conf", target: filepath.Join("script-opts", "thumbfast.conf")},
}

type modernZAssets struct {
Expand Down
12 changes: 9 additions & 3 deletions internal/mpv/modernz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func TestEnsureModernZAssetsCopiesScriptOptionsAndFont(t *testing.T) {
"modernz.lua": "-- test lua\n",
"modernz.conf": "layout=modern\n",
"modernz-icons.ttf": "test font",
"thumbfast.lua": "-- thumbfast lua\n",
"thumbfast.conf": "max_height=200\n",
}
sourceDir := writeModernZTestAssets(t)

Expand All @@ -23,9 +25,11 @@ func TestEnsureModernZAssetsCopiesScriptOptionsAndFont(t *testing.T) {
}

expected := map[string]string{
filepath.Join(assets.ConfigDir, "scripts", "modernz.lua"): files["modernz.lua"],
filepath.Join(assets.ConfigDir, "script-opts", "modernz.conf"): files["modernz.conf"],
filepath.Join(assets.ConfigDir, "fonts", "modernz-icons.ttf"): files["modernz-icons.ttf"],
filepath.Join(assets.ConfigDir, "scripts", "modernz.lua"): files["modernz.lua"],
filepath.Join(assets.ConfigDir, "script-opts", "modernz.conf"): files["modernz.conf"],
filepath.Join(assets.ConfigDir, "fonts", "modernz-icons.ttf"): files["modernz-icons.ttf"],
filepath.Join(assets.ConfigDir, "scripts", "thumbfast.lua"): files["thumbfast.lua"],
filepath.Join(assets.ConfigDir, "script-opts", "thumbfast.conf"): files["thumbfast.conf"],
assets.ScriptPath: files["modernz.lua"],
}
for path, content := range expected {
Expand Down Expand Up @@ -76,6 +80,8 @@ func writeModernZTestAssets(t *testing.T) string {
"modernz.lua": "-- test lua\n",
"modernz.conf": "layout=modern\n",
"modernz-icons.ttf": "test font",
"thumbfast.lua": "-- thumbfast lua\n",
"thumbfast.conf": "max_height=200\n",
}
for name, content := range files {
if err := os.WriteFile(filepath.Join(sourceDir, name), []byte(content), 0o644); err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/mpv/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func buildCommand(path string, options PlayOptions) (*exec.Cmd, error) {
args = append(args, "--vo=x11")
}
args = append(args, "--include="+mpvConfigPath)
args = append(args, "--script-opt=thumbfast-mpv_path="+mpvPath)
args = append(args, "--script="+modernZ.ScriptPath)
if screenshotArgs, err := buildPlaybackScreenshotArgs(options); err != nil {
return nil, err
Expand Down
41 changes: 41 additions & 0 deletions modernz/thumbfast.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Socket path (leave empty for auto)
socket=

# Thumbnail path (leave empty for auto)
thumbnail=

# Maximum thumbnail generation size in pixels (scaled down to fit)
# Values are scaled when hidpi is enabled
max_height=200
max_width=200

# Scale factor for thumbnail display size (requires mpv 0.38+)
# Note that this is lower quality than increasing max_height and max_width
scale_factor=1

# Apply tone-mapping, no to disable
tone_mapping=auto

# Overlay id
overlay_id=42

# Spawn thumbnailer on file load for faster initial thumbnails
spawn_first=no

# Close thumbnailer process after an inactivity period in seconds, 0 to disable
quit_after_inactivity=0

# Enable on network playback
network=no

# Enable on audio playback
audio=no

# Enable hardware decoding
hwdec=no

# Windows only: use native Windows API to write to pipe (requires LuaJIT)
direct_io=no

# Custom path to the mpv executable
mpv_path=mpv
Loading