mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
31 lines
621 B
Go
31 lines
621 B
Go
package spotify
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func (widget *Widget) initializeKeyboardControls() {
|
|
widget.SetKeyboardChar("/", widget.ShowHelp)
|
|
widget.SetKeyboardChar("h", widget.previous)
|
|
widget.SetKeyboardChar("l", widget.next)
|
|
widget.SetKeyboardChar(" ", widget.playPause)
|
|
}
|
|
|
|
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()
|
|
}
|