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

139 lines
2.8 KiB
Markdown
Raw 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`.
2022-10-20 22:54:34 +02:00
# Using Hyprctl
2022-08-12 20:46:36 +02:00
2022-08-13 17:00:36 +02:00
{{< hint type=warning >}}
2022-10-19 15:22:42 +02:00
_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 >}}
2022-10-19 18:14:08 +02:00
## 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.
Examples:
2022-10-19 15:22:42 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl dispatch exec kitty
hyprctl dispatch pseudo x
```
Returns: `ok` on success, an error message on fail.
2022-10-19 15:22:42 +02:00
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:
2022-10-19 15:22:42 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl keyword bind SUPER,O,pseudo
hyprctl keyword general:border_size 10
```
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
2022-10-19 15:22:42 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl setcursor Bibata-Modern-Classic 24
```
## Info
2022-10-19 15:22:42 +02:00
```sh
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
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-23 00:58:34 +02:00
For the getoption command, the option name should be in the following format:
section:option
2022-10-19 15:22:42 +02:00
```sh
hyprctl getoption section:option
```
e.g.
```sh
hyprctl getoption general:border_size
2022-10-23 00:58:34 +02:00
# Or nested
hyprctl getoption input:touchpad:disable_while_typing = bool
2022-10-19 15:22:42 +02:00
```
See [Variables](./Variables) for section and options you can use.
2022-10-19 18:14:08 +02:00
## Batch
2022-08-12 20:46:36 +02:00
You can also use `--batch` to specify a batch of commands to execute
e.g.
2022-10-19 15:22:42 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl --batch "keyword general:border_size 2 ; keyword general:gaps_out 20"
```
`;` separates the commands
2022-10-19 18:14:08 +02:00
## Flags
2022-08-12 20:46:36 +02:00
You can specify flags for the request like this:
2022-10-19 15:22:42 +02:00
```sh
2022-08-12 20:46:36 +02:00
hyprctl -j monitors
```
flag list:
2022-10-19 18:14:08 +02:00
```txt
2022-08-12 20:46:36 +02:00
j -> output in JSON
```