Update Hyprland gesture examples to Lua syntax in README
The documentation previously showed the legacy `hyprland.conf` INI format. Since users now configure Hyprgrass via Hyprland's Lua config, rewrite all gesture examples as Lua and update the troubleshooting note accordingly.
This commit is contained in:
+58
-48
@@ -69,45 +69,53 @@ You can toggle the window from another terminal:
|
|||||||
ags toggle pinenote-fullscreen -i pinenote-shell
|
ags toggle pinenote-fullscreen -i pinenote-shell
|
||||||
```
|
```
|
||||||
|
|
||||||
### Hyprland Configuration
|
### Hyprland Configuration (Lua)
|
||||||
|
|
||||||
Add the following to your `~/.config/hypr/hyprgrass.conf`:
|
The examples below use **Hyprland's Lua configuration format**. If you use the classic `hyprland.conf` syntax, translate the tables/keys accordingly.
|
||||||
|
|
||||||
|
Add the gesture bindings to your Hyprland Lua config (often `~/.config/hypr/hyprland.lua` or wherever your `hyprland.conf` sources):
|
||||||
|
|
||||||
> **Note:** AGS v3 uses `ags toggle` / `ags request` instead of the old `--js-evaluate` flag.
|
> **Note:** AGS v3 uses `ags toggle` / `ags request` instead of the old `--js-evaluate` flag.
|
||||||
|
|
||||||
```ini
|
```lua
|
||||||
[gesture:toggle_widget]
|
-- Load hyprgrass helpers if needed; adjust to your setup
|
||||||
hotkeys = [Mod1, T]
|
local hyprgrass = require("hyprgrass") -- or however you import it
|
||||||
shorthand = "pinch open"
|
|
||||||
actions = [
|
|
||||||
{
|
|
||||||
command = "exec ags toggle pinenote-fullscreen -i pinenote-shell",
|
|
||||||
timeout = 300,
|
|
||||||
target = "window:pinenote-fullscreen"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[gesture:brightness_up]
|
hyprgrass.gesture("toggle_widget", {
|
||||||
hotkeys = [Mod1, B]
|
hotkeys = { "MOD1", "T" }, -- Mod1+T
|
||||||
shorthand = "swipe up"
|
shorthand = "pinch open",
|
||||||
actions = [
|
actions = {
|
||||||
{
|
{
|
||||||
command = "exec ags request 'brightness 100' -i pinenote-shell",
|
command = "ags toggle pinenote-fullscreen -i pinenote-shell",
|
||||||
timeout = 300,
|
timeout = 300,
|
||||||
target = "window:pinenote-fullscreen"
|
target = "window:pinenote-fullscreen",
|
||||||
}
|
},
|
||||||
]
|
},
|
||||||
|
})
|
||||||
|
|
||||||
[gesture:brightness_down]
|
hyprgrass.gesture("brightness_up", {
|
||||||
hotkeys = [Mod1, V]
|
hotkeys = { "MOD1", "B" },
|
||||||
shorthand = "swipe down"
|
shorthand = "swipe up",
|
||||||
actions = [
|
actions = {
|
||||||
{
|
{
|
||||||
command = "exec ags request 'brightness 0' -i pinenote-shell",
|
command = "ags request 'brightness 100' -i pinenote-shell",
|
||||||
timeout = 300,
|
timeout = 300,
|
||||||
target = "window:pinenote-fullscreen"
|
target = "window:pinenote-fullscreen",
|
||||||
}
|
},
|
||||||
]
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
hyprgrass.gesture("brightness_down", {
|
||||||
|
hotkeys = { "MOD1", "V" },
|
||||||
|
shorthand = "swipe down",
|
||||||
|
actions = {
|
||||||
|
{
|
||||||
|
command = "ags request 'brightness 0' -i pinenote-shell",
|
||||||
|
timeout = 300,
|
||||||
|
target = "window:pinenote-fullscreen",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want the brightness requests to actually work, add a `requestHandler` to `app.start` in `src/main.js`, for example:
|
If you want the brightness requests to actually work, add a `requestHandler` to `app.start` in `src/main.js`, for example:
|
||||||
@@ -132,32 +140,34 @@ app.start({
|
|||||||
|
|
||||||
(You'll need to lift the `brightness` manager out of the component scope for this.)
|
(You'll need to lift the `brightness` manager out of the component scope for this.)
|
||||||
|
|
||||||
### Additional Gestures
|
### Additional Gestures (Lua)
|
||||||
|
|
||||||
Add more gestures for other controls:
|
Add more gestures for other controls:
|
||||||
|
|
||||||
```ini
|
```lua
|
||||||
[gesture:rotate_landscape]
|
hyprgrass.gesture("rotate_landscape", {
|
||||||
hotkeys = [Mod1, R]
|
hotkeys = { "MOD1", "R" },
|
||||||
shorthand = "swipe left"
|
shorthand = "swipe left",
|
||||||
actions = [
|
actions = {
|
||||||
{
|
{
|
||||||
command = "exec ags request 'rotate landscape' -i pinenote-shell",
|
command = "ags request 'rotate landscape' -i pinenote-shell",
|
||||||
timeout = 300,
|
timeout = 300,
|
||||||
target = "window:pinenote-fullscreen"
|
target = "window:pinenote-fullscreen",
|
||||||
}
|
},
|
||||||
]
|
},
|
||||||
|
})
|
||||||
|
|
||||||
[gesture:launch_terminal]
|
hyprgrass.gesture("launch_terminal", {
|
||||||
hotkeys = [Mod1, T]
|
hotkeys = { "MOD1", "T" },
|
||||||
shorthand = "double tap left"
|
shorthand = "double tap left",
|
||||||
actions = [
|
actions = {
|
||||||
{
|
{
|
||||||
command = "exec ags request 'launch terminal' -i pinenote-shell",
|
command = "ags request 'launch terminal' -i pinenote-shell",
|
||||||
timeout = 300,
|
timeout = 300,
|
||||||
target = "window:pinenote-fullscreen"
|
target = "window:pinenote-fullscreen",
|
||||||
}
|
},
|
||||||
]
|
},
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -217,7 +227,7 @@ Common customization options:
|
|||||||
|
|
||||||
1. **Check Astal/AGS installation**: Ensure `ags`, `gjs`, and the Astal libraries are installed correctly
|
1. **Check Astal/AGS installation**: Ensure `ags`, `gjs`, and the Astal libraries are installed correctly
|
||||||
2. **Verify CSS path**: Make sure `~/.config/ags/style.css` exists; otherwise the app will crash on start
|
2. **Verify CSS path**: Make sure `~/.config/ags/style.css` exists; otherwise the app will crash on start
|
||||||
3. **Verify hyprgrass config**: Make sure your gesture bindings are correct
|
3. **Verify hyprgrass Lua config**: Make sure your gesture bindings are correct and the Lua file is sourced by Hyprland
|
||||||
4. **Debug output**: Run with `ags run ./src/main.js` in a terminal to see console errors
|
4. **Debug output**: Run with `ags run ./src/main.js` in a terminal to see console errors
|
||||||
|
|
||||||
### Controls Not Working
|
### Controls Not Working
|
||||||
|
|||||||
Reference in New Issue
Block a user