hyprland-wiki/pages/Configuring/Keywords.md

225 lines
4.9 KiB
Markdown
Raw 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.
{{< callout >}}
2022-08-13 18:53:45 +02:00
2022-08-13 01:47:48 +02:00
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_:
2022-08-12 20:46:36 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-10-03 15:31:47 +02:00
three_param_keyword = A, B, C # OK
2022-08-12 20:46:36 +02:00
2022-10-03 15:31:47 +02:00
three_param_keyword = A, C # NOT OK
2022-08-12 20:46:36 +02:00
2022-10-03 15:31:47 +02:00
three_param_keyword = A, , C # OK
2022-08-27 19:17:14 +02:00
2022-10-03 15:31:47 +02:00
three_param_keyword = A, B, # OK
2022-08-12 20:46:36 +02:00
```
{{< /callout >}}
## Executing
2022-08-12 20:46:36 +02:00
you can execute a shell script on startup of the compositor or on each time it's
reloaded.
`exec-once=command` will execute only on launch
`exec=command` will execute on each reload
## Defining variables
2022-08-12 20:46:36 +02:00
You can define your own custom variables like this:
2022-09-24 16:03:37 +02:00
```ini
2022-08-12 20:46:36 +02:00
$VAR = value
```
for example:
2022-09-24 16:03:37 +02:00
```ini
2022-08-12 20:46:36 +02:00
$MyFavoriteGame = Among Us
```
then, to use them, simply use them. For example:
2022-09-24 16:03:37 +02:00
```ini
2022-08-12 20:46:36 +02:00
col.active_border=$MyColor
```
You ARE allowed to do this:
2022-09-24 16:03:37 +02:00
```ini
2022-08-12 20:46:36 +02:00
col.active_border=ff$MyRedValue1111
```
## Sourcing (multi-file)
2022-08-12 20:46:36 +02:00
Use the `source` keyword to source another file.
For example, in your `hyprland.conf` you can:
2022-09-24 16:03:37 +02:00
```ini
2022-08-12 20:46:36 +02:00
source=~/.config/hypr/myColors.conf
```
And Hyprland will enter that file and parse it like a Hyprland config.
Please note it's LINEAR. Meaning lines above the `source=` will be parsed first,
then lines inside `~/.config/hypr/myColors.conf`, then lines below.
## Gestures
2022-08-12 20:46:36 +02:00
Use something like
[libinput-gestures](https://github.com/bulletmark/libinput-gestures), with
`hyprctl` if you want to expand Hyprland's gestures beyond what's offered in
2024-03-17 13:44:39 +01: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.
In order to apply per-device config options, make a new category like this:
2022-09-24 16:03:37 +02:00
```ini
2024-02-18 16:01:40 +01:00
device {
name = ...
# options ...
2022-08-12 20:46:36 +02:00
}
```
The `name` can be easily obtained by doing `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**:
2023-06-23 14:07:27 +02:00
force_no_accel, follow_mouse, float_switch_override_focus, scroll_factor
2022-08-12 20:46:36 +02:00
2022-10-14 13:29:39 +02:00
Properties that change names:
2022-10-14 13:29:39 +02:00
```plain
2022-12-21 16:12:58 +01:00
touchdevice:transform -> transform
touchdevice:output -> output
2022-10-14 13:29:39 +02: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 16:12:58 +01:00
2022-10-27 13:58:22 +02:00
Additional properties only present in per-device configs:
2022-10-27 13:58:22 +02:00
```plain
enabled -> (only for mice / touchpads / touchdevices / keyboards) enables / disables the device (connects / disconnects from the on-screen cursor) - default: Enabled
2022-10-27 13:58:22 +02:00
```
2022-10-14 13:29:39 +02:00
Example config section:
2022-08-12 20:46:36 +02:00
2022-09-24 16:03:37 +02:00
```ini
2024-02-18 16:01:40 +01:00
device {
name = royuan-akko-multi-modes-keyboard-b
2022-08-12 20:46:36 +02:00
repeat_rate=50
repeat_delay=500
middle_button_emulation=0
}
```
{{< callout type=info >}}
Per-device layouts will by default not alter the keybind keymap, so for example with a global keymap of `us`
2023-03-28 14:57:51 +02:00
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.
2023-03-28 14:57:51 +02:00
{{< /callout >}}
## Wallpapers
2022-08-12 20:46:36 +02:00
The hyprland background you see when you first start Hyprland is **NOT A
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 13:44:39 +01:00
More can be found in [Useful Utilities](../../Useful-Utilities).
2022-08-12 20:46:36 +02:00
## Blurring layerSurfaces
2022-08-12 20:46:36 +02:00
LayerSurfaces are not windows. These are for example: Your wallpapers,
notification overlays, bars, etc.
2023-03-18 00:35:17 +01:00
If you really want to blur them, use a layerrule:
2022-08-12 20:46:36 +02:00
2022-09-24 16:03:37 +02:00
```ini
2023-03-18 00:35:17 +01:00
layerrule = blur,NAMESPACE
2023-02-25 18:41:27 +01:00
# or
2023-03-18 00:35:17 +01:00
layerrule = blur,address:0x<ADDRESS>
2022-08-12 20:46:36 +02:00
```
2023-02-25 18:41:27 +01:00
you can get the namespace / address from `hyprctl layers`.
2022-08-12 20:46:36 +02:00
To remove a layer rule (useful in dynamic situations) use:
2022-08-12 20:46:36 +02:00
2022-09-24 16:03:37 +02:00
```ini
2023-03-18 00:35:17 +01:00
layerrule = unset,<whatever you used before>
2022-08-12 20:46:36 +02:00
```
2023-03-05 14:17:08 +01:00
For example:
```ini
layerrule = unset,NAMESPACE
```
## Setting the environment
{{< callout type=info >}}
The `env` keyword works just like `exec-once`, meaning it will only fire once on
Hyprland's launch.
2023-03-05 14:17:08 +01:00
{{< /callout >}}
You can use the `env` keyword to set environment variables at Hyprland's start,
e.g.:
2023-03-05 14:17:08 +01: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
(systemd only)
2023-03-05 14:17:08 +01:00
```ini
envd = XCURSOR_SIZE,24
2023-03-17 17:27:13 +01:00
```
{{< callout >}}
Hyprland puts the raw string to the envvar. You should _not_ add quotes around
the values.
2023-03-17 17:27:13 +01:00
e.g.:
2023-03-17 17:27:13 +01:00
```ini
env = QT_QPA_PLATFORM,wayland
```
and _**NOT**_
2023-03-17 17:27:13 +01:00
```ini
env = QT_QPA_PLATFORM,"wayland"
```
{{< /callout >}}