diff --git a/pws/go.mod b/pws/go.mod new file mode 100644 index 0000000..582944f --- /dev/null +++ b/pws/go.mod @@ -0,0 +1,5 @@ +module pws + +go 1.26.1 + +require github.com/rthornton128/goncurses v0.0.0-20251206192105-7e6d2302acca // indirect diff --git a/pws/go.sum b/pws/go.sum new file mode 100644 index 0000000..8e1e36f --- /dev/null +++ b/pws/go.sum @@ -0,0 +1,2 @@ +github.com/rthornton128/goncurses v0.0.0-20251206192105-7e6d2302acca h1:kFR/H0Y6K2vP5EU0lYLoRWXIiLPztK1r6DTUeSkNo08= +github.com/rthornton128/goncurses v0.0.0-20251206192105-7e6d2302acca/go.mod h1:AHlKFomPTwmO7H2vL8d7VNrQNQmhMi/DBhDnHRhjbCo= diff --git a/pws/pws.go b/pws/pws.go new file mode 100644 index 0000000..f5cf5a5 --- /dev/null +++ b/pws/pws.go @@ -0,0 +1,53 @@ +package main + +// with this tool you can setup a pipewire audio configuration +// you can select the bitrate and the buffersize for your audiocard +// you need ncurses to be installed on your system + +import ( + "log" + gc "github.com/rthornton128/goncurses" +) + +func main() { + + // setup main window + stdscr, err := gc.Init() + if err != nil { + log.Fatal(err) + } + defer gc.End() + + // HasColors can be used to determine whether the current terminal + // has the capability of using colours. You could then chose whether or + // not to use some other mechanism, like using A_REVERSE, instead + if !gc.HasColors() { + log.Fatal("Example requires a colour capable terminal") + } + + // Must be called after Init but before using any colour related functions + if err := gc.StartColor(); err != nil { + log.Fatal(err) + } + + gc.Echo(false) + + // Initialize a colour pair. Should only fail if an improper pair value + // is given + if err := gc.InitPair(1, gc.C_BLACK, gc.C_CYAN); err != nil { + log.Fatal("InitPair failed: ", err) + } + + stdscr.Keypad(true) + // ColorOn/Off is a shortcut to calling AttrOn/Off(gc.ColorPair(pair)) + stdscr.ColorOn(1) + stdscr.SetBackground(gc.Char(' ') | gc.ColorPair(1)) + stdscr.MovePrint(12, 30, "Hello, World!!!") + stdscr.MovePrint(13, 30, "Hello, World in Color!!!") + stdscr.Refresh() + stdscr.GetChar() + + stdscr.ColorOff(1) + + +}