mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
add built-in fzf (queue)
This commit is contained in:
parent
c6e0af6f4a
commit
7b11fda8b1
23
queue.go
23
queue.go
@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/ztrue/tracerr"
|
||||
)
|
||||
|
||||
@ -410,12 +411,34 @@ func newQueue() *Queue {
|
||||
|
||||
case '/':
|
||||
|
||||
if viper.GetBool("general.fzf") {
|
||||
|
||||
gomu.suspend()
|
||||
if err := queue.fuzzyFind(); err != nil {
|
||||
logError(err)
|
||||
}
|
||||
gomu.unsuspend()
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
audios := make([]string, len(queue.items))
|
||||
for i, file := range queue.items {
|
||||
audios[i] = file.name
|
||||
}
|
||||
|
||||
searchPopup(audios, func(selected string) {
|
||||
|
||||
index := 0
|
||||
for i, v := range queue.items {
|
||||
if v.name == selected {
|
||||
index = i
|
||||
}
|
||||
}
|
||||
|
||||
queue.SetCurrentItem(index)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user