2023-06-20 23:18:53 +02:00
# <div align="center">Pinnacle</div>
2023-06-20 23:16:14 +02:00
< div align = "center" >
< picture >
< source media = "(prefers-color-scheme: dark)" srcset = "/assets/cool_logo_dark_theme.png" >
< source media = "(prefers-color-scheme: light)" srcset = "/assets/cool_logo_light_theme.png" >
< img alt = "Cool logo" src = "/assets/cool_logo_dark_theme.png" >
< / picture >
< / div >
2023-06-20 20:52:50 +02:00
2023-06-20 23:16:14 +02:00
< div align = "center" >
A very, VERY WIP Smithay-based wayland compositor
< / div >
2023-08-03 02:45:56 +02:00
## News
2023-08-08 01:25:22 +02:00
- [Wlr-layer-shell support ](https://github.com/Ottatop/pinnacle/pull/45 ) is now here!
Now you can use stuff like [swaybg ](https://github.com/swaywm/swaybg ) so you don't have
to look at an ugly gray background and [eww ](https://github.com/elkowar/eww )
for widgets (until I implement a widget system, that is). As always, if you find any
issues, submit a bug report!
< details >
< summary > Older stuff< / summary >
- We now have XWayland support as of [#34 ](https://github.com/Ottatop/pinnacle/pull/34 )!
It's currently not that polished right now because I got bored of working on it and I want
to work on other aspects of Pinnacle, but it should be at least *usable* .
< / details >
2023-07-22 04:48:56 +02:00
2023-07-03 01:31:41 +02:00
## Features
- [x] Winit backend
- [x] Udev backend
- This is currently just a copy of Anvil's udev backend.
- [x] Basic tags
- [ ] Layout system
2023-07-18 17:41:55 +02:00
- [x] Left master stack, corner, dwindle, spiral layouts
- [ ] Other three master stack directions, floating, magnifier, maximized, and fullscreen layouts
- [ ] Resizable layouts
2023-08-03 02:45:56 +02:00
- [x] XWayland support
- This is currently somewhat buggy. If you find a problem that's not already listed in GitHub issues, feel free to submit it!
2023-08-08 01:25:22 +02:00
- [x] Layer-shell support
- [ ] wlr-screencopy support
- [ ] wlr-output-management support
2023-07-03 01:31:41 +02:00
- [ ] Server-side decorations
2023-07-13 04:48:47 +02:00
- [ ] Animations and blur and all that pizazz
2023-07-18 17:41:55 +02:00
- [ ] Widget system
2023-07-03 01:31:41 +02:00
- [ ] The other stuff Awesome has
- [x] Is very cool :thumbsup:
2023-06-20 23:16:14 +02:00
## Info
### Why Pinnacle?
Well, I currently use [Awesome ](https://github.com/awesomeWM/awesome ). And I really like it! Unfortunately, Awesome doesn't exist for Wayland ([anymore](http://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html)). There doesn't seem to be any Wayland compositor out there that has all of the following:
2023-07-03 01:31:41 +02:00
- Tags for window management
- Configurable in Lua (or any other programming language for that matter)
- Has a bunch of batteries included (widget system, systray, etc)
2023-06-20 23:16:14 +02:00
So, this is my attempt at making an Awesome-esque Wayland compositor.
## Dependencies
You'll need the following packages, as specified by [Smithay ](https://github.com/Smithay/smithay ):
2023-08-08 19:53:04 +02:00
`libwayland libxkbcommon libudev libinput libgdm libseat` , as well as `xwayland` .
2023-07-13 04:48:47 +02:00
- Arch:
```
2023-08-08 19:53:04 +02:00
sudo pacman -S wayland wayland-protocols libxkbcommon systemd-libs libinput mesa seatda xwayland
2023-07-13 04:48:47 +02:00
```
- Debian:
```
2023-08-08 19:53:04 +02:00
sudo apt install libwayland-dev libxkbcommon-dev libudev-dev libinput-dev libgdm-dev libseat-dev xwayland
2023-07-13 04:48:47 +02:00
```
2023-08-08 01:25:22 +02:00
- NixOS: Use the provided [`shell.nix` ](shell.nix ).
2023-07-13 04:48:47 +02:00
- TODO: other distros.
2023-08-08 01:25:22 +02:00
You'll also need Lua 5.4 for configuration. **Older versions will not work.** Check with your package manager to see which version you have.
2023-06-20 23:16:14 +02:00
## Building
Build the project with:
```
cargo build [--release]
```
2023-08-08 01:25:22 +02:00
For NixOS users, there is a provided [`shell.nix` ](shell.nix ) file that you can use for `nix-shell` .
It *should* work, but if it doesn't, please raise an issue. < sup > flake soon:tm:</ sup >
2023-06-20 23:16:14 +02:00
## Running
After building, run the executable located in either:
2023-08-08 01:25:22 +02:00
```sh
./target/debug/pinnacle --< backend > # without --release
./target/release/pinnacle --< backend > # with --release
2023-06-20 23:16:14 +02:00
```
Or, run the project directly with
2023-08-08 01:25:22 +02:00
```sh
2023-06-20 23:16:14 +02:00
cargo run [--release] -- --< backend >
```
`backend` can be one of two values:
2023-07-03 01:31:41 +02:00
- `winit` : run Pinnacle as a window in your graphical environment
- `udev` : run Pinnacle in a tty. NOTE: I tried running udev in Awesome and some things broke so uh, don't do that
2023-06-20 23:16:14 +02:00
2023-08-08 01:27:44 +02:00
> :information_source: When running in debug mode, the compositor will drastically slow down
> if there are too many windows on screen. If you don't want this to happen, use release mode.
2023-08-08 01:31:06 +02:00
> #### :exclamation: IMPORTANT: Read the following before you launch the `udev` backend:
2023-08-08 01:25:22 +02:00
> If you successfully enter the `udev` backend but none of the controls work, this means either Pinnacle
failed to find your config, or the config process crashed.
>
> I have not yet implemented VT switching, so to enable you to exit the compositor if this happens,
> ```
> Ctrl + Alt + Shift + Escape
> ```
> has been hardcoded in to kill the compositor.
2023-08-08 01:31:06 +02:00
> #### :information_source: Pinnacle will open a socket in the `/tmp` directory.
2023-08-08 01:25:22 +02:00
> If for whatever reason you need the socket to be in a different place, run Pinnacle with
> the `SOCKET_DIR` environment variable:
> ```sh
> SOCKET_DIR=/path/to/new/dir/ cargo run -- --<backend>
> ```
2023-08-08 01:31:06 +02:00
> #### :warning: Don't run Pinnacle as root.
2023-08-08 01:25:22 +02:00
> This will open the socket with root-only permissions, and future non-root invocations
of Pinnacle will fail when trying to remove the socket until it is removed manually.
2023-06-20 23:16:14 +02:00
## Configuration
2023-08-08 01:25:22 +02:00
Please note: this is WIP and has few options.
2023-06-20 23:16:14 +02:00
2023-07-03 01:31:41 +02:00
Pinnacle supports configuration through Lua (and hopefully more languages if it's not too unwieldy :crab:).
2023-06-20 23:16:14 +02:00
Run Pinnacle with the `PINNACLE_CONFIG` environment variable set to the path of your config file. If not specified, Pinnacle will look for the following:
2023-08-08 01:25:22 +02:00
```sh
2023-06-20 23:16:14 +02:00
$XDG_CONFIG_HOME/pinnacle/init.lua
2023-08-08 01:25:22 +02:00
~/.config/pinnacle/init.lua # if XDG_CONFIG_HOME isn't set
2023-06-20 23:16:14 +02:00
```
The following will use the example config file in [`api/lua` ](api/lua ):
2023-08-08 01:25:22 +02:00
```sh
2023-06-20 23:16:14 +02:00
PINNACLE_CONFIG="./api/lua/example_config.lua" cargo run -- --< backend >
```
2023-08-08 01:37:45 +02:00
> #### :information_source: The config is an external process.
2023-08-08 01:25:22 +02:00
> If it crashes for whatever reason, all of your keybinds will stop working.
> Again, you can exit the compositor with `Ctrl + Alt + Shift + Escape`.
>
> Config reloading soon:tm:
2023-08-03 02:45:56 +02:00
### API Documentation
2023-08-08 01:25:22 +02:00
There is a preliminary [doc website ](https://ottatop.github.io/pinnacle/main ) generated with LDoc.
Note that there are some missing things like the `Keys` table and `Layout` enum
as well as any function overloads, but these should be autocompleted through the language server.
2023-08-03 02:45:56 +02:00
Documentation for other branches can be reached at `https://ottatop.github.io/pinnacle/<branch name>` .
2023-06-20 23:16:14 +02:00
### Autocomplete and that cool stuff
2023-08-08 01:25:22 +02:00
It is *highly* recommended to use the [Lua language server ](https://github.com/LuaLS/lua-language-server )
and set it up to have the [`api/lua` ](api/lua ) directory as a library, as I'll be using
its doc comments to provide documentation, autocomplete, and error checking.
2023-06-20 23:16:14 +02:00
#### For VS Code:
2023-08-08 01:25:22 +02:00
Install the [Lua ](https://marketplace.visualstudio.com/items?itemName=sumneko.lua ) plugin, then go into
its settings and add the path to the [`api/lua` ](api/lua ) directory to `Workspace: Library` .
2023-06-20 23:16:14 +02:00
#### For Neovim:
2023-06-22 00:36:51 +02:00
Pass this table into your Lua language server settings:
2023-06-20 23:16:14 +02:00
```lua
Lua = {
workspace = {
library = {
2023-08-08 01:25:22 +02:00
"/path/to/pinnacle/api/lua" -- Your path here
2023-06-20 23:16:14 +02:00
}
}
}
```
## Controls
The following controls are currently hardcoded:
2023-07-03 01:31:41 +02:00
- `Ctrl + Left Mouse` : Move a window
- `Ctrl + Right Mouse` : Resize a window
2023-08-08 01:25:22 +02:00
- `Ctrl + Alt + Shift + Esc` : Kill Pinnacle. This is for when the compositor inevitably
locks up because I did a dumb thing :thumbsup:
2023-06-20 23:16:14 +02:00
2023-06-22 00:36:51 +02:00
You can find the rest of the controls in the [`example_config` ](api/lua/example_config.lua ).
2023-08-04 03:54:22 +02:00
## Feature Requests, Bug Reports, Contributions, and Questions
See [CONTRIBUTING.md ](CONTRIBUTING.md ).