summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-24 09:46:07 -0600
committerJeff Carr <[email protected]>2024-11-24 09:46:07 -0600
commit71909226e19e003b64190ac97267a04dfc04185a (patch)
tree04b51137a4ed8fa5d45e75abb324a030b369287c
parentcfd6fdadd756edccd0115563d759e37306b57e9c (diff)
messing around
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile1
-rw-r--r--stuff.go81
2 files changed, 68 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 059bc3e..3a70645 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ BUILDTIME = $(shell date +%Y.%m.%d)
build:
GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
+ ./xstartplacement
verbose:
GO111MODULE=off go build -v -x \
diff --git a/stuff.go b/stuff.go
index d3e5deb..b4886db 100644
--- a/stuff.go
+++ b/stuff.go
@@ -3,12 +3,10 @@ package main
import (
"fmt"
"os"
- "os/exec"
- "time"
+ "reflect"
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
- "go.wit.com/log"
)
func main() {
@@ -19,15 +17,17 @@ func main() {
}
defer conn.Close()
- // Start the terminal (replace with your app)
- go func() {
- if err := exec.Command("mate-terminal", "--title", "Workspace1-Terminal").Start(); err != nil {
- fmt.Println("Error starting terminal:", err)
- }
- }()
+ /*
+ // Start the terminal (replace with your app)
+ go func() {
+ if err := exec.Command("mate-terminal", "--title", "Workspace1-Terminal").Start(); err != nil {
+ fmt.Println("Error starting terminal:", err)
+ }
+ }()
- // Wait for the window to appear
- time.Sleep(2 * time.Second)
+ // Wait for the window to appear
+ time.Sleep(2 * time.Second)
+ */
// Get the root window
setup := xproto.Setup(conn)
@@ -43,14 +43,67 @@ func main() {
// Find the window with the specified title
var target xproto.Window
for _, child := range reply.Children {
- nameReply, err := xproto.GetProperty(conn, false, child,
- xproto.AtomWmName, xproto.AtomString, 0, (1<<32)-1).Reply()
+ // fmt.Printf("child: %+v\n", child)
+ /*
+ // Get the atom for _NET_WM_NAME
+ atomReply, err := xproto.InternAtom(conn, true, uint16(len("_NET_WM_NAME")), "_NET_WM_NAME").Reply()
+ if err != nil {
+ log.Fatalf("Failed to intern atom _NET_WM_NAME: %v", err)
+ }
+ netWmNameAtom := atomReply.Atom // Correct field to use
+ */
+
+ /*
+ // Get the property for _NET_WM_NAME
+ nameReply, err := xproto.GetProperty(conn, false, child, netWmNameAtom, xproto.AtomString, 0, (1<<32)-1).Reply()
+ if err != nil {
+ log.Printf("Failed to get property _NET_WM_NAME: %v", err)
+ } else if len(nameReply.Value) > 0 {
+ fmt.Printf("Window name: %s\n", string(nameReply.Value))
+ }
+ */
+
+ /*
+ // Get the atom for _NET_WM_NAME
+ atomReply, err := xproto.InternAtom(conn, true, uint16(len("_NET_WM_NAME")), "_NET_WM_NAME").Reply()
+ if err != nil {
+ log.Fatalf("Failed to intern atom _NET_WM_NAME: %v", err)
+ } else {
+ fmt.Printf("found atomic name: %s\n", string(atomReply.Value))
+ }
+ netWmNameAtom := atomReply.Atom
+ */
+
+ /*
+ // Get the property for _NET_WM_NAME
+ nameReply, err := xproto.GetProperty(conn, false, child, netWmNameAtom, xproto.AtomString, 0, (1<<32)-1).Reply()
+ if err != nil {
+ log.Printf("Failed to get property _NET_WM_NAME: %v", err)
+ } else if len(nameReply.Value) > 0 {
+ fmt.Printf("Window name: %s\n", string(nameReply.Value))
+ }
+ */
+
+ var test xproto.Drawable
+ geomReply, err := xproto.GetGeometry(conn, test).Reply()
+ if err != nil {
+ // fmt.Printf("err: %+v\n", err)
+ // fmt.Printf("child geomReply: %+v\n", geomReply)
+ } else {
+ fmt.Printf("child geomReply: %+v\n", geomReply)
+ }
+
+ nameReply, err := xproto.GetProperty(conn, false, child, xproto.AtomWmName, xproto.AtomString, 0, (1<<32)-1).Reply()
+ if err != nil {
+ // fmt.Printf("child err: %+v\n", err)
+ } else {
+ fmt.Printf("child %+v nameReply: %+v %s\n", reflect.TypeOf(child), nameReply, string(nameReply.Value))
+ }
if err != nil || len(nameReply.Value) == 0 {
continue
}
name := string(nameReply.Value)
- log.Info("found name:", name)
if name == "Workspace1-Terminal" {
target = child
break