mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Define help with keys This means that keys and help are automatically in sync This means that you can't define keys, but forget help This unfortunately also means that formatting may not be quite as good
31 lines
714 B
Go
31 lines
714 B
Go
package spotify
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func (widget *Widget) initializeKeyboardControls() {
|
|
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
|
|
widget.SetKeyboardChar("h", widget.previous, "Select previous item")
|
|
widget.SetKeyboardChar("l", widget.next, "Select next item")
|
|
widget.SetKeyboardChar(" ", widget.playPause, "Play/pause song")
|
|
}
|
|
|
|
func (widget *Widget) previous() {
|
|
widget.SpotifyClient.Previous()
|
|
time.Sleep(time.Second * 1)
|
|
widget.Refresh()
|
|
}
|
|
|
|
func (widget *Widget) next() {
|
|
widget.SpotifyClient.Next()
|
|
time.Sleep(time.Second * 1)
|
|
widget.Refresh()
|
|
}
|
|
|
|
func (widget *Widget) playPause() {
|
|
widget.SpotifyClient.PlayPause()
|
|
time.Sleep(time.Second * 1)
|
|
widget.Refresh()
|
|
}
|