Skip to content

Commit

Permalink
Add add-ons and contributing sections
Browse files Browse the repository at this point in the history
  • Loading branch information
mogenson authored Apr 26, 2024
1 parent 679d29e commit 85968fa
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,47 @@ screens.
Arrange screens vertically to prevent windows from bleeding into other screens.

<img width="780" alt="Screen Shot 2022-01-07 at 14 18 27" src="https://user-images.githubusercontent.com/900731/148595785-546f9086-9add-4731-8477-233b202378f4.png">

## Add-ons

The following Spoons compliment PaperWM.spoon nicely.

- [ActiveSpace.spoon](https://github.com/mogenson/ActiveSpace.Spoon) Show active and layout of Mission Control spaces in the menu bar.
- [Swipe.spoon](https://github.com/mogenson/Swipe.spoon) Perform actions when trackpad swipe gestures are recognized. Here's an example config to change PaperWM.spoon focused window:
```lua
-- focus adjacent window with 3 finger swipe
local current_id, threshold
Swipe = hs.loadSpoon("Swipe")
Swipe:start(3, function(direction, distance, id)
if id == current_id then
if distance > threshold then
threshold = math.huge -- trigger once per swipe

-- use "natural" scrolling
if direction == "left" then
PaperWM.actions.focus_right()
elseif direction == "right" then
PaperWM.actions.focus_left()
elseif direction == "up" then
PaperWM.actions.focus_down()
elseif direction == "down" then
PaperWM.actions.focus_up()
end
end
else
current_id = id
threshold = 0.2 -- swipe distance > 20% of trackpad size
end
end)
```

## Contributing

Contributions are welcome! Here are a few preferences:
- Global variables are `CamelCase` (eg. `PaperWM`)
- Local variables are `snake_case` (eg. `local focused_window`)
- Function names are `lowerCamelCase` (eg. `function windowEventHandler()`)
- Use `<const>` where possible
- Create a local copy when deeply nested members are used often (eg. `local Watcher <const> = hs.uielement.watcher`)

Code format checking and linting is provided by [lua-language-server](https://github.com/LuaLS/lua-language-server) for commits and pull requests. Run `lua-language-server --check=init.lua` locally before commiting.

0 comments on commit 85968fa

Please sign in to comment.