diff options
author | lawl <github@dumbinter.net> | 2020-08-03 15:00:43 +0200 |
---|---|---|
committer | lawl <github@dumbinter.net> | 2020-08-03 15:00:43 +0200 |
commit | 371b3e33b523f45ec51776e7e7a33f824084dca5 (patch) | |
tree | 9d7573b66f43dd687e8064f5976a22e62dff21c4 | |
parent | 4243d5036d1e7d339ca8ee3ff8a0be88a9f0d92c (diff) | |
download | noisetorch-371b3e33b523f45ec51776e7e7a33f824084dca5.tar.gz noisetorch-371b3e33b523f45ec51776e7e7a33f824084dca5.zip |
Fix bugs with pa reconnection
-rw-r--r-- | main.go | 3 | ||||
-rw-r--r-- | ui.go | 18 |
2 files changed, 16 insertions, 5 deletions
@@ -101,6 +101,7 @@ func removeLib(file string) { func paConnectionWatchdog(ui *uistate) { for { if ui.paClient.Connected() { + time.Sleep(500 * time.Millisecond) continue } @@ -139,6 +140,8 @@ func paConnectionWatchdog(ui *uistate) { ui.inputList = inputs + resetUI(ui) + time.Sleep(500 * time.Millisecond) } } @@ -35,6 +35,11 @@ var orange = color.RGBA{255, 140, 0, 255} func updatefn(w *nucular.Window, ui *uistate) { + if !ui.paClient.Connected() { + connectScreen(w, ui) + return + } + if ui.loadingScreen { loadingScreen(w, ui) return @@ -50,11 +55,6 @@ func updatefn(w *nucular.Window, ui *uistate) { return } - if !ui.paClient.Connected() { - connectScreen(w, ui) - return - } - w.MenubarBegin() w.Row(10).Dynamic(2) @@ -270,3 +270,11 @@ func connectScreen(w *nucular.Window, ui *uistate) { w.Row(50).Dynamic(1) w.Label("Connecting to pulseaudio...", "CB") } + +func resetUI(ui *uistate) { + ui.loadingScreen = false + + if ui.masterWindow != nil { + (*ui.masterWindow).Changed() + } +} |