From 983b85126e4e803ed6d764e536fa3d3e8f9088d9 Mon Sep 17 00:00:00 2001 From: Virginia Senioria <91khr@users.noreply.github.com> Date: Tue, 13 Sep 2022 15:28:48 +0800 Subject: [PATCH] feat volume: let all widgets read config to find the icons --- volume-widget/README.md | 12 +++++------- volume-widget/widgets/arc-widget.lua | 5 +++-- volume-widget/widgets/horizontal-bar-widget.lua | 3 ++- volume-widget/widgets/vertical-bar-widget.lua | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/volume-widget/README.md b/volume-widget/README.md index 4fc7f557..6aafd9fa 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -60,26 +60,24 @@ It is possible to customize the widget by providing a table with all or some of | `step` | `5` | How much the volume is raised or lowered at once (in %) | | `widget_type`| `icon_and_text`| Widget type, one of `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` | | `device` | `pulse` | Select the device name to control | +| `icon_dir`| `./icons`| Path to the folder with icons | Depends on the chosen widget type add parameters from the corresponding section below: -#### `icon` parameters - -| Name | Default | Description | -|---|---|---| -| `icon_dir`| `./icons`| Path to the folder with icons | - _Note:_ if you are changing icons, the folder should contain following .svg images: - audio-volume-high-symbolic - audio-volume-medium-symbolic - audio-volume-low-symbolic - audio-volume-muted-symbolic +#### `icon` parameters + +(None) + #### `icon_and_text` parameters | Name | Default | Description | |---|---|---| -| `icon_dir`| `./icons`| Path to the folder with icons | | `font` | `beautiful.font` | Font name and size, like `Play 12` | #### `arc` parameters diff --git a/volume-widget/widgets/arc-widget.lua b/volume-widget/widgets/arc-widget.lua index b512f127..776c04c8 100644 --- a/volume-widget/widgets/arc-widget.lua +++ b/volume-widget/widgets/arc-widget.lua @@ -13,11 +13,12 @@ function widget.get_widget(widgets_args) local bg_color = args.bg_color or '#ffffff11' local mute_color = args.mute_color or beautiful.fg_urgent local size = args.size or 18 + local icon_dir = args.icon_dir or ICON_DIR return wibox.widget { { id = "icon", - image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + image = icon_dir .. 'audio-volume-high-symbolic.svg', resize = true, widget = wibox.widget.imagebox, }, @@ -43,4 +44,4 @@ function widget.get_widget(widgets_args) end -return widget \ No newline at end of file +return widget diff --git a/volume-widget/widgets/horizontal-bar-widget.lua b/volume-widget/widgets/horizontal-bar-widget.lua index be1f38d2..d215aa73 100644 --- a/volume-widget/widgets/horizontal-bar-widget.lua +++ b/volume-widget/widgets/horizontal-bar-widget.lua @@ -16,12 +16,13 @@ function widget.get_widget(widgets_args) local margins = args.margins or 10 local shape = args.shape or 'bar' local with_icon = args.with_icon == true and true or false + local icon_dir = args.icon_dir or ICON_DIR local bar = wibox.widget { { { id = "icon", - image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + image = icon_dir .. 'audio-volume-high-symbolic.svg', resize = false, widget = wibox.widget.imagebox, }, diff --git a/volume-widget/widgets/vertical-bar-widget.lua b/volume-widget/widgets/vertical-bar-widget.lua index 6f32b50d..1dca911c 100644 --- a/volume-widget/widgets/vertical-bar-widget.lua +++ b/volume-widget/widgets/vertical-bar-widget.lua @@ -16,12 +16,13 @@ function widget.get_widget(widgets_args) local margins = args.height or 2 local shape = args.shape or 'bar' local with_icon = args.with_icon == true and true or false + local icon_dir = args.icon_dir or ICON_DIR local bar = wibox.widget { { { id = "icon", - image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + image = icon_dir .. 'audio-volume-high-symbolic.svg', resize = false, widget = wibox.widget.imagebox, },