mirror of
https://codeberg.org/scip/swayipc.git
synced 2025-12-17 12:31:05 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7079004e63 |
47
.github/workflows/ci.yaml
vendored
Normal file
47
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: build-and-test
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
version: ['1.22']
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
name: Build
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '${{ matrix.version }}'
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: go build
|
||||||
|
|
||||||
|
# - name: test
|
||||||
|
# run: make test
|
||||||
|
|
||||||
|
# - name: Update coverage report
|
||||||
|
# uses: ncruces/go-coverage-report@main
|
||||||
|
# with:
|
||||||
|
# report: true
|
||||||
|
# chart: true
|
||||||
|
# amend: true
|
||||||
|
# if: |
|
||||||
|
# matrix.os == 'ubuntu-latest' &&
|
||||||
|
# github.event_name == 'push'
|
||||||
|
# continue-on-error: true
|
||||||
|
|
||||||
|
golangci:
|
||||||
|
name: lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.22
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
matrix:
|
|
||||||
platform:
|
|
||||||
- linux/amd64
|
|
||||||
goversion:
|
|
||||||
- 1.24
|
|
||||||
|
|
||||||
labels:
|
|
||||||
platform: ${platform}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
build:
|
|
||||||
when:
|
|
||||||
event: [push]
|
|
||||||
image: golang:${goversion}
|
|
||||||
commands:
|
|
||||||
- go get
|
|
||||||
- go build
|
|
||||||
|
|
||||||
linter:
|
|
||||||
when:
|
|
||||||
event: [push]
|
|
||||||
image: golang:${goversion}
|
|
||||||
commands:
|
|
||||||
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0
|
|
||||||
- golangci-lint --version
|
|
||||||
- golangci-lint run ./...
|
|
||||||
depends_on: [build]
|
|
||||||
29
README.md
29
README.md
@@ -1,7 +1,14 @@
|
|||||||
[](https://ci.codeberg.org/repos/15565)
|
[](https://goreportcard.com/report/github.com/tlinden/swayipc)
|
||||||
[](https://goreportcard.com/report/codeberg.org/scip/swayipc)
|
[](https://github.com/tlinden/swayipc/actions)
|
||||||
[](https://codeberg.org/scip/swayipc/raw/branch/main/LICENSE)
|

|
||||||
[](https://godoc.org/codeberg.org/scip/swayipc)
|
[](https://godoc.org/github.com/tlinden/swayipc)
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> This software is now being maintained on [Codeberg](https://codeberg.org/scip/swaycycle/).
|
||||||
|
>
|
||||||
|
> You may still use the `github.com/tlinden/swayipc` module, but this
|
||||||
|
> version here is no longer being maintained. To use the current version,
|
||||||
|
> import `codeberg.org/scip/swayipc/v1`.
|
||||||
|
|
||||||
# swayipc - go bindings to control sway and swayfx
|
# swayipc - go bindings to control sway and swayfx
|
||||||
|
|
||||||
@@ -26,7 +33,7 @@ haven't tested it on i3wm.
|
|||||||
The module uses the i3-IPC proctocol as outlined in sway-ipc(7).
|
The module uses the i3-IPC proctocol as outlined in sway-ipc(7).
|
||||||
|
|
||||||
For details on how to use the library, see the
|
For details on how to use the library, see the
|
||||||
[reference documentation](https://godoc.org/codeberg.org/scip/swayipc).
|
[reference documentation](https://godoc.org/github.com/tlinden/swayipc).
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
@@ -39,7 +46,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"codeberg.org/scip/swayipc/v2"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -69,17 +76,17 @@ func main() {
|
|||||||
Also take a look into the **_examples** folder for more examples.
|
Also take a look into the **_examples** folder for more examples.
|
||||||
|
|
||||||
For a more comprehensive and practical example look at the
|
For a more comprehensive and practical example look at the
|
||||||
[descratch](https://codeberg.org/scip/sway-descratch) program which
|
[descratch](https://github.com/TLINDEN/sway-descratch) program which
|
||||||
you can use to selectively retrieve a window from the scratchpad.
|
you can use to selectively retrieve a window from the scratchpad.
|
||||||
|
|
||||||
You may also take a look at the [tool swaycycle](https://codeberg.org/scip/swaycycle)
|
You may also take a look at the [tool swaycycle](https://github.com/tlinden/swaycycle)
|
||||||
which is using this module.
|
which is using this module.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Execute this to add the module to your project:
|
Execute this to add the module to your project:
|
||||||
```sh
|
```sh
|
||||||
go get codeberg.org/scip/swayipc/v2
|
go get github.com/tlinden/swayipc
|
||||||
```
|
```
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
@@ -95,7 +102,7 @@ best way for me to forget to do something.
|
|||||||
|
|
||||||
In order to report a bug, unexpected behavior, feature requests or to
|
In order to report a bug, unexpected behavior, feature requests or to
|
||||||
submit a patch, please open an issue on github:
|
submit a patch, please open an issue on github:
|
||||||
https://codeberg.org/scip/swayipc/issues.
|
https://github.com/TLINDEN/swayipc/issues.
|
||||||
|
|
||||||
## Copyright and license
|
## Copyright and license
|
||||||
|
|
||||||
@@ -107,7 +114,7 @@ T.v.Dein <tom AT vondein DOT org>
|
|||||||
|
|
||||||
## Project homepage
|
## Project homepage
|
||||||
|
|
||||||
https://codeberg.org/scip/swayipc
|
https://github.com/TLINDEN/swayipc
|
||||||
|
|
||||||
## Copyright and License
|
## Copyright and License
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Event callback function, needs to implement each subscribed events,
|
// Event callback function, needs to implement each subscribed events,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/alecthomas/repr"
|
"github.com/alecthomas/repr"
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"codeberg.org/scip/swayipc/v1"
|
"github.com/tlinden/swayipc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module codeberg.org/scip/swayipc/v2
|
module github.com/tlinden/swayipc
|
||||||
|
|
||||||
go 1.23
|
go 1.23
|
||||||
|
|
||||||
|
|||||||
4
net.go
4
net.go
@@ -34,8 +34,8 @@ func (ipc *SwayIPC) Connect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the socket.
|
// Close the socket.
|
||||||
func (ipc *SwayIPC) Close() error {
|
func (ipc *SwayIPC) Close() {
|
||||||
return ipc.socket.Close()
|
ipc.socket.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ipc *SwayIPC) sendHeader(messageType uint32, len uint32) error {
|
func (ipc *SwayIPC) sendHeader(messageType uint32, len uint32) error {
|
||||||
|
|||||||
2
node.go
2
node.go
@@ -11,11 +11,9 @@ type Node struct {
|
|||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Type string `json:"type"` // output, workspace or container
|
Type string `json:"type"` // output, workspace or container
|
||||||
Name string `json:"name"` // workspace number or app name
|
Name string `json:"name"` // workspace number or app name
|
||||||
Output string `json:"output"`
|
|
||||||
Nodes []*Node `json:"nodes"`
|
Nodes []*Node `json:"nodes"`
|
||||||
FloatingNodes []*Node `json:"floating_nodes"`
|
FloatingNodes []*Node `json:"floating_nodes"`
|
||||||
Focused bool `json:"focused"`
|
Focused bool `json:"focused"`
|
||||||
Visible bool `json:"visible"`
|
|
||||||
Urgent bool `json:"urgent"`
|
Urgent bool `json:"urgent"`
|
||||||
Sticky bool `json:"sticky"`
|
Sticky bool `json:"sticky"`
|
||||||
Border string `json:"border"`
|
Border string `json:"border"`
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VERSION = "v1.0.0"
|
VERSION = "v0.3.0"
|
||||||
|
|
||||||
IPC_HEADER_SIZE = 14
|
IPC_HEADER_SIZE = 14
|
||||||
IPC_MAGIC = "i3-ipc"
|
IPC_MAGIC = "i3-ipc"
|
||||||
|
|||||||
Reference in New Issue
Block a user