swaystick/README.md
2024-09-17 17:57:12 +12:00

41 lines
1.8 KiB
Markdown

## swaystick
swaystick reads input from a DualSense controller and binds its
buttons to actions in the Sway window manager.
Could possibly work with previous DualShock models and perhaps even
other gamepads. I've only tested it with a regular DualSense pad.
Uses the limited [Linux joystick API][1]. Based on Jason White's
[joystick demo][2].
### usage
Compile with `cc -o swaystick swaystick.c`, and start it up with
`./swaystick`. With one joystick/controller plugged in it should work
fine but if it doesn't or if the wrong keys are being picked up,
specify a custom joystick device with `./swaystick /dev/input/jsX`.
### binds
Reference ["DualSense wireless controller part names"][3] for the
names of any buttons listed here.
| Button | Action |
|:-----------|:--------------------------------------------------|
| Left stick | Move focused window |
| Cross | Kill focused window |
| Circle | Toggle between tiled windows and floating windows |
| Triangle | Teleport focused window to cursor |
| Square | Toggle whether the focused window is floating |
| L1 | Switch to previous workspace |
| R1 | Switch to next workspace |
| L2 | Focus previous window |
| R2 | Focus next window |
| Create | Collapse all windows |
| Options | Expand all windows |
| PS | Spawn an Emacs window (customizable) |
[1]: https://www.kernel.org/doc/html/latest/input/joydev/joystick-api.html
[2]: https://gist.github.com/jasonwhite/c5b2048c15993d285130
[3]: https://controller.dl.playstation.net/controller/lang/en/2100002.html