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

feat: add new volume module

This commit is contained in:
Jake Stanger 2023-04-01 13:07:47 +01:00
parent 947c314b60
commit a70956bb3b
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
16 changed files with 1287 additions and 2 deletions

View file

@ -20,6 +20,8 @@ You also need rust; only the latest stable version is supported.
pacman -S gtk3 gtk-layer-shell
# for http support
pacman -S openssl
# for volume support
pacman -S libpulse
```
### Ubuntu/Debian
@ -28,6 +30,8 @@ pacman -S openssl
apt install build-essential libgtk-3-dev libgtk-layer-shell-dev
# for http support
apt install libssl-dev
# for volume support
apt install libpulse-dev
```
### Fedora
@ -36,6 +40,8 @@ apt install libssl-dev
dnf install gtk3-devel gtk-layer-shell-devel
# for http support
dnf install openssl-devel
# for volume support
dnf install libpulseaudio-devel
```
## Features
@ -81,6 +87,7 @@ cargo build --release --no-default-features \
| sys_info | Enables the `sys_info` module. |
| tray | Enables the `tray` module. |
| upower | Enables the `upower` module. |
| volume | Enables the `volume` module. |
| 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. |

View file

@ -34,4 +34,5 @@
- [Sys_Info](sys-info)
- [Tray](tray)
- [Upower](upower)
- [Volume](volume)
- [Workspaces](workspaces)

128
docs/modules/Volume.md Normal file
View file

@ -0,0 +1,128 @@
Displays the current volume level.
Clicking on the widget opens a volume mixer, which allows you to change the device output level,
the default playback device, and control application volume levels individually.
This requires PulseAudio to function (`pipewire-pulse` is supported).
TODO: Screenshot
## Configuration
> Type: `volume`
| Name | Type | Default | Description |
|-----------------------|----------|------------------------|----------------------------------------------------------------------------------------------------------------|
| `format` | `string` | `{icon} {percentage}%` | Format string to use for the widget button label. |
| `max_volume` | `float` | `100` | Maximum value to allow volume sliders to reach. Pulse supports values > 100 but this may result in distortion. |
| `icons.volume_high` | `string` | `󰕾` | Icon to show for high volume levels. |
| `icons.volume_medium` | `string` | `󰖀` | Icon to show for medium volume levels. |
| `icons.volume_low` | `string` | `󰕿` | Icon to show for low volume levels. |
| `icons.muted` | `string` | `󰝟` | Icon to show for muted outputs. |
<details>
<summary>JSON</summary>
```json
{
"end": [
{
"type": "volume",
"format": "{icon} {percentage}%",
"max_volume": 100,
"icons": {
"volume_high": "󰕾",
"volume_medium": "󰖀",
"volume_low": "󰕿",
"muted": "󰝟"
}
}
]
}
```
</details>
<details>
<summary>TOML</summary>
```toml
[[end]]
type = "volume"
format = "{icon} {percentage}%"
max_volume = 100
[[end.icons]]
volume_high = "󰕾"
volume_medium = "󰖀"
volume_low = "󰕿"
muted = "󰝟"
```
</details>
<details>
<summary>YAML</summary>
```yaml
end:
- type: "volume"
format: "{icon} {percentage}%"
max_volume: 100
icons:
volume_high: "󰕾"
volume_medium: "󰖀"
volume_low: "󰕿"
muted: "󰝟"
```
</details>
<details>
<summary>Corn</summary>
```corn
{
end = [
{
type = "volume"
format = "{icon} {percentage}%"
max_volume = 100
icons.volume_high = "󰕾"
icons.volume_medium = "󰖀"
icons.volume_low = "󰕿"
icons.muted = "󰝟"
}
]
}
```
</details>
### Formatting Tokens
The following tokens can be used in the `format` config option:
| Token | Description |
|----------------|-------------------------------------------|
| `{percentage}` | The active device volume percentage. |
| `{icon}` | The icon representing the current volume. |
| `{name}` | The active device name. |
## Styling
| Selector | Description |
|----------------------------------------------|----------------------------------------------------|
| `.volume` | Volume widget button. |
| `.popup-volume` | Volume popup box. |
| `.popup-volume .device-box` | Box for the device volume controls. |
| `.popup-volume .device-box .device-selector` | Default device dropdown selector. |
| `.popup-volume .device-box .slider` | Device volume slider. |
| `.popup-volume .device-box .btn-mute` | Device volume mute toggle button. |
| `.popup-volume .apps-box` | Parent box for the application volume controls. |
| `.popup-volume .apps-box .app-box` | Box for an individual application volume controls. |
| `.popup-volume .apps-box .app-box .title` | Name of the application playback stream. |
| `.popup-volume .apps-box .app-box .slider` | Application volume slider. |
| `.popup-volume .apps-box .app-box .btn-mute` | Application volume mute toggle button. |
For more information on styling, please see the [styling guide](styling-guide).