log to /tmp/waybar-mpris.log
This commit is contained in:
parent
f4090c1f07
commit
6ed1eb428f
9
main.go
9
main.go
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@ -44,6 +45,7 @@ const (
|
|||||||
// PropertiesChanged
|
// PropertiesChanged
|
||||||
MATCH_PC = "type='signal',path='/org/mpris/MediaPlayer2',interface='org.freedesktop.DBus.Properties'"
|
MATCH_PC = "type='signal',path='/org/mpris/MediaPlayer2',interface='org.freedesktop.DBus.Properties'"
|
||||||
SOCK = "/tmp/waybar-mpris.sock"
|
SOCK = "/tmp/waybar-mpris.sock"
|
||||||
|
LOGFILE = "/tmp/waybar-mpris.log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -352,6 +354,13 @@ func (pl *PlayerList) Toggle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
logfile, err := os.OpenFile(LOGFILE, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Couldn't open %s for writing: %s", LOGFILE, err)
|
||||||
|
}
|
||||||
|
mw := io.MultiWriter(logfile, os.Stdout)
|
||||||
|
log.SetOutput(mw)
|
||||||
|
os.Stderr = logfile
|
||||||
flag.StringVar(&PLAY, "play", PLAY, "Play symbol/text to use.")
|
flag.StringVar(&PLAY, "play", PLAY, "Play symbol/text to use.")
|
||||||
flag.StringVar(&PAUSE, "pause", PAUSE, "Pause symbol/text to use.")
|
flag.StringVar(&PAUSE, "pause", PAUSE, "Pause symbol/text to use.")
|
||||||
flag.StringVar(&SEP, "separator", SEP, "Separator string to use between artist, album, and title.")
|
flag.StringVar(&SEP, "separator", SEP, "Separator string to use between artist, album, and title.")
|
||||||
|
BIN
waybar-mpris
BIN
waybar-mpris
Binary file not shown.
Loading…
Reference in New Issue
Block a user