hyprland-wiki/pages/Configuring/Using-hyprctl.md

233 lines
5.5 KiB
Markdown
Raw Permalink Normal View History

2022-08-12 20:46:36 +02:00
`hyprctl` is a utility for controlling some parts of the compositor from a CLI
or a script. If you install with `make install`, or any package, it should
automatically be installed.
To check if `hyprctl` is installed, simply execute it by issuing `hyprctl` in
the terminal.
If it's not, go to the repo root and `/hyprctl`. Issue a `make all` and then
`sudo cp ./hyprctl /usr/bin`.
# Using Hyprctl
2022-08-12 20:46:36 +02:00
2022-08-13 17:00:36 +02:00
{{< hint type=warning >}}
_hyprctl_ calls will be dispatched by the compositor _synchronously_,
2022-08-13 17:00:36 +02:00
meaning any spam of the utility will cause slowdowns.
It's recommended to use `--batch` for many control calls, and
limiting the amount of info calls.
For live event handling, see the [socket2](../../IPC/).
{{< /hint >}}
## Commands
2022-08-12 20:46:36 +02:00
### Dispatch
issue a `dispatch` to call a keybind dispatcher with an arg.
An arg has to be present, for dispatchers without parameters it can be anything.
To pass an argument starting with `-` or `--`, such as command line options to
`exec` programs, pass `--` as an option. This will disable any subsequent
parsing of options by _hyprctl_.
2022-08-12 20:46:36 +02:00
Examples:
```sh
2022-08-12 20:46:36 +02:00
hyprctl dispatch exec kitty
hyprctl dispatch -- exec kitty --single-instance
2022-08-12 20:46:36 +02:00
hyprctl dispatch pseudo x
```
Returns: `ok` on success, an error message on fail.
See [Dispatchers](../Dispatchers) for a list of dispatchers.
2022-08-12 20:46:36 +02:00
### Keyword
issue a `keyword` to call a config keyword dynamically.
Examples:
```sh
2022-08-12 20:46:36 +02:00
hyprctl keyword bind SUPER,O,pseudo
hyprctl keyword general:border_size 10
2023-01-05 14:37:13 +01:00
hyprctl keyword monitor DP-3,1920x1080@144,0x0,1
2022-08-12 20:46:36 +02:00
```
Returns: `ok` on success, an error message on fail.
### Reload
issue a `reload` to force reload the config.
### kill
issue a `kill` to get into a kill mode, where you can kill an app by clicking on
it. You can exit it with ESCAPE.
Kind of like xkill.
### setcursor
2022-08-13 01:47:48 +02:00
Sets the cursor theme and reloads the cursor manager. Will set the theme for
everything except GTK, because GTK.
2022-08-12 20:46:36 +02:00
params: theme and size
e.g.:
2022-08-13 01:47:48 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl setcursor Bibata-Modern-Classic 24
```
2022-11-05 19:09:03 +01:00
### output
Allows you to add and remove fake outputs to your preferred backend.
params: `create` or `remove` and `backend` or `name` respectively.
For _create_:
pass a backend name: `wayland`, `x11`, `headless` or `auto`. On a _real_ hyprland
session, if you're looking for a VNC / RDP type thing, it's 99% going to be `headless`.
For _remove_:
pass the output's name, as found in `hyprctl monitors`. Please be aware you are _not_
allowed to remove real displays with this command.
e.g.:
```ini
# will create a 1920x1080 headless display, for example to use with RDP.
hyprctl output create headless
# will remove the above display, provided its name was HEADLESS-1
hyprctl output remove HEADLESS-1
```
### switchxkblayout
2022-12-03 16:59:13 +01:00
Sets the xkb layout index for a keyboard.
For example, if you set:
```ini
device:my-epic-keyboard-v1 {
2022-12-17 23:41:47 +01:00
kb_layout=us,pl,de
2022-12-03 16:59:13 +01:00
}
```
You can use this command to switch between them.
```
hyprctl switchxkblayout [DEVICE] [CMD]
2022-12-03 16:59:13 +01:00
```
where `CMD` is either `next` for next, `prev` for previous, or `ID`
for a specific one (in the above case, `us`: 0, `pl`: 1, `de`: 2)
2023-01-24 20:14:39 +01:00
### seterror
Sets the hyprctl error string. Will reset when Hyprland's config is reloaded.
```sh
hyprctl seterror rgba(66ee66ff) hello world this is my problem
```
or disable:
```sh
hyprctl seterror disable
```
### setprop
Sets a window prop. Can be locked by adding `lock` at the end. If `lock` is not added,
will be unlocked. Locking means a dynamic windowrule _cannot_ override this setting.
Prop List:
| prop | comment |
| --- | --- |
| animationstyle | string, cannot be locked |
| rounding | int, -1 means not overriden |
| forcenoblur | 0/1 |
| forceopaque | 0/1|
| forceopaqueoverriden | 0/1 |
| forceallowsinput | 0/1, forceinput rule |
| forcenoanims | 0/1 |
| forcenoborder | 0/1 |
| forcenoshadow | 0/1 |
| windowdancecompat | 0/1 |
| nomaxsize | 0/1 |
| dimaround | 0/1 |
| alphaoverride | 0/1, makes the next setting be override instead of multiply |
| alpha | float 0.0 - 1.0 |
| alphainactiveoverride | 0/1, makes the next setting be override instead of multiply |
| alphainactive | float 0.0 - 1.0 |
| activebordercolor | color, -1 means not set |
| inactivebordercolor | color, -1 means not set |
2023-01-24 20:14:39 +01:00
2023-01-24 20:16:22 +01:00
```sh
hyprctl setprop address:0x13371337 forcenoanims 1 lock # with locking
hyprctl setprop address:0x13371337 nomaxsize 0 # without locking
```
2022-08-12 20:46:36 +02:00
## Info
2022-10-26 14:20:18 +02:00
```plain
2022-08-12 20:46:36 +02:00
version - prints the hyprland version, meaning flags, commit and branch of build.
monitors - lists all the outputs with their properties
workspaces - lists all workspaces with their properties
clients - lists all windows with their properties
devices - lists all connected keyboards and mice
2023-01-06 14:33:14 +01:00
binds - lists all registered binds
2022-08-12 20:46:36 +02:00
activewindow - gets the active window name
layers - lists all the layers
splash - prints the current random splash
getoption [option] - gets the config option status (values)
2022-10-26 14:20:18 +02:00
cursorpos - gets the current cursor pos in global layout coordinates
2023-01-25 16:17:15 +01:00
animations - gets the current config'd info about animations and beziers
2022-08-12 20:46:36 +02:00
```
For the getoption command, the option name should be written as `section:option`,
e.g.:
```sh
hyprctl getoption general:border_size
# For nested sections:
hyprctl getoption input:touchpad:disable_while_typing
```
See [Variables](../Variables) for section and options you can use.
## Batch
2022-08-12 20:46:36 +02:00
You can also use `--batch` to specify a batch of commands to execute
e.g.
```sh
2022-08-12 20:46:36 +02:00
hyprctl --batch "keyword general:border_size 2 ; keyword general:gaps_out 20"
```
`;` separates the commands
## Flags
2022-08-12 20:46:36 +02:00
You can specify flags for the request like this:
```sh
2022-08-12 20:46:36 +02:00
hyprctl -j monitors
```
flag list:
```txt
2022-08-12 20:46:36 +02:00
j -> output in JSON
```