awesome-wm-widgets/_widgets/volumearc-widget.md

73 lines
2.4 KiB
Markdown
Raw Normal View History

2018-09-15 23:33:42 +02:00
---
layout: page
---
# Volumearc widget
2020-11-15 03:26:34 +01:00
Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using [arcchart](https://awesomewm.org/doc/api/classes/wibox.container.arcchart.html):
2018-09-15 23:33:42 +02:00
2019-12-15 21:38:54 +01:00
![screenshot](../awesome-wm-widgets/assets/img/screenshots/volumearc-widget/out.gif)
2018-09-15 23:33:42 +02:00
2019-12-15 21:38:54 +01:00
Supports
- scroll up - increase volume,
- scroll down - decrease volume,
- left click - mute/unmute.
2018-09-15 23:33:42 +02:00
2019-12-15 21:38:54 +01:00
## Customization
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
It is possible to customize widget by providing a table with all or some of the following config parameters:
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
| Name | Default | Description |
|---|---|---|
| `main_color` | `beautiful.fg_normal` | Color of the arc |
2020-03-02 03:40:04 +01:00
| `bg_color` | `#ffffff11` | Color of the arc's background |
2019-12-15 21:38:54 +01:00
| `mute_color` | `beautiful.fg_urgent` | Color of the arc when mute |
| `path_to_icon` | /usr/share/icons/Arc/status/symbolic/audio-volume-muted-symbolic.svg | Path to the icon |
| `thickness` | 2 | The arc thickness |
| `height` | `beautiful.fg_normal` | Widget height |
2020-11-15 03:26:34 +01:00
| `timeout` | 1 | How often in seconds the widget refreshes |
2019-12-15 21:38:54 +01:00
| `get_volume_cmd` | `amixer -D pulse sget Master` | Get current volume level |
| `inc_volume_cmd` | `amixer -D pulse sset Master 5%+` | Increase volume level |
| `dec_volume_cmd` | `amixer -D pulse sset Master 5%-` | Decrease volume level |
| `tog_volume_cmd` | `amixer -D pulse sset Master toggle` | Mute / unmute |
2020-07-14 17:01:04 +02:00
| `button_press` | `function(_, _, _, button) <sane default logic> end` | Overwrite the 'button\_press' signal for this widget |
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
### Example:
```lua
volumearc_widget({
main_color = '#af13f7',
mute_color = '#ff0000',
thickness = 5,
2020-07-14 17:01:04 +02:00
height = 25,
button_press = function(_, _, _, button) -- Overwrites the button press behaviour to open pavucontrol when clicked
if (button == 1) then awful.spawn('pavucontrol --tab=3', false)
end
end
2019-12-15 21:38:54 +01:00
})
```
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
The config above results in the following widget:
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
![custom](../awesome-wm-widgets/assets/img/screenshots/volumearc-widget/custom.png)
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
## Installation
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
1. Clone this repo under **~/.config/awesome/**
2018-09-25 01:18:45 +02:00
2019-12-15 21:38:54 +01:00
```bash
2020-05-01 02:58:02 +02:00
git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/awesome-wm-widgets
2019-12-15 21:38:54 +01:00
```
1. Require volumearc widget at the beginning of **rc.lua**:
2018-09-15 23:33:42 +02:00
```lua
2020-05-01 02:58:02 +02:00
local volumearc_widget = require("awesome-wm-widgets.volumearc-widget.volumearc")
2019-12-15 21:38:54 +01:00
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
2020-08-17 23:05:56 +02:00
volumearc_widget(),
2019-12-15 21:38:54 +01:00
...
2018-09-15 23:33:42 +02:00
```