Compare commits
No commits in common. "master" and "v0.0.0" have entirely different histories.
|
@ -5,4 +5,3 @@ go.sum
|
||||||
files/
|
files/
|
||||||
|
|
||||||
xstartplacement
|
xstartplacement
|
||||||
devilspie/devilspie2
|
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -6,7 +6,6 @@ BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
build:
|
build:
|
||||||
GO111MODULE=off go build \
|
GO111MODULE=off go build \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
./xstartplacement
|
|
||||||
|
|
||||||
verbose:
|
verbose:
|
||||||
GO111MODULE=off go build -v -x \
|
GO111MODULE=off go build -v -x \
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
PKGINC = $(shell pkg-config --cflags --libs glib-2.0 libwnck-3.0 lua5.1)
|
|
||||||
|
|
||||||
all: build run
|
|
||||||
# gcc *.c -o test
|
|
||||||
|
|
||||||
run:
|
|
||||||
# lists out windows found?
|
|
||||||
echo apt install lua-posix
|
|
||||||
./devilspie2 -l
|
|
||||||
./devilspie2 -w
|
|
||||||
./devilspie2 -d -e -f lua
|
|
||||||
|
|
||||||
build:
|
|
||||||
reset
|
|
||||||
gcc *.c -o devilspie2 ${PKGINC} \
|
|
||||||
-lwnck-3 -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -llua5.1 -lX11 -lXinerama
|
|
|
@ -47,10 +47,6 @@
|
||||||
#define HAVE_GTK3
|
#define HAVE_GTK3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PACKAGE "jcarr"
|
|
||||||
#define LOCALEDIR "/tmp/jcarr"
|
|
||||||
#define DEVILSPIE2_VERSION "jwc"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -241,6 +237,7 @@ void print_list(GSList *list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
-- Support Awesome 3.5 WM
|
|
||||||
|
|
||||||
local posix = require("posix");
|
|
||||||
local os = require("os");
|
|
||||||
|
|
||||||
local awesome = "/usr/bin/awesome-client"
|
|
||||||
if not posix.stat(awesome, "type") == "file" then
|
|
||||||
awesome = nil;
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check for tiling mode
|
|
||||||
function is_tiling()
|
|
||||||
if awesome then
|
|
||||||
return true;
|
|
||||||
end
|
|
||||||
return false;
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Make window floating
|
|
||||||
-- Parameters: state - true to make window floating, else make window tiled
|
|
||||||
function set_tile_floating( state )
|
|
||||||
if not awesome then
|
|
||||||
return nil;
|
|
||||||
end
|
|
||||||
|
|
||||||
if state then state = "true" else state = "false" end
|
|
||||||
|
|
||||||
local xid = get_window_xid();
|
|
||||||
|
|
||||||
local command = "echo ";
|
|
||||||
command = command .. "'";
|
|
||||||
command = command .. " local naughty = require(\"naughty\");";
|
|
||||||
command = command .. " local awcl = require(\"awful.client\");";
|
|
||||||
command = command .. " local client = require(\"client\");";
|
|
||||||
command = command .. " for k, c in pairs( client.get() ) do";
|
|
||||||
command = command .. " if c.window == " .. xid .. " then";
|
|
||||||
command = command .. " awcl.floating.set(c, " .. state .. ");";
|
|
||||||
command = command .. " end";
|
|
||||||
command = command .. " end";
|
|
||||||
command = command .. "'";
|
|
||||||
command = command .. " | ";
|
|
||||||
command = command .. awesome;
|
|
||||||
|
|
||||||
debug_print("Awesome floating: " .. command);
|
|
||||||
return os.execute( command );
|
|
||||||
end
|
|
|
@ -1,29 +0,0 @@
|
||||||
--[[
|
|
||||||
This file is part of devilspie2
|
|
||||||
Copyright (C) 2023 Darren Salt
|
|
||||||
|
|
||||||
This is an example primarily intended for use in your own
|
|
||||||
configuration files etc. without causing licence contamination.
|
|
||||||
As such, no licence conditions are attached; it may be modified and
|
|
||||||
redistributed freely. Essentially, do what you want with it.
|
|
||||||
|
|
||||||
That said, retaining proper attribution would be appreciated.
|
|
||||||
]]
|
|
||||||
-- Optional, but probably useful. (Technical feedback would be helpful.)
|
|
||||||
set_adjust_for_decoration(true)
|
|
||||||
-- Set up some variables containing likely-to-be-referenced values
|
|
||||||
win_class = get_window_class()
|
|
||||||
win_role = get_window_role()
|
|
||||||
win_name = get_window_name()
|
|
||||||
app_name = get_application_name()
|
|
||||||
ins_name = get_class_instance_name()
|
|
||||||
if ins_name == nil then ins_name = '[nil]' end
|
|
||||||
grp_name = get_class_group_name()
|
|
||||||
if grp_name == nil then grp_name = '[nil]' end
|
|
||||||
-- Debug output ("devilspie2 -d")
|
|
||||||
decorated = get_window_is_decorated() and "yes" or "no"
|
|
||||||
debug_print("\nName: '" .. win_name .. "'\nApp: '" .. app_name .. "'\nClass: " .. win_class .. "\nRole: <" .. win_role .. ">")
|
|
||||||
debug_print ("Process: '" .. get_process_name() .. "'\nDecorated (jwc note. this is in the lua script): " .. decorated)
|
|
||||||
debug_print ("Instance: '" .. ins_name .. "' & '" .. grp_name .. "'")
|
|
||||||
|
|
||||||
-- Add your stuff here!
|
|
65
stuff.go
65
stuff.go
|
@ -3,10 +3,12 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"os/exec"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/BurntSushi/xgb"
|
"github.com/BurntSushi/xgb"
|
||||||
"github.com/BurntSushi/xgb/xproto"
|
"github.com/BurntSushi/xgb/xproto"
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -17,7 +19,6 @@ func main() {
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
/*
|
|
||||||
// Start the terminal (replace with your app)
|
// Start the terminal (replace with your app)
|
||||||
go func() {
|
go func() {
|
||||||
if err := exec.Command("mate-terminal", "--title", "Workspace1-Terminal").Start(); err != nil {
|
if err := exec.Command("mate-terminal", "--title", "Workspace1-Terminal").Start(); err != nil {
|
||||||
|
@ -27,7 +28,6 @@ func main() {
|
||||||
|
|
||||||
// Wait for the window to appear
|
// Wait for the window to appear
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
*/
|
|
||||||
|
|
||||||
// Get the root window
|
// Get the root window
|
||||||
setup := xproto.Setup(conn)
|
setup := xproto.Setup(conn)
|
||||||
|
@ -43,67 +43,14 @@ func main() {
|
||||||
// Find the window with the specified title
|
// Find the window with the specified title
|
||||||
var target xproto.Window
|
var target xproto.Window
|
||||||
for _, child := range reply.Children {
|
for _, child := range reply.Children {
|
||||||
// fmt.Printf("child: %+v\n", child)
|
nameReply, err := xproto.GetProperty(conn, false, child,
|
||||||
/*
|
xproto.AtomWmName, xproto.AtomString, 0, (1<<32)-1).Reply()
|
||||||
// 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 {
|
if err != nil || len(nameReply.Value) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
name := string(nameReply.Value)
|
name := string(nameReply.Value)
|
||||||
|
log.Info("found name:", name)
|
||||||
if name == "Workspace1-Terminal" {
|
if name == "Workspace1-Terminal" {
|
||||||
target = child
|
target = child
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue