awesome-wm-widgets/volumebar-widget/README.md

85 lines
2.5 KiB
Markdown
Raw Normal View History

2017-09-06 20:00:29 +02:00
# Volumebar widget
Almost the same as volume widget, but more minimalistic:
2019-12-15 21:55:38 +01:00
![screenshot](./out.gif)
2017-09-06 20:00:29 +02:00
Supports
- scroll up - increase volume,
- scroll down - decrease volume,
- left click - mute/unmute.
2019-04-15 02:07:15 +02:00
## Customization
2017-09-06 20:00:29 +02:00
2019-04-15 02:07:15 +02:00
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
| `main_color` | `beautiful.fg_normal` | Color of the bar |
| `bg_color` | `#ffffff11` | Color of the bar's background |
2019-04-15 02:07:15 +02:00
| `mute_color` | `beautiful.fg_urgent` | Color of the bar when mute |
| `width` | 50 | The bar width |
| `shape` | `bar` | [gears.shape](https://awesomewm.org/doc/api/libraries/gears.shape.html), could be `octogon`, `hexagon`, `powerline`, etc |
| `margin` | `10` | Top and bottom margin (if your wibar is 22 px high, bar will be 2 px (22 - 2*10)) |
| `get_volume_cmd` | `amixer -D pulse sget Master` | Get current volume level |
| `inc_volume_cmd` | `amixer -D pulse sset Master 5%+` | Increase volume level |
2019-10-07 03:37:35 +02:00
| `dec_volume_cmd` | `amixer -D pulse sset Master 5%-` | Decrease volume level |
2019-04-15 02:07:15 +02:00
| `tog_volume_cmd` | `amixer -D pulse sset Master toggle` | Mute / unmute |
### Example:
2017-09-06 20:00:29 +02:00
```lua
2019-04-14 04:44:47 +02:00
volumebar_widget({
main_color = '#af13f7',
mute_color = '#ff0000',
width = 80,
2019-04-15 02:07:15 +02:00
shape = 'rounded_bar',
2019-04-14 04:44:47 +02:00
margins = 8
})
2017-09-06 20:00:29 +02:00
```
2017-10-21 03:37:49 +02:00
2019-04-14 04:44:47 +02:00
Above config results in following widget:
![custom](./custom.png)
2019-04-15 02:07:15 +02:00
## Installation
2019-04-14 04:44:47 +02:00
1. Clone this repo under **~/.config/awesome/**
```bash
git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/
```
1. Require volumebar widget at the beginning of **rc.lua**:
```lua
local volumebar_widget = require("awesome-wm-widgets.volumebar-widget.volumebar")
```
1. Add widget to the tasklist:
```lua
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
--[[default]]
volumebar_widget(),
--[[or customized]]
volumebar_widget({
main_color = '#af13f7',
mute_color = '#ff0000',
width = 80,
shape = 'rounded_bar', -- octogon, hexagon, powerline, etc
-- bar's height = wibar's height minus 2x margins
margins = 8
}),
...
```
2017-10-21 03:37:49 +02:00
## Troubleshooting
If the bar is not showing up, try to decrease top or bottom margin - widget uses hardcoded margins for vertical alignment, so if your wibox is too small then bar is simply hidden by the margins.