From 18961e95223a6030fd007472d4b38a498fd1ed14 Mon Sep 17 00:00:00 2001 From: diviocity Date: Sat, 7 Nov 2026 16:34:29 +0100 Subject: [PATCH] adding skip to double-clicked items --- build.vsh | 2 +- src/player.v | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/build.vsh b/build.vsh index e29687d..94142bd 100755 --- a/build.vsh +++ b/build.vsh @@ -1,5 +1,5 @@ #!/usr/bin/env -S v run -import imp +import x.imp // one architecture per build: vab links every ABI against the same -L path, and // lld stops at the first libmpv.so it finds (libvendetta/mpv/android/README.md) diff --git a/src/player.v b/src/player.v index 8e6ab92..a63772c 100644 --- a/src/player.v +++ b/src/player.v @@ -225,8 +225,12 @@ mut: queue_scroll f64 queue_serial u64 queue_frame ui2.Rect - theme Theme - theme_name string = default_theme_name + // Double-click tracking for queue rows: a second click on the same row + // within a short window plays that entry instead of just selecting it. + queue_last_click_key string + queue_last_click_t i64 + theme Theme + theme_name string = default_theme_name // The theme editor panel: the theme the edits start from, the fields' // texts, and each colour row's chooser. theme_editor_open bool @@ -710,6 +714,8 @@ fn (mut p Player) queue_reset_keys() { p.queue_keys = []string{cap: p.queue.len} p.queue_state = ui2.ReorderState{} p.queue_scroll = 0 + p.queue_last_click_key = '' + p.queue_last_click_t = 0 for _ in 0 .. p.queue.len { p.queue_keys << p.queue_new_key() } @@ -727,6 +733,23 @@ fn (p &Player) queue_index(key string) int { fn (mut p Player) queue_apply_step(step ui2.ReorderStep) { p.queue_state = step.state if !step.moved { + // A click that lands and stays put is a selection, not a reorder. Two + // of them on the same row within a short window play that entry, so a + // row can be jumped to without hunting next/previous. + if step.clicked != '' { + now := time.ticks() + if step.clicked == p.queue_last_click_key && now - p.queue_last_click_t <= 500 { + index := p.queue_index(step.clicked) + if index >= 0 && p.render_ctx != unsafe { nil } { + mpv.command_async(p.mpv_ctx, u64(87), ['playlist-play-index', '${index}']) + } + p.queue_last_click_key = '' + p.queue_last_click_t = 0 + } else { + p.queue_last_click_key = step.clicked + p.queue_last_click_t = now + } + } return } p.queue = ui2.reorder_move(p.queue, step.from, step.to) -- 2.56.1