diff --git a/.goreleaser.yml b/.goreleaser.yml index 82e71df..6def7d9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,6 @@ builds: - id: "sway-yasm" - main: "./cmd/sway-yasm/main.go" + main: "./cmd/sway-yasm/" binary: "sway-yasm" goos: - linux diff --git a/README.md b/README.md index 844b752..bcc33a9 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ It tries to deliver all these features in one command, without any configuration Install using one of the following ways: - binary from [the releases page](https://github.com/pancsta/sway-yasm/releases/latest) -- `go install github.com/pancsta/sway-yasm@latest` -- `git clone; cd; go mod tidy; ./scripts/build` +- `go install github.com/pancsta/sway-yasm/cmd/sway-yasm@latest` +- `git clone; cd; ./scripts/build` ## features @@ -159,13 +159,13 @@ Switcher mode: Example - switch to the 3rd MRU window: -- `alt+tab` +- `alt+tab` (release) - `tab` - `space` Example - switch to Krusader by name: -- `alt+tab` +- `alt+tab` (release) - `k`, `r`, `u` - `enter` diff --git a/cmd/sway-yasm/main.go b/cmd/sway-yasm/sway_yasm.go similarity index 85% rename from cmd/sway-yasm/main.go rename to cmd/sway-yasm/sway_yasm.go index 6c15c2e..605fba0 100644 --- a/cmd/sway-yasm/main.go +++ b/cmd/sway-yasm/sway_yasm.go @@ -10,12 +10,13 @@ import ( func main() { // TODO --status (PID, config, windows count) - if os.Getenv("YASM_LOG") == "" { - log.SetOutput(io.Discard) - } // TODO slog logger := log.New(os.Stdout, "", 0) + if os.Getenv("YASM_LOG") == "" { + logger.SetOutput(io.Discard) + } + // start the root command err := cmds.GetRootCmd(logger).Execute() if err != nil { logger.Fatal("cobra error:", err) diff --git a/go.mod b/go.mod index a22e0c9..edce7c3 100644 --- a/go.mod +++ b/go.mod @@ -2,14 +2,11 @@ module github.com/pancsta/sway-yasm go 1.22.3 -// TODO PR -replace github.com/Difrex/gosway/ipc => github.com/pancsta/gosway/ipc v0.0.0-20240714161203-b47bb358f535 - require ( - github.com/Difrex/gosway/ipc v0.0.0-20240312143858-20214f4c38d6 github.com/fsnotify/fsnotify v1.7.0 github.com/lithammer/dedent v1.1.0 github.com/pancsta/asyncmachine-go v0.6.1 + github.com/pancsta/gosway/ipc v0.0.0-20240905082428-317fdc2bcf9c github.com/samber/lo v1.39.0 github.com/spf13/cobra v1.8.0 ) diff --git a/go.sum b/go.sum index 81b837e..10a26bd 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,8 @@ github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffkt github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/pancsta/asyncmachine-go v0.6.1 h1:WEOKXV+qYAM1tVESt3dnHyyPmrrVI02iIqOdSkrcP1c= github.com/pancsta/asyncmachine-go v0.6.1/go.mod h1:hoG7VB315eqgnRvVfZQQcw7B7CrJMkwqNNHH8N+7CGs= -github.com/pancsta/gosway/ipc v0.0.0-20240714161203-b47bb358f535 h1:lzXo+KaitWLZhckXizQ5Lkl5dOZ+ENeO0mWWfeYikN4= -github.com/pancsta/gosway/ipc v0.0.0-20240714161203-b47bb358f535/go.mod h1:hZTd2MPJSe6oi3O8arSxP2WEoIuHLgct4v0t1ssBtTU= +github.com/pancsta/gosway/ipc v0.0.0-20240905082428-317fdc2bcf9c h1:2B9GDAHUtpW+DhDsWPzCpUx7pdSp9EgGxGyCcoyGGyU= +github.com/pancsta/gosway/ipc v0.0.0-20240905082428-317fdc2bcf9c/go.mod h1:lcI50E2ufUPm3w+deWAyUkamTvxX7q9IFd0E9fhErZA= 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/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 287bee4..b7f57ca 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -12,12 +12,12 @@ import ( "strings" "time" + "github.com/pancsta/gosway/ipc" + "github.com/samber/lo" + "github.com/pancsta/sway-yasm/internal/types" "github.com/pancsta/sway-yasm/internal/watcher" - - "github.com/Difrex/gosway/ipc" usrCmds "github.com/pancsta/sway-yasm/pkg/usr-cmds" - "github.com/samber/lo" ) // CONFIG TODO file @@ -148,7 +148,7 @@ func (d *Daemon) Start() { case err := <-s.Errors: // TODO reconnect / backoff log.Println("Error:", err) - break + os.Exit(1) } } } diff --git a/internal/types/types.go b/internal/types/types.go index e0952f7..3438fff 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -1,6 +1,6 @@ package types -import "github.com/Difrex/gosway/ipc" +import "github.com/pancsta/gosway/ipc" type WindowData struct { ID int diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index 8fd0a81..2aea66c 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -239,6 +239,7 @@ func (w *PathWatcher) RefreshingState(e *am.Event) { return // expired } + // TODO returns deleted files on delete event executables, err := listExecutables(dir) if err != nil { e.Machine.AddErr(err) diff --git a/pkg/usr-cmds/api.go b/pkg/usr-cmds/api.go index e6ebb1a..79a54be 100644 --- a/pkg/usr-cmds/api.go +++ b/pkg/usr-cmds/api.go @@ -1,9 +1,10 @@ package usrCmds import ( - "github.com/Difrex/gosway/ipc" - "github.com/pancsta/sway-yasm/internal/types" "log" + + "github.com/pancsta/gosway/ipc" + "github.com/pancsta/sway-yasm/internal/types" ) type DaemonAPI interface { diff --git a/scripts/build.sh b/scripts/build.sh index 039f452..8157f06 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,3 +1,4 @@ #!/usr/bin/env sh -go build -o sway-yasm cmd/sway-yasm/main.go +go mod tidy +go build -o sway-yasm ./cmd/sway-yasm