Skip to content

Commit

Permalink
Merge pull request #2 from nwg-piotr/rc
Browse files Browse the repository at this point in the history
Fixed random crash when operating on Gtk.Listview
  • Loading branch information
nwg-piotr authored Apr 29, 2023
2 parents 57d30be + a5aeca0 commit ec0696b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/gotk3/gotk3/gtk"
)

const version = "0.0.2"
const version = "0.1.0"

type WindowState int

Expand Down Expand Up @@ -50,6 +50,7 @@ var (
monitors []monitor
clients []client
activeClient *client
lastWinAddr string
)

// Flags
Expand Down Expand Up @@ -627,12 +628,17 @@ func main() {
fmt.Println("Error reading from socket2:", err)
}

if strings.Contains(string(buf[:n]), "activewindowv2") {
err = listClients()
if err != nil {
log.Fatalf("Couldn't list clients: %s", err)
} else {
refreshMainBox(true)
s := string(buf[:n])
if strings.Contains(s, "activewindowv2") {
winAddr := strings.TrimSpace(strings.Split(s, "activewindowv2>>")[1])
if winAddr != lastWinAddr && !strings.Contains(winAddr, ">>") {
err = listClients()
if err != nil {
log.Fatalf("Couldn't list clients: %s", err)
} else {
refreshMainBox(true)
}
lastWinAddr = winAddr
}
}
}
Expand Down

0 comments on commit ec0696b

Please sign in to comment.