Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pancsta committed Jun 3, 2024
1 parent 71fd645 commit 1fa9d82
Show file tree
Hide file tree
Showing 18 changed files with 1,448 additions and 245 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: goreleaser

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
builds:
- id: "sway-yast"
main: "./main.go"
binary: "sway-yast"
goos:
- linux
goarch:
- 386
- amd64
- arm64
goarm:
- 7
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## v0.1.0
- mouse follows focus
- pick space
- pick win
- run path
- live config changes

## v0.0.1
- initial release
179 changes: 151 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,84 @@
# sway-yast

**Y**et **A**nother **S**way **T**ab is a single-binary alt+tab clone (Most Recently Used) window switcher for [Sway WM](https://github.com/swaywm/sway).

![Dark mode](./assets/dark.png)
![Light mode](./assets/light.png)

## Features

1. Daemon (IPC & RPC) architecture, filesystem-free
2. Uses `fzf`, works in the terminal
3. Renders a popup using `foot` (optional)
4. Dark mode support (optional)<br />
Checks `gsettings get org.gnome.desktop.interface color-scheme`
5. Shows workspaces and outputs (especially headless)
6. 1-hand compatible keystrokes

## Usage

1. Install<br />
`go install github.com/pancsta/sway-yast@latest`
Sway **Y**et **A**nother **S**way **T**ab is a text-based window switcher which mimics alt+tab behavior (Most Recently Used order)
for [Sway WM](https://github.com/swaywm/sway).


| Dark Mode | Light Mode |
|------------------------------------------|------------------------------------------|
| ![Dark mode](./assets/dark.png) | ![Light mode](./assets/light.png) |

```text
$ sway-yast --help
Usage:
sway-yast [flags]
sway-yast [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
config Change the config of a running daemon process
daemon Start tracking focus in sway
fzf Run fzf with a list of windows
fzf-path Run fzf with a list of executable files from PATH
fzf-pick-space Run fzf with a list of workspaces to pick
fzf-pick-win Run fzf with a list of windows to pick
help Help about any command
mru-list Print a list of MRU window IDs
path Show the +x files from PATH using foot
pick-space Show the workspace picker using foot
pick-win Show the window picker using foot
switcher Show the switcher window using foot
Flags:
-h, --help help for sway-yast
--version Print version and exit
Use "sway-yast [command] --help" for more information about a command.
```

```text
$ sway-yast daemon --help
Start tracking focus in sway
Usage:
sway-yast daemon [flags]
Flags:
--autoconfig Automatic configuration of layout (default true)
--default-keybindings Add default keybindings
-h, --help help for daemon
--mouse-follows-focus Calls 'input ... map_to_output OUTPUT' on each focus
```

## features

- daemon (IPC & RPC) architecture, filesystem-free
- uses `fzf` so it works in the terminal
- renders a floating popup using `foot` (optional)
- dark mode support (optional)<br />
checks `gsettings get org.gnome.desktop.interface color-scheme`
- 1-hand keystrokes
- [mouse follows focus](#mouse-follows-focus) mode (optional)
- additional features (popups)
- move a workspace to the current output
- move a window to the current workspace
- run anything in your `PATH`
- general MRU watcher via `mru-list`

## usage

1. Install using one of<br />
- Binary from [the releases page](https://github.com/pancsta/sway-yast/releases/latest)
- `go install github.com/pancsta/sway-yast@latest`
- `git clone && go mod tidy && go build`
2. Start the daemon<br />
`sway-yast daemon`
3. Add a binding (optional)<br />
`swaymsg bindsym alt+tab exec sway-yast switcher`
4. Run in the terminal (optional)<br />
`sway-yast daemon --default-keystrokes`
3. Use directly in the terminal (optional)<br />
`sway-yast fzf`
5. Press `alt+tab`
4. Press `alt+tab`

## Key bindings
## keystrokes

Normal mode:

Expand Down Expand Up @@ -57,11 +108,83 @@ Example - switch to Krusader by name:
- `k`, `r`, `u`
- `enter`

## Configuration
### default keystrokes

Various ways to get the default keybindings.

```bash
$ sway-yast daemon --default-keybindings
```

```bash
# shell
swaymsg bindsym alt+tab exec sway-yast switcher
swaymsg bindsym mod4+o exec sway-yast pick-space
swaymsg bindsym mod4+p exec sway-yast pick-win
swaymsg bindsym mod4+d exec sway-yast path
```

```text
# config
bindsym alt+tab exec sway-yast switcher
bindsym $mod+o exec sway-yast pick-space
bindsym $mod+p exec sway-yast pick-win
bindsym $mod+d exec sway-yast path
```

## mouse follows focus

```bash
$ sway-yast daemon --mouse-follows-focus
```

Using `input map_to_output`, traps the relative cursor inside the currently focused output. Changing focus moves the cursor between outputs (thus the name). Useful for VNC screens on separate machines. When combined with [waycorner](https://github.com/AndreasBackx/waycorner), it creates a synergy-like effect.

### waycorner config example

```toml
# HEADLESS-1 (right screen)
[pro5-left]
enter_command = [ "sway-pointer-output", "2" ]
locations = ["left"]
[pro5-left.output]
description = ".*output 1.*"

# HEADLESS-2 (left screen)
[mini6-right]
enter_command = [ "sway-pointer-output", "1" ]
locations = ["right"]
[mini6-right.output]
description = ".*output 2.*"
```

## configuration

See the [top config section in main.go](main.go), modify and `go build`.

## additional features (popups)

### move a workspace to the current output

![move workspace](assets/move-workspace.png)

### move a window to the current workspace

![move window](assets/move-window.png)

### run anything in your `PATH`

![path runner](assets/path-runner.png)

## troubleshooting

`env YAST_LOG=1 sway-yast`

## changelog

See the [config section in main.go](main.go), modify and `go build`.
See [CHANGELOG.md](CHANGELOG.md).

## Kudos
## kudos

- [applist.py](https://github.com/davxy/dotfiles/blob/main/_old/sway/applist.py)
- [sway-fzfify](https://github.com/ldelossa/sway-fzfify)
Expand Down
Binary file modified assets/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/grafana-dashboard-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/grafana-dashboard-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/move-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/move-workspace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/path-runner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1fa9d82

Please sign in to comment.