implemented more stuff along with samples

This commit is contained in:
2025-08-14 22:59:38 +02:00
parent a09b04ab7a
commit f5b0ee026f
26 changed files with 2768 additions and 12 deletions

View File

@@ -0,0 +1,40 @@
package main
/*
Retrieve a list of running bars
*/
import (
"fmt"
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
bars, err := ipc.GetBars()
if err != nil {
log.Fatal(err)
}
fmt.Println("Current bars:")
repr.Println(bars)
if len(bars) > 0 {
fmt.Println("First bar:")
bar, err := ipc.GetBar(bars[0])
if err != nil {
log.Fatal(err)
}
repr.Println(bar)
}
}

View File

@@ -0,0 +1,28 @@
package main
/*
Retrieve the user config
*/
import (
"fmt"
"log"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
config, err := ipc.GetConfig()
if err != nil {
log.Fatal(err)
}
fmt.Println(config)
}

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

View File

@@ -0,0 +1,28 @@
package main
/*
Retrieve a list of current set marks
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
marks, err := ipc.GetMarks()
if err != nil {
log.Fatal(err)
}
repr.Println(marks)
}

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

124
_examples/get_outputs/log Normal file
View File

@@ -0,0 +1,124 @@
execve("/opt/bin/swaymsg", ["swaymsg", "-t", "get_bar_config", "bar-0"], 0x7ffca8a3d4b0 /* 96 vars */) = 0
brk(NULL) = 0x57744ffbd000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x70933d94d000
access("/etc/ld.so.preload", R_OK) = 0
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3) = 0
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v3/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/", 0x7fffe6d741a0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/", 0x7fffe6d741a0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=137987, ...}) = 0
mmap(NULL, 137987, PROT_READ, MAP_PRIVATE, 3, 0) = 0x70933d92b000
close(3) = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=80344, ...}) = 0
mmap(NULL, 82416, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x70933d916000
mmap(0x70933d91a000, 45056, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x70933d91a000
mmap(0x70933d925000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x70933d925000
mmap(0x70933d929000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x70933d929000
close(3) = 0
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\247\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 840, 64) = 840
fstat(3, {st_mode=S_IFREG|0755, st_size=2178688, ...}) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 840, 64) = 840
mmap(NULL, 2223736, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x70933d600000
mmap(0x70933d628000, 1658880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x70933d628000
mmap(0x70933d7bd000, 323584, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x70933d7bd000
mmap(0x70933d80c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20b000) = 0x70933d80c000
mmap(0x70933d812000, 52856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x70933d812000
close(3) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x70933d913000
arch_prctl(ARCH_SET_FS, 0x70933d913740) = 0
set_tid_address(0x70933d913a10) = 97421
set_robust_list(0x70933d913a20, 24) = 0
rseq(0x70933d913680, 0x20, 0, 0x53053053) = 0
mprotect(0x70933d80c000, 16384, PROT_READ) = 0
mprotect(0x70933d929000, 4096, PROT_READ) = 0
mprotect(0x577441241000, 4096, PROT_READ) = 0
mprotect(0x70933d98f000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x70933d92b000, 137987) = 0
ioctl(1, TCGETS, 0x7fffe6d74e80) = -1 ENOTTY (Inappropriate ioctl for device)
getrandom("\xf3\xb2\x5f\xb5\x3a\x0e\x13\x06", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x57744ffbd000
brk(0x57744ffde000) = 0x57744ffde000
socket(AF_UNIX, SOCK_STREAM, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/sway-ipc.1000.3461.sock"}, 110) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO_OLD, "\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
write(3, "i3-ipc\5\0\0\0\6\0\0\0", 14) = 14
write(3, "bar-0", 5) = 5
recvfrom(3, "i3-ipc\332\4\0\0\6\0\0\0", 14, 0, NULL, NULL) = 14
recvfrom(3, "{ \"id\": \"bar-0\", \"mode\": \"dock\","..., 1242, 0, NULL, NULL) = 1242
rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_DROPPABLE|MAP_ANONYMOUS, -1, 0) = 0x70933d94c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x70933d94b000
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
getrandom("\x92\xda\xab\x78\x81\x42\x79\x34\x6f\x90\x94\x8c\xb4\x47\xfb\x85\xc1\x00\x43\x1b\x00\x78\x10\x09\x87\x65\x09\x2e\x79\xdb\x4d\xf7", 32, 0) = 32
fstat(1, {st_mode=S_IFREG|0644, st_size=5648, ...}) = 0
close(3) = 0
write(1, "{\n \"id\": \"bar-0\",\n \"mode\": \"do"..., 1387{
"id": "bar-0",
"mode": "dock",
"hidden_state": "hide",
"position": "top",
"status_command": null,
"font": "monospace 10",
"gaps": {
"top": 0,
"right": 0,
"bottom": 0,
"left": 0
},
"bar_height": 0,
"status_padding": 1,
"status_edge_padding": 3,
"wrap_scroll": false,
"workspace_buttons": true,
"strip_workspace_numbers": false,
"strip_workspace_name": false,
"workspace_min_width": 0,
"binding_mode_indicator": true,
"verbose": false,
"pango_markup": true,
"colors": {
"background": "#000000ff",
"statusline": "#ffffffff",
"separator": "#666666ff",
"focused_background": "#000000ff",
"focused_statusline": "#ffffffff",
"focused_separator": "#666666ff",
"focused_workspace_border": "#4c7899ff",
"focused_workspace_bg": "#285577ff",
"focused_workspace_text": "#ffffffff",
"inactive_workspace_border": "#333333ff",
"inactive_workspace_bg": "#222222ff",
"inactive_workspace_text": "#888888ff",
"active_workspace_border": "#333333ff",
"active_workspace_bg": "#5f676aff",
"active_workspace_text": "#ffffffff",
"urgent_workspace_border": "#2f343aff",
"urgent_workspace_bg": "#900000ff",
"urgent_workspace_text": "#ffffffff",
"binding_mode_border": "#2f343aff",
"binding_mode_bg": "#900000ff",
"binding_mode_text": "#ffffffff"
},
"tray_padding": 2
}
) = 1387
exit_group(0) = ?
+++ exited with 0 +++

View File

@@ -0,0 +1,28 @@
package main
/*
Retrieve a list of current available outputs
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
outputs, err := ipc.GetOutputs()
if err != nil {
log.Fatal(err)
}
repr.Println(outputs)
}

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

View File

@@ -0,0 +1,28 @@
package main
/*
Retrieve the wm version
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
version, err := ipc.GetVersion()
if err != nil {
log.Fatal(err)
}
repr.Println(version)
}

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

View File

@@ -0,0 +1,28 @@
package main
/*
Retrieve a list of current available workspaces
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
workspaces, err := ipc.GetWorkspaces()
if err != nil {
log.Fatal(err)
}
repr.Println(workspaces)
}

View File

@@ -0,0 +1,346 @@
&i3ipc.Node{
Id: 1,
Type: "root",
Name: "root",
Nodes: []*i3ipc.Node{
{
Id: 2147483647,
Type: "output",
Name: "__i3",
Nodes: []*i3ipc.Node{
{
Id: 2147483646,
Type: "workspace",
Name: "__i3_scratch",
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "horizontal",
Focus: []int{
2147483646,
},
Rect: i3ipc.Rect{
Width: 3440,
},
},
{
Id: 4,
Type: "output",
Name: "HDMI-A-1",
Nodes: []*i3ipc.Node{
{
Id: 7,
Type: "workspace",
Name: "2",
Nodes: []*i3ipc.Node{
{
Id: 8,
Type: "con",
Name: "Terminal - 1:2:sh - \"tripod\" ",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.21511628,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 10,
Type: "con",
Name: "postgreslet - F-I-TS-Chat - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.78488374,
Window: 4194311,
Rect: i3ipc.Rect{
X: 740,
Y: 26,
Width: 2700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2696,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
10,
8,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 11,
Type: "workspace",
Name: "3",
Nodes: []*i3ipc.Node{
{
Id: 14,
Type: "con",
Name: "AdZ Desktop (SSL/TLS Secured, 256 bit)",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.3604651,
Window: 14680067,
Rect: i3ipc.Rect{
Y: 26,
Width: 1240,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1236,
},
Geometry: i3ipc.Rect{
Width: 2752,
},
},
{
Id: 12,
Type: "con",
Name: "E-Mail Thomas.vonDein@f-i-ts.de - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.6395349,
Window: 4194324,
Rect: i3ipc.Rect{
X: 1240,
Y: 26,
Width: 2200,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 2196,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
12,
14,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 15,
Type: "workspace",
Name: "4",
Nodes: []*i3ipc.Node{
{
Id: 16,
Type: "con",
Name: "AR System Customizable Home Page (Suchen) - Chromium",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 1,
Window: 4194338,
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
WindowRect: i3ipc.Rect{
Width: 3440,
},
Geometry: i3ipc.Rect{
Width: 1142,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
16,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 17,
Type: "workspace",
Name: "5",
Nodes: []*i3ipc.Node{
{
Id: 19,
Type: "con",
Name: "Terminal - 0:5:go - \"tripod\" ",
Focused: true,
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.50581396,
X11Window: "xfce4-terminal",
Rect: i3ipc.Rect{
Y: 26,
Width: 1740,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1736,
},
Geometry: i3ipc.Rect{
Width: 882,
},
},
{
Id: 18,
Type: "con",
Name: "emacs /home/scip/dev/i3ipc/_examples/tree/main.go",
Border: "pixel",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.49418604,
Window: 18874540,
Rect: i3ipc.Rect{
X: 1740,
Y: 26,
Width: 1700,
},
WindowRect: i3ipc.Rect{
X: 2,
Y: 2,
Width: 1696,
},
Geometry: i3ipc.Rect{
Width: 752,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
19,
18,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
{
Id: 20,
Type: "workspace",
Name: "6",
FloatingNodes: []*i3ipc.Node{
{
Id: 21,
Type: "floating_con",
Name: "Home - Webex - Google Chrome",
Border: "csd",
Layout: "none",
Orientation: "none",
CurrentBorderWidth: 2,
Percent: 0.7971424,
X11Window: "google-chrome",
Rect: i3ipc.Rect{
X: 481,
Y: 35,
Width: 2822,
},
WindowRect: i3ipc.Rect{
Width: 2822,
},
Geometry: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
21,
},
Rect: i3ipc.Rect{
Y: 26,
Width: 3440,
},
},
},
Border: "none",
Layout: "output",
Orientation: "none",
Percent: 1,
Focus: []int{
17,
7,
20,
11,
15,
},
Current_workspace: "5",
Rect: i3ipc.Rect{
Width: 3440,
},
},
},
Border: "none",
Layout: "splith",
Orientation: "horizontal",
Focus: []int{
4,
},
Rect: i3ipc.Rect{
Width: 3440,
},
}
root: root
node: __i3
focus: false
recursing
node: __i3_scratch
focus: false
recursing
nil

View File

@@ -0,0 +1,44 @@
package main
/*
This example toggles the current terminal window's floating
state. Execute repeatedly to toggle between full and floating
state. Run this from a terminal window to see the effect.
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
// retrieve the sway tree
tree, err := ipc.GetTree()
if err != nil {
log.Fatal(err)
}
// find the data for the current window
focused := tree.FindFocused()
if focused == nil {
log.Fatal("no focused window found")
}
// finally execute the given commands on it, you can use any run
// command, see sway(5)
responses, err := ipc.RunCommand(focused.Id, "floating toggle, border toggle")
if err != nil {
repr.Println(responses)
log.Fatal(err)
}
}

View File

@@ -0,0 +1,28 @@
package main
/*
This example toggles borders globally for all windows, execute
multiple time to see the toggling.
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
responses, err := ipc.RunGlobalCommand("border toggle")
if err != nil {
repr.Println(responses)
log.Fatal(err)
}
}