1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-02 19:21:03 +02:00

Merge branch 'master' into feat/volume-icon

This commit is contained in:
Reinout Meliesie 2024-06-30 18:15:15 +02:00
commit 9ea49202b3
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
55 changed files with 1161 additions and 556 deletions

View file

@ -101,6 +101,9 @@ cargo build --release --no-default-features \
| workspaces+all | Enables the `workspaces` module with support for all compositors. |
| workspaces+sway | Enables the `workspaces` module with support for Sway. |
| workspaces+hyprland | Enables the `workspaces` module with support for Hyprland. |
| **Other** | |
| schema | Enables JSON schema support and the CLI `--print-schema` flag. |
## Speeding up compiling

View file

@ -20,11 +20,18 @@ Ironbar supports a range of configuration formats, so you can pick your favourit
- `config.json`
- `config.toml`
- `config.yaml`
- `config.corn` (Experimental, includes variable support for re-using blocks.
- `config.corn` (Includes variable support for re-using blocks.
See [here](https://github.com/jakestanger/corn) for info)
You can also override the default config path using the `IRONBAR_CONFIG` environment variable.
A hosted schema is available for the latest Git version ~~and each versioned release~~.
JSON and YAML both support schema checking by adding the `$schema` key
to the top level of your config.
- master: `https://f.jstanger.dev/github/ironbar/schema.json`
- ~~release: `https://f.jstanger.dev/github/ironbar/schema-v0.16.0.json`~~ *(Not released yet)*
## 2. Pick your use-case
Ironbar gives you a few ways to configure the bar to suit your needs.
@ -288,23 +295,25 @@ The following table lists each of the top-level bar config options:
The following table lists each of the bar-level bar config options:
| Name | Type | Default | Description |
|-------------------|----------------------------------------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `name` | `string` | `bar-<n>` | A unique identifier for the bar, used for controlling it over IPC. If not set, uses a generated integer suffix. |
| `position` | `top` or `bottom` or `left` or `right` | `bottom` | The bar's position on screen. |
| `anchor_to_edges` | `boolean` | `false` | Whether to anchor the bar to the edges of the screen. Setting to false centres the bar. |
| `height` | `integer` | `42` | The bar's height in pixels. |
| `popup_gap` | `integer` | `5` | The gap between the bar and popup window. |
| `margin.top` | `integer` | `0` | The margin on the top of the bar |
| `margin.bottom` | `integer` | `0` | The margin on the bottom of the bar |
| `margin.left` | `integer` | `0` | The margin on the left of the bar |
| `margin.right` | `integer` | `0` | The margin on the right of the bar |
| `icon_theme` | `string` | `null` | Name of the GTK icon theme to use. Leave blank to use default. |
| `start_hidden` | `boolean` | `false`, or `true` if `autohide` set | Whether the bar should be hidden when the application starts. Enabled by default when `autohide` is set. |
| `autohide` | `integer` | `null` | The duration in milliseconds before the bar is hidden after the cursor leaves. Leave unset to disable auto-hide behaviour. |
| `start` | `Module[]` | `[]` | Array of left or top modules. |
| `center` | `Module[]` | `[]` | Array of center modules. |
| `end` | `Module[]` | `[]` | Array of right or bottom modules. |
| Name | Type | Default | Description |
|-------------------|------------------------------------------------|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `name` | `string` | `bar-<n>` | A unique identifier for the bar, used for controlling it over IPC. If not set, uses a generated integer suffix. |
| `position` | `top` or `bottom` or `left` or `right` | `bottom` | The bar's position on screen. |
| `anchor_to_edges` | `boolean` | `false` | Whether to anchor the bar to the edges of the screen. Setting to false centres the bar. |
| `height` | `integer` | `42` | The bar's height in pixels. |
| `margin.top` | `integer` | `0` | The margin on the top of the bar |
| `margin.bottom` | `integer` | `0` | The margin on the bottom of the bar |
| `margin.left` | `integer` | `0` | The margin on the left of the bar |
| `margin.right` | `integer` | `0` | The margin on the right of the bar |
| `layer` | `background` or `bottom` or `top` or `overlay` | `top` | The layer-shell layer to place the bar on. |
| `exclusive_zone` | `boolean` | `true` unless `start_hidden` is enabled. | Whether the bar should reserve an exclusive zone around it. |
| `popup_gap` | `integer` | `5` | The gap between the bar and popup window. |
| `icon_theme` | `string` | `null` | Name of the GTK icon theme to use. Leave blank to use default. |
| `start_hidden` | `boolean` | `false`, or `true` if `autohide` set | Whether the bar should be hidden when the application starts. Enabled by default when `autohide` is set. |
| `autohide` | `integer` | `null` | The duration in milliseconds before the bar is hidden after the cursor leaves. Leave unset to disable auto-hide behaviour. |
| `start` | `Module[]` | `[]` | Array of left or top modules. |
| `center` | `Module[]` | `[]` | Array of center modules. |
| `end` | `Module[]` | `[]` | Array of right or bottom modules. |
### 3.2 Module-level options

View file

@ -5,28 +5,38 @@ It also includes a command line interface, which can be used for interacting wit
# CLI
This is shipped as part of the `ironbar` binary. To view commands, you can use `ironbar --help`.
You can also view help per-command, for example using `ironbar set --help`.
You can also view help per sub-command or command, for example using `ironbar var --help` or `ironbar var set --help`.
Responses are handled by writing their type to stdout, followed by any value starting on the next line.
Error responses are written to stderr in the same format.
The CLI supports plaintext and JSON output. Plaintext will:
- Print `ok` for empty success responses
- Print the returned body for success responses
- Print `error` to followed by the error on the next line for error responses. This is printed to `stderr`.
Example:
```shell
$ ironbar set subject world
$ ironbar var set subject world
ok
$ ironbar get subject
ok
$ ironbar var get subject
world
$ ironbar var get foo
error
Variable not found
```
All error responses will cause the CLI to exit code 3.
# IPC
The server listens on a Unix socket.
This can usually be found at `/run/user/$UID/ironbar-ipc.sock`.
The path is printed on startup, and can usually be found at `/run/user/$UID/ironbar-ipc.sock`.
Commands and responses are sent as JSON objects, denoted by their `type` key.
Commands and responses are sent as JSON objects.
Commands will have a `command` key, and a `subcommand` key when part of a sub-command.
The message buffer is currently limited to `1024` bytes.
Particularly large messages will be truncated or cause an error.
@ -47,7 +57,7 @@ Responds with `ok`.
```json
{
"type": "ping"
"command": "ping"
}
```
@ -59,7 +69,7 @@ Responds with `ok`.
```json
{
"type": "inspect"
"command": "inspect"
}
```
@ -73,48 +83,7 @@ Responds with `ok`.
```json
{
"type": "reload"
}
```
### `get`
Gets an [ironvar](ironvars) value.
Responds with `ok_value` if the value exists, otherwise `error`.
```json
{
"type": "get",
"key": "foo"
}
```
### `set`
Sets an [ironvar](ironvars) value.
Responds with `ok`.
```json
{
"type": "set",
"key": "foo",
"value": "bar"
}
```
### list
Gets a list of all [ironvar](ironvars) values.
Responds with `ok_value`.
Each key/value pair is on its own `\n` separated newline. The key and value are separated by a colon and space `: `.
```json
{
"type": "list"
"command": "reload"
}
```
@ -126,26 +95,113 @@ Responds with `ok` if the stylesheet exists, otherwise `error`.
```json
{
"type": "load_css",
"command": "load_css",
"path": "/path/to/style.css"
}
```
### `set_visible`
### `var`
Sets a bar's visibility.
Subcommand for controlling Ironvars.
#### `get`
Gets an [ironvar](ironvars) value.
Responds with `ok_value` if the value exists, otherwise `error`.
```json
{
"command": "var",
"subcommand": "get",
"key": "foo"
}
```
#### `set`
Sets an [ironvar](ironvars) value.
Responds with `ok`.
```json
{
"command": "var",
"subcommand": "set",
"key": "foo",
"value": "bar"
}
```
#### `list`
Gets a list of all [ironvar](ironvars) values.
Responds with `ok_value`.
Each key/value pair is on its own `\n` separated newline. The key and value are separated by a colon and space `: `.
```json
{
"command": "var",
"subcommand": "list"
}
```
### `bar`
#### `show`
Forces a bar to be shown, regardless of the current visibility state.
```json
{
"command": "bar",
"subcommand": "show",
"name": "bar-123"
}
```
#### `hide`
Forces a bar to be hidden, regardless of the current visibility state.
```json
{
"command": "bar",
"subcommand": "hide",
"name": "bar-123"
}
```
#### `set_visible`
Sets a bar's visibility to one of shown/hidden.
Responds with `ok` if the bar exists, otherwise `error`.
```json
{
"type": "set_visible",
"bar_name": "bar-123",
"command": "bar",
"subcommand": "set_visible",
"name": "bar-123",
"visible": true
}
```
### `get_visible`
#### `toggle_visible`
Toggles the current visibility state of a bar between shown and hidden.
```json
{
"command": "bar",
"subcommand": "toggle_visible",
"name": "bar-123"
}
```
#### `get_visible`
Gets a bar's visibility.
@ -153,54 +209,98 @@ Responds with `ok_value` and the visibility (`true`/`false`) if the bar exists,
```json
{
"type": "get_visible",
"bar_name": "bar-123"
"command": "bar",
"subcommand": "get_visible",
"name": "bar-123"
}
```
### `toggle_popup`
Toggles the open/closed state for a module's popup.
Since each bar only has a single popup, any open popup on the bar is closed.
Responds with `ok` if the popup exists, otherwise `error`.
```json
{
"type": "toggle_popup",
"bar_name": "bar-123",
"name": "clock"
}
```
### `open_popup`
#### `show_popup`
Sets a module's popup open, regardless of its current state.
Since each bar only has a single popup, any open popup on the bar is closed.
Responds with `ok` if the popup exists, otherwise `error`.
Responds with `ok` if the bar and widget exist, otherwise `error`.
```json
{
"type": "open_popup",
"bar_name": "bar-123",
"name": "clock"
"command": "bar",
"subcommand": "show_popup",
"name": "bar-123",
"widget_name": "clock"
}
```
### `close_popup`
#### `hide_popup`
Sets the popup on a bar closed, regardless of which module it is open for.
Responds with `ok` if the popup exists, otherwise `error`.
Responds with `ok` if the bar and widget exist, otherwise `error`.
```json
{
"type": "close_popup",
"command": "bar",
"subcommand": "hide_popup",
"bar_name": "bar-123"
}
```
#### `set_popup_visible`
Sets a popup's visibility to one of shown/hidden.
Responds with `ok` if the bar and widget exist, otherwise `error`.
```json
{
"command": "bar",
"subcommand": "set_popup_visible",
"name": "bar-123",
"widget_name": "clock",
"visible": true
}
```
#### `toggle_popup`
Toggles the open/closed state for a module's popup.
Since each bar only has a single popup, any open popup on the bar is closed.
Responds with `ok` if the bar and widget exist, otherwise `error`.
```json
{
"command": "bar",
"subcommand": "toggle_popup",
"bar_name": "bar-123",
"widget_name": "clock"
}
```
#### `get_popup_visible`
Gets the popup's current visibility state.
```json
{
"command": "bar",
"subcommand": "get_popup_visible",
"bar_name": "bar-123"
}
```
#### `set_exclusive`
Sets whether the bar reserves an exclusive zone.
```json
{
"command": "bar",
"subcommand": "set_exclusive",
"exclusive": true
}
```
## Responses
### `ok`