diff options
| author | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-05-03 15:23:12 -0400 | 
|---|---|---|
| committer | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-05-03 15:23:12 -0400 | 
| commit | f77df958104badf284061603e4e945b32ac6aeb6 (patch) | |
| tree | c5baa0866a94db6ec3b67ec58895a375f3de4d21 /volumearc-widget | |
| parent | 768b979f87fb374b607075651591425bbcda9dd6 (diff) | |
| parent | 429e6eb54a5bab17d7adba8956fcbc0a63257ed5 (diff) | |
fix conflicts
Diffstat (limited to 'volumearc-widget')
| -rw-r--r-- | volumearc-widget/README.md | 72 | ||||
| -rw-r--r-- | volumearc-widget/custom.png | bin | 0 -> 9424 bytes | |||
| -rw-r--r-- | volumearc-widget/volumearc.lua | 9 | 
3 files changed, 51 insertions, 30 deletions
diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 79f519d..0bcd7c7 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,7 +2,43 @@  Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -{:.center-image} + + +Supports  + - scroll up - increase volume,  + - scroll down - decrease volume,  + - left click - mute/unmute. + +## Customization + +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 arc | +| `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 | +| `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%-` | Descrease volume level | +| `tog_volume_cmd` | `amixer -D pulse sset Master toggle` | Mute / unmute | + +### Example: + +```lua +volumearc_widget({ +    main_color = '#af13f7', +    mute_color = '#ff0000', +    thickness = 5, +    height = 25 +}) +``` + +Above config results in following widget: + +   ## Installation @@ -14,27 +50,13 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm  1. Require volumearc widget at the beginning of **rc.lua**: -    ```lua -    local volumearc_widget = require("awesome-wm-widgets.volumearc-widget.volumearc") -    ``` - -1. Add widget to the tasklist: - -    ```lua -    s.mytasklist, -- Middle widget -        { -- Right widgets -            layout = wibox.layout.fixed.horizontal, -            ... -            --[[default]] -            volumearc_widget(), -            --[[or customized]] -            volumearc_widget({ -                main_color = '#0000ff', -                mute_color = '#ff0000', -                path_to_icon = '/usr/share/icons/Arc/actions/symbolic/view-grid-symbolic.svg', -                thickness = 5, -                height = 25 -            }), - -            ... -    ```
\ No newline at end of file +```lua +require("volumearc") +... +s.mytasklist, -- Middle widget +	{ -- Right widgets +    	layout = wibox.layout.fixed.horizontal, +		... +		volumearc_widget, +		... +``` diff --git a/volumearc-widget/custom.png b/volumearc-widget/custom.png Binary files differnew file mode 100644 index 0000000..f187345 --- /dev/null +++ b/volumearc-widget/custom.png diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 4a91cd3..62b18ab 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -27,8 +27,8 @@ local function worker(args)      local args = args or {} -    local main_color = args.main_color or beautiful.widget_main_color -    local mute_color = args.mute_color or beautiful.widget_red +    local main_color = args.main_color or beautiful.fg_color +    local mute_color = args.mute_color or beautiful.fg_urgent      local path_to_icon = args.path_to_icon or PATH_TO_ICON      local thickness = args.thickness or 2      local height = args.height or 18 @@ -38,7 +38,6 @@ local function worker(args)      local dec_volume_cmd = args.dec_volume_cmd or DEC_VOLUME_CMD      local tog_volume_cmd = args.tog_volume_cmd or TOG_VOLUME_CMD -      local icon = {          id = "icon",          image = path_to_icon, @@ -59,8 +58,8 @@ local function worker(args)      }      local update_graphic = function(widget, stdout, _, _, _) -        local mute = string.match(stdout, "%[(o%D%D?)%]") -        local volume = string.match(stdout, "(%d?%d?%d)%%") +        local mute = string.match(stdout, "%[(o%D%D?)%]")   -- \[(o\D\D?)\] - [on] or [off] +        local volume = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%)          volume = tonumber(string.format("% 3d", volume))          widget.value = volume / 100;  | 
