Add metaconfig comments, PINNACLE_DIR env

This commit is contained in:
Ottatop 2023-08-15 21:30:49 -05:00
parent 251a96d1a0
commit e423d1e345
4 changed files with 50 additions and 2 deletions

View file

@ -24,6 +24,7 @@ itertools = { version = "0.11.0" }
x11rb = { version = "0.12.0", default-features = false, features = ["composite"], optional = true }
shellexpand = "3.1.0"
toml = "0.7.6"
anyhow = "1.0.74"
[features]
default = ["egl", "winit", "udev", "xwayland"]

View file

@ -35,6 +35,14 @@ See [`CHANGELOG.md`](CHANGELOG.md).
- [x] Is very cool :thumbsup:
## Info
### What is Pinnacle?
Pinnacle is a Wayland compositor built in Rust using [Smithay](https://github.com/Smithay/smithay).
In short, this is my attempt at creating something like [AwesomeWM](https://github.com/awesomeWM/awesome)
for Wayland.
It sports high configurability through a (soon to be) deep Lua API, with plans for a Rust API in the future.
### 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:
- Tags for window management

View file

@ -1,7 +1,44 @@
# This metaconfig.toml file dictates what config Pinnacle will run.
#
# When running Pinnacle, the compositor will look in the following directories for a metaconfig.toml file,
# in order from top to bottom:
# $PINNACLE_CONFIG_DIR
# $XDG_CONFIG_HOME/pinnacle/
# ~/.config/pinnacle/
#
# When Pinnacle finds a metaconfig.toml file, it will execute the command provided to `command`.
# For now, the only thing that should be here is `lua` with a path to the main config file.
# In the future, there will be a Rust API that can be run using `cargo run`.
#
# Because configuration is done using an external process, if it ever crashes, you lose all of your keybinds.
# In order prevent you from getting stuck in the compositor, you must define keybinds to reload your config
# and kill Pinnacle.
#
# More details on each setting can be found below.
# The command Pinnacle will run on startup and when you reload your config.
# Paths are relative to the directory the metaconfig.toml file is in.
command = "lua example_config.lua"
### Keybinds ###
# Each keybind takes in a table with two fields: `modifiers` and `key`.
# - `modifiers` can be one of "Ctrl", "Alt", "Shift", or "Super".
# - `key` can be a string of any lowercase letter, number,
# "numN" where N is a number for numpad keys, or "esc"/"escape".
# Support for any xkbcommon key is planned for a future update.
# The keybind that will reload your config.
reload_keybind = { modifiers = ["Ctrl", "Alt"], key = "r" }
# The keybind that will kill Pinnacle.
kill_keybind = { modifiers = ["Ctrl", "Alt", "Shift"], key = "escape" }
# You may need to specify to Lua where Pinnacle's Lua API library is.
# This is currently done using the `envs` table, with keys as the name of the environment variable and
# the value as the variable value. This supports $var expansion, and paths are relative to this metaconfig.toml file.
#
# Pinnacle will run your config with the additional PINNACLE_DIR environment variable.
#
# Here, LUA_PATH and LUA_CPATH are used to tell Lua the path to the library.
[envs]
LUA_PATH = "./?.lua;./?/init.lua;./lib/?.lua;./lib/?/init.lua;$LUA_PATH"
LUA_CPATH = "./lib/?.so;$LUA_CPATH"
LUA_PATH = "$PINNACLE_DIR/api/lua/?.lua;$PINNACLE_DIR/api/lua/?/init.lua;$PINNACLE_DIR/api/lua/lib/?.lua;$PINNACLE_DIR/api/lua/lib/?/init.lua;$LUA_PATH"
LUA_CPATH = "$PINNACLE_DIR/api/lua/lib/?.so;$LUA_CPATH"

View file

@ -379,6 +379,8 @@ fn start_config() -> Result<ConfigReturn, Box<dyn std::error::Error>> {
let arg1 = command.next().expect("empty command");
std::env::set_var("PINNACLE_DIR", std::env::current_dir()?);
let envs = metaconfig
.envs
.unwrap_or(toml::map::Map::new())