Added readme
This commit is contained in:
parent
006f840b2c
commit
055a5178cd
1 changed files with 68 additions and 0 deletions
68
readme.org
Normal file
68
readme.org
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#+TITLE: hyprlua-btw
|
||||
#+AUTHOR: Tony, btw
|
||||
|
||||
Configuring Hyprland with Lua instead of Hyprlang.
|
||||
|
||||
* Why Lua?
|
||||
|
||||
Hyprland has historically been configured in Hyprlang, a custom DSL. Vaxry added Lua as an alternative because the project has outgrown the DSL.
|
||||
|
||||
Lua is a good fit:
|
||||
- tiny and embeddable
|
||||
- on basically every system
|
||||
- ubiquitous tooling (syntax highlighting, LuaLS)
|
||||
- you get a real LSP — completions, diagnostics, go-to-def — on your config
|
||||
|
||||
* Install on NixOS
|
||||
|
||||
Add Hyprland as a flake input:
|
||||
|
||||
#+begin_src nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
hyprland.url = "github:hyprwm/Hyprland/v0.55.0";
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
In =configuration.nix=:
|
||||
|
||||
#+begin_src nix
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
#+end_src
|
||||
|
||||
Install =lua-language-server= in your user packages so the LSP works.
|
||||
|
||||
* Lua config + LSP
|
||||
|
||||
Delete =~/.config/hypr/hyprland.conf=. Grab the Hyprland repo to pull the example Lua config and the LuaLS definitions:
|
||||
|
||||
#+begin_src sh
|
||||
git clone --depth=1 https://github.com/hyprwm/Hyprland
|
||||
cd Hyprland
|
||||
nix develop
|
||||
# generate the LuaLS type definitions
|
||||
cd meta && python <gen-script>
|
||||
# move generated defs + example config into ~/.config/hypr
|
||||
#+end_src
|
||||
|
||||
Then drop a =.luarc.json= in =~/.config/hypr= so LuaLS picks up the =hl= global and the type definitions:
|
||||
|
||||
#+begin_src json
|
||||
{
|
||||
"workspace": {
|
||||
"library": ["/home/tony/.config/hypr"]
|
||||
},
|
||||
"diagnostics": {
|
||||
"globals": ["hl"]
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Now you get full autocomplete and inline docs on every Hyprland keyword as you edit =hyprland.lua=.
|
||||
Loading…
Add table
Add a link
Reference in a new issue