Add --disable-mouse option

This commit is contained in:
Trevor Slocum 2020-01-29 08:54:05 -08:00
parent 3ed0a1ee85
commit aafe81b48b
5 changed files with 12 additions and 6 deletions

View file

@ -1,5 +1,6 @@
0.1.7:
- Add scrollbar to lists
- Add --disable-mouse option
0.1.6:
- Add mouse support to queue

View file

@ -4,8 +4,9 @@ configuration options and their defaults.
# Options
* **--buffer-size** Audio buffer size, defaults to 500ms.
* **--autoplay-queue** Start playing when the queue is added to.
* **--restrict-library** Restrict access to a folder and its subfolders.
* **--disable-autoplay** Disable automatically playing the queue.
* **--disable-mouse** Disable mouse support.
* **--fd** Write audio in WAV format to the specified file descriptor instead. This allows ditty to be used over ssh:
* `ssh ditty.rocketnine.space -t 'ditty --fd=2' 2> >(aplay --quiet)`
* Note: Writing to a file descriptor disables pause support.

4
gui.go
View file

@ -59,7 +59,9 @@ var (
func initTUI() error {
app = cview.NewApplication()
app.EnableMouse()
if !disableMouse {
app.EnableMouse()
}
app.SetInputCapture(inputConfig.Capture)

View file

@ -133,7 +133,7 @@ func listQueue() {
queueFiles = append(queueFiles, scanFiles...)
queueLock.Unlock()
if playOnQueue && playingFileID == 0 && len(queueFiles) > 0 {
if !disableAutoplay && playingFileID == 0 && len(queueFiles) > 0 {
queueSelect()
}
go app.QueueUpdateDraw(updateQueue)
@ -145,7 +145,7 @@ func listQueue() {
queueFiles = append(queueFiles, entry)
if playOnQueue && playingFileID == 0 {
if !disableAutoplay && playingFileID == 0 {
queueSelect()
}
go app.QueueUpdateDraw(updateLists)

View file

@ -36,7 +36,8 @@ var (
restrictLibrary string
showHiddenFolders bool
startingVolumeFlag int
playOnQueue bool
disableAutoplay bool
disableMouse bool
version = "0.0.0"
done = make(chan bool)
@ -54,7 +55,8 @@ func main() {
flag.IntVar(&streamFdInt, "fd", -1, "stream audio to file descriptor")
flag.IntVar(&startingVolumeFlag, "volume", -1, "initial volume level 0-100")
flag.StringVar(&restrictLibrary, "restrict-library", "", "restrict library to path")
flag.BoolVar(&playOnQueue, "autoplay-queue", true, "starting playing on initial queue")
flag.BoolVar(&disableAutoplay, "disable-autoplay", false, "disable automatically playing the queue")
flag.BoolVar(&disableMouse, "disable-mouse", false, "disable mouse support")
flag.DurationVar(&bufferSize, "buffer-size", defaultBufferSize, "audio buffer size")
flag.StringVar(&debugAddress, "debug-address", "", "address to serve debug info")
flag.BoolVar(&showHiddenFolders, "hidden-folders", false, "show hidden folders")