kopia lustrzana https://github.com/abourget/shuttle-go
Avoid crashing when failing to get window properties.
rodzic
f3f92b561c
commit
c983d6bcd0
2
go.mod
2
go.mod
|
@ -4,7 +4,9 @@ go 1.13
|
|||
|
||||
require (
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/gvalkov/golang-evdev v0.0.0-20160925111049-87c03aa1a370
|
||||
github.com/hypebeast/go-osc v0.0.0-20200115085105-85fee7fed692
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.1.5-0.20161217200445-2402e8e7a02f
|
||||
)
|
||||
|
|
5
go.sum
5
go.sum
|
@ -1,7 +1,12 @@
|
|||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gvalkov/golang-evdev v0.0.0-20160925111049-87c03aa1a370 h1:jsJ5OH/7qrOnuYEdE5WtvJTGk3ssEefhL4Z970XkcfU=
|
||||
github.com/gvalkov/golang-evdev v0.0.0-20160925111049-87c03aa1a370/go.mod h1:SAzVFKCRezozJTGavF3GX8MBUruETCqzivVLYiywouA=
|
||||
github.com/hypebeast/go-osc v0.0.0-20200115085105-85fee7fed692 h1:a5rmrg0wd6LLuRQGk9lopHHgzyjM8DjH0Ek0iHki5Lc=
|
||||
github.com/hypebeast/go-osc v0.0.0-20200115085105-85fee7fed692/go.mod h1:VCiuhv+/+jPFqHeZAgVC61Cr4drPso5XEEKmEiqCsuU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.1.5-0.20161217200445-2402e8e7a02f h1:xvdAWoe6QxPIuElLfcPOsI/M/Shgaq0LGavn/8vcXro=
|
||||
github.com/stretchr/testify v1.1.5-0.20161217200445-2402e8e7a02f/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
|
|
7
watch.go
7
watch.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/xgb"
|
||||
|
@ -72,14 +71,16 @@ func (w *watcher) watch() {
|
|||
reply, err := xproto.GetProperty(w.conn, false, w.root, w.activeAtom,
|
||||
xproto.GetPropertyTypeAny, 0, (1<<32)-1).Reply()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Println("watch windows, failed to get window properties:", err)
|
||||
return
|
||||
}
|
||||
windowID := xproto.Window(xgb.Get32(reply.Value))
|
||||
|
||||
reply, err = xproto.GetProperty(w.conn, false, windowID, w.nameAtom,
|
||||
xproto.GetPropertyTypeAny, 0, (1<<32)-1).Reply()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Println("watch windows, re-failed to get window properties:", err)
|
||||
return
|
||||
}
|
||||
|
||||
w.lastWindowID = windowID
|
||||
|
|
Ładowanie…
Reference in New Issue