pinnacle/README.md

222 lines
9 KiB
Markdown
Raw Normal View History

![Pinnacle banner](/assets/pinnacle_banner_dark.png)
2023-06-20 20:52:50 +02:00
2023-09-08 05:52:45 +02:00
https://github.com/Ottatop/pinnacle/assets/120758733/c175ba80-9796-4759-92c3-1d7a6639b0c9
2023-10-25 11:23:20 +02:00
# Table of Contents
- [Info](#info)
- [What is Pinnacle?](#what-is-pinnacle)
- [Features](#features)
- [Roadmap](#roadmap)
- [Dependencies](#dependencies)
- [Building](#building)
- [Running](#running)
- [Configuration](#configuration)
- [Out-of-the-box configurations](#out-of-the-box-configurations)
- [Custom configuration](#custom-configuration)
- [Lua](#lua)
2024-01-16 23:54:25 +01:00
- [Lua Language Server completion](#lua-language-server-completion)
2023-10-25 11:23:20 +02:00
- [Rust](#rust)
- [API Documentation](#api-documentation)
- [Controls](#controls)
- [Feature Requests, Bug Reports, Contributions, and Questions](#feature-requests-bug-reports-contributions-and-questions)
- [Changelog](#changelog)
2023-08-17 04:23:17 +02:00
# Info
2023-08-16 04:58:03 +02:00
### What is Pinnacle?
Pinnacle is a Wayland compositor built in Rust using [Smithay](https://github.com/Smithay/smithay).
It's my attempt at creating something like [AwesomeWM](https://github.com/awesomeWM/awesome)
for Wayland.
2024-01-22 07:03:55 +01:00
It sports extensive configurability through either Lua or Rust, with the ability to add more languages
in the future. <sup>And by that I mean other people can do the adding,
I'm already maintaining Lua and Rust lol</sup>
2023-08-16 04:58:03 +02:00
2023-09-08 05:52:45 +02:00
> ### More video examples below!
> <details>
>
> <summary>Click me</summary>
>
> All videos were recorded using [Screenkey](https://gitlab.com/screenkey/screenkey) and the Winit backend.
>
> https://github.com/Ottatop/pinnacle/assets/120758733/5b6b224b-3031-4a1c-9375-1143f1bfc0e3
>
> https://github.com/Ottatop/pinnacle/assets/120758733/7a465983-2560-412e-9154-40b3dfd20488
>
> (This video is very crunchy in my attempts to get under the 10mb limit)
>
> </details>
2023-08-16 04:58:03 +02:00
### Features
2023-10-21 04:11:16 +02:00
- Tag system
2023-10-21 04:34:52 +02:00
- Left master stack, corner, dwindle, and spiral layouts from Awesome
2024-01-16 23:54:25 +01:00
- (Really scuffed) XWayland support
2023-10-21 04:11:16 +02:00
- Layer-shell support
- Configurable in Lua or Rust
- Is very cool :thumbsup:
2023-07-03 01:31:41 +02:00
2023-10-21 04:11:16 +02:00
### Roadmap
- TODO
2023-06-20 23:16:14 +02:00
2023-08-17 04:23:17 +02:00
# Dependencies
2024-01-16 23:54:25 +01:00
You will need:
- [Rust](https://www.rust-lang.org/) 1.72 or newer, to build the project and use the Rust API
- [Lua](https://www.lua.org/) 5.4 or newer, to use the Lua API
- Packages for [Smithay](https://github.com/Smithay/smithay):
2024-01-22 07:03:55 +01:00
`libwayland libxkbcommon libudev libinput libgdm libseat`, as well as `xwayland`
2024-01-16 23:54:25 +01:00
- Arch:
```sh
sudo pacman -S wayland wayland-protocols libxkbcommon systemd-libs libinput mesa seatd xorg-xwayland
```
- Debian:
```sh
sudo apt install libwayland-dev libxkbcommon-dev libudev-dev libinput-dev libgdm-dev libseat-dev xwayland
```
- NixOS: There is a really old [`shell.nix`](shell.nix) that may or may not work :skull:
- [protoc](https://grpc.io/docs/protoc-installation/), the Protocol Buffer Compiler, for configuration
- Arch:
```sh
sudo pacman -S protobuf
```
- [LuaRocks](https://luarocks.org/), the Lua package manager, to use the Lua API
- Arch:
```sh
sudo pacman -S luarocks
```
- You must run `eval $(luarocks path --lua-version 5.4)` so that your config can find the API
library files. It is recommended to place this command in your shell's startup script.
TODO: other distros
2023-08-17 04:23:17 +02:00
# Building
2023-06-20 23:16:14 +02:00
Build the project with:
```
cargo build [--release]
```
2023-09-22 02:57:26 +02:00
> [!NOTE]
2024-01-16 23:54:25 +01:00
> On build, [`build.rs`](build.rs) will:
> - Copy Protobuf definition files to `$XDG_DATA_HOME/pinnacle/protobuf`
> - Copy the [default config](api/lua/examples/default) to `$XDG_DATA_HOME/pinnacle/default_config`
> - `cd` into [`api/lua`](api/lua) and run `luarocks make` to install the Lua library to `~/.luarocks/share/lua/5.4`
2023-09-22 00:34:02 +02:00
2023-08-17 04:23:17 +02:00
# Running
2023-09-08 07:23:19 +02:00
> [!IMPORTANT]
> Before running, read the information in [Configuration](#configuration).
2023-08-16 20:57:47 +02:00
2023-06-20 23:16:14 +02:00
After building, run the executable located in either:
2023-08-08 01:25:22 +02:00
```sh
2023-08-08 20:30:52 +02:00
./target/debug/pinnacle # without --release
./target/release/pinnacle # 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-08-08 20:30:52 +02:00
cargo run [--release]
2023-06-20 23:16:14 +02:00
```
2023-09-22 00:34:02 +02:00
See flags you can pass in by running `cargo run -- --help` (or `-h`).
2023-08-08 20:30:52 +02:00
2023-08-17 04:23:17 +02:00
# Configuration
2023-10-21 04:11:16 +02:00
Pinnacle is configured in your choice of Lua or Rust.
2023-06-20 23:16:14 +02:00
2023-10-21 04:11:16 +02:00
## Out-of-the-box configurations
If you just want to test Pinnacle out without copying stuff to your config directory,
2024-01-16 23:54:25 +01:00
run one of the following in the crate root:
2023-10-21 04:11:16 +02:00
```sh
# For a Lua configuration
2024-01-16 23:54:25 +01:00
PINNACLE_CONFIG_DIR="./api/lua/examples/default" cargo run
# This should also have been copied to the directory below, so below will do the same
PINNACLE_CONFIG_DIR="~/.local/share/pinnacle/default_config" cargo run
2023-10-21 04:11:16 +02:00
# For a Rust configuration
2024-01-22 07:03:55 +01:00
PINNACLE_CONFIG_DIR="./api/rust/examples/default_config" cargo run
2023-10-21 04:11:16 +02:00
```
## Custom configuration
> [!IMPORTANT]
2024-01-22 07:03:55 +01:00
> Pinnacle is under development, and there *will* be major breaking changes to these APIs
> until I release version 0.1, at which point there will be an API stability spec in place.
>
> Until then, I recommend you either use the out-of-the-box configs above or prepare for
> your config to break every now and then.
2023-08-16 04:58:03 +02:00
Pinnacle will search for a `metaconfig.toml` file in the following directories, from top to bottom:
2023-08-08 01:25:22 +02:00
```sh
2023-08-16 04:58:03 +02:00
$PINNACLE_CONFIG_DIR
2023-09-22 00:34:02 +02:00
$XDG_CONFIG_HOME/pinnacle
~/.config/pinnacle # Only if $XDG_CONFIG_HOME is not defined
2023-06-20 23:16:14 +02:00
```
2023-08-16 04:58:03 +02:00
The `metaconfig.toml` file provides information on what config to run, kill and reload keybinds,
2023-08-16 20:57:47 +02:00
and any environment variables you want set. For more details, see the provided
2024-01-16 23:59:46 +01:00
[`metaconfig.toml`](api/lua/examples/default/metaconfig.toml) file.
2023-08-16 04:58:03 +02:00
2023-10-21 04:11:16 +02:00
If no `metaconfig.toml` file is found, the default Lua config will be loaded.
2023-09-22 03:08:02 +02:00
2023-10-21 04:11:16 +02:00
### Lua
2024-01-16 23:54:25 +01:00
For custom configuration in Lua, copy the contents of `~/.local/share/pinnacle/default_config` to
`~/.config/pinnacle` (or `$XDG_CONFIG_HOME/pinnacle`):
```sh
mkdir ~/.config/pinnacle
cp -r ~/.local/share/pinnacle/default_config/. ~/.config/pinnacle
```
Note: there is a `.luarc.json` file that may not get copied if you do `cp <path>/* ~/.config/pinnacle`.
The above command takes that into account.
2023-08-03 02:45:56 +02:00
2024-01-16 23:54:25 +01:00
> If you rename `default_config.lua`, make sure `command` in your `metaconfig.toml` is updated to reflect that.
2023-09-22 03:08:02 +02:00
> If it isn't, the compositor will load the default config instead.
2023-08-03 02:45:56 +02:00
2024-01-16 23:54:25 +01:00
#### Lua Language Server completion
A [`.luarc.json`](api/lua/examples/default/.luarc.json) file is included with the default Lua config
and will set the correct workspace library files for use with the
[Lua language server](https://github.com/LuaLS/lua-language-server).
2023-06-20 23:16:14 +02:00
2023-10-21 04:11:16 +02:00
### Rust
If you want to use Rust to configure Pinnacle, follow these steps:
1. In `~/.config/pinnacle`, run `cargo init`.
2. In the `Cargo.toml` file, add the following under `[dependencies]`:
```toml
2024-01-22 07:03:55 +01:00
pinnacle-api = { git = "http://github.com/pinnacle-comp/pinnacle" }
2023-10-21 04:11:16 +02:00
```
3. Create the file `metaconfig.toml` at the root. Add the following to the file:
```toml
command = ["cargo", "run"]
reload_keybind = { modifiers = ["Ctrl", "Alt"], key = "r" }
kill_keybind = { modifiers = ["Ctrl", "Alt", "Shift"], key = "escape" }
```
2024-01-22 07:03:55 +01:00
4. Copy the [default config](api/rust/examples/default_config/main.rs) to `src/main.rs`.
2023-10-21 04:34:52 +02:00
5. Run Pinnacle! (You may want to run `cargo build` beforehand so you don't have to wait for your config to compile.)
2023-08-16 04:58:03 +02:00
2023-10-21 04:11:16 +02:00
### API Documentation
<b>Lua: https://pinnacle-comp.github.io/pinnacle/main/lua.<br>
Rust: https://pinnacle-comp.github.io/pinnacle/main/rust.</b>
2023-08-16 04:58:03 +02:00
2023-10-21 04:11:16 +02:00
> Documentation for other branches can be reached by replacing `main` with the branch you want.
2023-08-16 04:58:03 +02:00
2023-08-17 04:23:17 +02:00
# Controls
2024-01-16 23:54:25 +01:00
The following are the default controls in the [`default_config`](api/lua/examples/default/default_config.lua).
2023-09-11 05:25:18 +02:00
| Binding | Action |
|----------------------------------------------|------------------------------------|
| <kbd>Ctrl</kbd> + <kbd>Mouse left drag</kbd> | Move window |
| <kbd>Ctrl</kbd> + <kbd>Mouse right drag</kbd>| Resize window |
| <kbd>Ctrl</kbd><kbd>Alt</kbd> + <kbd>q</kbd> | Quit Pinnacle |
| <kbd>Ctrl</kbd><kbd>Alt</kbd> + <kbd>c</kbd> | Close window |
| <kbd>Ctrl</kbd> + <kbd>Return</kbd> | Spawn [Alacritty](https://github.com/alacritty/alacritty) (you can change this in the config)|
| <kbd>Ctrl</kbd><kbd>Alt</kbd> + <kbd>Space</kbd> | Toggle between floating and tiled |
| <kbd>Ctrl</kbd> + <kbd>f</kbd> | Toggle fullscreen |
| <kbd>Ctrl</kbd> + <kbd>m</kbd> | Toggle maximized |
| <kbd>Ctrl</kbd> + <kbd>Space</kbd> | Cycle to the next layout |
| <kbd>Ctrl</kbd><kbd>Shift</kbd> + <kbd>Space</kbd> | Cycle to the previous layout |
| <kbd>Ctrl</kbd> + <kbd>1</kbd> to <kbd>5</kbd> | Switch to tag `1` to `5` |
| <kbd>Ctrl</kbd><kbd>Shift</kbd> + <kbd>1</kbd> to <kbd>5</kbd> | Toggle tag `1` to `5` |
| <kbd>Ctrl</kbd><kbd>Alt</kbd> + <kbd>1</kbd> to <kbd>5</kbd> | Move a window to tag `1` to `5` |
| <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>Shift</kbd> + <kbd>1</kbd> to <kbd>5</kbd> | Toggle tag `1` to `5` on a window |
2023-08-04 03:54:22 +02:00
2023-08-17 04:23:17 +02:00
# Feature Requests, Bug Reports, Contributions, and Questions
2023-08-14 21:47:27 +02:00
See [`CONTRIBUTING.md`](CONTRIBUTING.md).
2023-08-16 20:57:47 +02:00
2023-08-17 04:23:17 +02:00
# Changelog
2023-08-16 20:57:47 +02:00
See [`CHANGELOG.md`](CHANGELOG.md).