Skip to content

Commit

Permalink
fix: add small fixes
Browse files Browse the repository at this point in the history
- go installation
- daemon exit
- build script
  • Loading branch information
pancsta committed Sep 5, 2024
1 parent ba7bf9d commit 455d751
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
builds:
- id: "sway-yasm"
main: "./cmd/sway-yasm/main.go"
main: "./cmd/sway-yasm/"
binary: "sway-yasm"
goos:
- linux
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`

Expand Down
7 changes: 4 additions & 3 deletions cmd/sway-yasm/main.go → cmd/sway-yasm/sway_yasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -148,7 +148,7 @@ func (d *Daemon) Start() {
case err := <-s.Errors:
// TODO reconnect / backoff
log.Println("Error:", err)
break
os.Exit(1)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/types/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

import "github.com/Difrex/gosway/ipc"
import "github.com/pancsta/gosway/ipc"

type WindowData struct {
ID int
Expand Down
1 change: 1 addition & 0 deletions internal/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions pkg/usr-cmds/api.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 455d751

Please sign in to comment.