https://github.com/aokellermann/sway-scratch
Automatically starting named scratchpads for sway
https://github.com/aokellermann/sway-scratch
aur sway swaywm
Last synced: 5 months ago
JSON representation
Automatically starting named scratchpads for sway
- Host: GitHub
- URL: https://github.com/aokellermann/sway-scratch
- Owner: aokellermann
- License: mit
- Created: 2023-08-20T17:48:03.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-19T18:46:53.000Z (11 months ago)
- Last Synced: 2025-03-31T10:52:09.087Z (6 months ago)
- Topics: aur, sway, swaywm
- Language: Rust
- Homepage: http://sway-scratch.aokellermann.dev/
- Size: 110 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sway-scratch
Automatically starting named scratchpads for [sway](https://github.com/swaywm/sway).
## Usage
```
sway-scratch show [OPTIONS] --exec <--app-id |--class >
```Options:
- `--app-id ` the Wayland app_id of the application
- `--class ` the window_properties.class of the application (Xwayland)
- `--exec ` the command to open the scratch initially
- `--resize ` resize command to run when the scratch is shown (e.g. `set 90 ppt 90 ppt`)
- `-h`, `--help`### Examples
To toggle a python terminal:
```
sway-scratch show --app-id scratch_py --exec "kitty --class scratch_py -e python -q"
```In your `sway/config`, you would put something like the following:
```i3
set $scratchpy scratch_py
for_window [app_id=$scratchpy] move scratchpad, scratchpad show
bindsym $mod+equal sway-scratch show $scratchpy "$term --class $scratchpy -e python -q"
```As can be seen in the example above, terminal emulators such as [kitty](https://github.com/kovidgoyal/kitty) may include
an option for you to manually set the `app_id`
([--class](https://sw.kovidgoyal.net/kitty/invocation/#cmdoption-kitty-class) in this example).See [my personal dotfiles](https://github.com/aokellermann/dotfiles/blob/master/.config/sway/config)
for a few examples of various applications.`swaymsg -r -t get_tree` is a useful tool to view the `sway` tree in order to verify
identifiable information about windows.## Installation
### AUR
`sway-scratch` is available as an AUR package:
```console
yay -S sway-scratch
```### Manual
You can build the binary yourself:
```console
git clone git@github.com:aokellermann/sway-scratch.git
cd sway-scratch
cargo build --release
```and install it:
```console
cargo install --path crates/sway-scratch
```