hyprland-wiki/content/Configuring/Keywords.md

178 lines
4.7 KiB
Markdown
Raw Permalink Normal View History

---
weight: 3
title: Keywords
---
Keywords are not variables, but "commands" for more advanced configuring. On
this page, you will be presented with some that do not deserve their own page.
2022-08-12 20:46:36 +02:00
See the sidebar for more keywords to control binds, animations, monitors, et
cetera.
2025-10-29 20:52:11 +01:00
> [!WARNING]
> Please remember, that for ALL arguments separated by a comma, if you want to
> leave one of them empty, you cannot reduce the number of commas, _unless told
> otherwise in a specific section_:
>
> ```ini
> three_param_keyword = A, B, C # OK
> three_param_keyword = A, C # NOT OK
> three_param_keyword = A, , C # OK
> three_param_keyword = A, B, # OK
> ```
## Executing
2022-08-12 20:46:36 +02:00
2024-09-07 14:54:46 -05:00
You can execute a shell script on:
2024-11-06 20:34:37 +02:00
2024-09-07 14:54:46 -05:00
- startup of the compositor
- every time the config is reloaded.
- shutdown of the compositor
2022-08-12 20:46:36 +02:00
2025-01-29 12:32:40 +01:00
`exec-once = command` will execute only on launch ([support rules](../Dispatchers/#executing-with-rules))
2022-08-12 20:46:36 +02:00
2025-01-11 23:58:17 +08:00
`execr-once = command` will execute only on launch
2025-01-29 12:32:40 +01:00
`exec = command` will execute on each reload ([support rules](../Dispatchers/#executing-with-rules))
2025-01-11 23:58:17 +08:00
`execr = command` will execute on each reload
2022-08-12 20:46:36 +02:00
2024-09-07 14:54:46 -05:00
`exec-shutdown = command` will execute only on shutdown
## Sourcing (multi-file)
2022-08-12 20:46:36 +02:00
Use the `source` keyword to source another file. Globbing is supported
2022-08-12 20:46:36 +02:00
For example, in your `hyprland.conf` you can:
2022-09-24 17:03:37 +03:00
```ini
2024-07-30 22:59:15 +03:00
source = ~/.config/hypr/myColors.conf
source = ~/.config/hypr/custom/*
2022-08-12 20:46:36 +02:00
```
And Hyprland will enter that file and parse it like a Hyprland config.
2024-07-30 22:59:15 +03:00
Please note it's LINEAR. Meaning lines above the `source =` will be parsed first,
2022-08-12 20:46:36 +02:00
then lines inside `~/.config/hypr/myColors.conf`, then lines below.
## Gestures
2022-08-12 20:46:36 +02:00
2024-07-30 22:59:15 +03:00
Use [libinput-gestures](https://github.com/bulletmark/libinput-gestures) with
2022-08-12 20:46:36 +02:00
`hyprctl` if you want to expand Hyprland's gestures beyond what's offered in
2024-03-17 14:44:39 +02:00
[Variables](../Variables).
2022-08-12 20:46:36 +02:00
## Per-device input configs
2022-08-12 20:46:36 +02:00
Per-device config options will overwrite your options set in the `input`
section. It's worth noting that ONLY values explicitly changed will be
overwritten.
2024-07-30 22:59:15 +03:00
In order to apply per-device config options, add a new category like this:
2022-08-12 20:46:36 +02:00
2022-09-24 17:03:37 +03:00
```ini
2024-02-18 15:01:40 +00:00
device {
name = ...
# options ...
2022-08-12 20:46:36 +02:00
}
```
2024-07-30 22:59:15 +03:00
The `name` can be easily obtained by checking the output of `hyprctl devices`.
2022-08-12 20:46:36 +02:00
Inside of it, put your config options. All options from the `input` category
(and all subcategories, e.g. `input:touchpad`) can be put inside, **EXCEPT**:
2024-07-30 22:59:15 +03:00
- `force_no_accel`
- `follow_mouse`
- `float_switch_override_focus`
2022-08-12 20:46:36 +02:00
2022-10-14 12:29:39 +01:00
Properties that change names:
2022-10-14 12:29:39 +01:00
```plain
2022-12-21 15:12:58 +00:00
touchdevice:transform -> transform
touchdevice:output -> output
2022-10-14 12:29:39 +01:00
```
You can also use the `output` setting for tablets to bind them to outputs.
Remember to use the name of the `Tablet` and not `Tablet Pad` or `Tablet tool`.
2022-12-21 15:12:58 +00:00
2022-10-27 12:58:22 +01:00
Additional properties only present in per-device configs:
2024-07-30 22:59:15 +03:00
- `enabled` -> (only for mice / touchpads / touchdevices / keyboards)
2024-11-06 20:34:37 +02:00
- enables / disables the device (connects / disconnects from the on-screen cursor)
- default: Enabled
- `keybinds` -> (only for devices that send key events)
- enables / disables keybinds for the device
- default: Enabled
2022-10-27 12:58:22 +01:00
2022-10-14 12:29:39 +01:00
Example config section:
2022-08-12 20:46:36 +02:00
2022-09-24 17:03:37 +03:00
```ini
2024-02-18 15:01:40 +00:00
device {
name = royuan-akko-multi-modes-keyboard-b
2024-07-30 22:59:15 +03:00
repeat_rate = 50
repeat_delay = 500
middle_button_emulation = 0
2022-08-12 20:46:36 +02:00
}
```
Example modifying per-device config values using `hyprctl`:
2024-07-30 22:59:15 +03:00
```bash
hyprctl -r -- keyword device[my-device]:sensitivity -1
```
2025-10-29 20:52:11 +01:00
> [!NOTE]
> Per-device layouts will by default not alter the keybind keymap, so for example
> with a global keymap of `us` and a per-device one of `fr`, the keybinds will
> still act as if you were on `us`.
>
> You can change this behavior by setting `resolve_binds_by_sym = 1`. In that case
> you'll need to type the symbol specified in the bind to activate it.
## Wallpapers
2022-08-12 20:46:36 +02:00
The "Hyprland" background you see when you first start Hyprland is **NOT A
2022-08-12 20:46:36 +02:00
WALLPAPER**, it's the default image rendered at the bottom of the render stack.
To set a wallpaper, use a wallpaper utility like
[hyprpaper](https://github.com/hyprwm/hyprpaper) or
[swaybg](https://github.com/swaywm/swaybg).
2024-03-17 14:44:39 +02:00
More can be found in [Useful Utilities](../../Useful-Utilities).
2022-08-12 20:46:36 +02:00
## Setting the environment
2025-10-29 20:52:11 +01:00
> [!NOTE]
> A new environment cannot be passed to already running processes. If you change / add / remove an `env = ` entry
> when Hyprland is running, only newly spawned apps will pick up the changes.
2025-08-29 11:18:37 +02:00
You can use the `env` keyword to set environment variables,
2024-07-30 22:59:15 +03:00
e.g:
2023-03-05 13:17:08 +00:00
```ini
env = XCURSOR_SIZE,24
```
You can also add a `d` flag if you want the env var to be exported to D-Bus
2024-07-30 22:59:15 +03:00
(systemd only):
2023-03-05 13:17:08 +00:00
```ini
envd = XCURSOR_SIZE,24
2023-03-17 16:27:13 +00:00
```
2025-10-29 20:52:11 +01:00
> [!WARNING]
> Hyprland puts the raw string to the env var. You should _not_ add quotes around
> the values.
>
> e.g.:
>
> ```ini
> env = QT_QPA_PLATFORM,wayland
> ```
>
> and _**NOT**_
>
> ```ini
> env = QT_QPA_PLATFORM,"wayland"
> ```