From 75c195782d7d4ad7f4707e0ac53dd1439ae344e5 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 30 Mar 2019 17:42:59 -0400 Subject: [PATCH 01/12] volumearc - externalize config --- volumearc-widget/README.md | 49 ++++++++++++------- volumearc-widget/volumearc.lua | 89 +++++++++++++++++++++------------- 2 files changed, 87 insertions(+), 51 deletions(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 702b486..79f519d 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,24 +2,39 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -![screenshot](out.gif) - -Supports: - - scroll up - increase volume, - - scroll down - decrease volume, - - left click - mute/unmute. +![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} ## Installation -Clone repo, include widget and use it in **rc.lua**: +1. Clone this repo under **~/.config/awesome/** -```lua -require("volumearc") -... -s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - ... - volumearc_widget, - ... -``` + ```bash + git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/ + ``` + +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 diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 63500bc..4a91cd3 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -21,47 +21,68 @@ local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/audio-volume-muted-symbolic.svg" -local icon = { - id = "icon", - image = PATH_TO_ICON, - resize = true, - widget = wibox.widget.imagebox, -} +local widget = {} -local volumearc = wibox.widget { - icon, - max_value = 1, - thickness = 2, - start_angle = 4.71238898, -- 2pi*3/4 - forced_height = 18, - forced_width = 18, - bg = "#ffffff11", - paddings = 2, - widget = wibox.container.arcchart -} +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)%%") - volume = tonumber(string.format("% 3d", volume)) + local args = args or {} - widget.value = volume / 100; - widget.colors = mute == 'off' and { beautiful.widget_red } - or { beautiful.widget_main_color } + local main_color = args.main_color or beautiful.widget_main_color + local mute_color = args.mute_color or beautiful.widget_red + local path_to_icon = args.path_to_icon or PATH_TO_ICON + local thickness = args.thickness or 2 + local height = args.height or 18 -end + local get_volume_cmd = args.get_volume_cmd or GET_VOLUME_CMD + local inc_volume_cmd = args.inc_volume_cmd or INC_VOLUME_CMD + local dec_volume_cmd = args.dec_volume_cmd or DEC_VOLUME_CMD + local tog_volume_cmd = args.tog_volume_cmd or TOG_VOLUME_CMD -volumearc:connect_signal("button::press", function(_, _, _, button) - if (button == 4) then awful.spawn(INC_VOLUME_CMD, false) - elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD, false) - elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD, false) + + local icon = { + id = "icon", + image = path_to_icon, + resize = true, + widget = wibox.widget.imagebox, + } + + local volumearc = wibox.widget { + icon, + max_value = 1, + thickness = thickness, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = height, + forced_width = height, + bg = "#ffffff11", + paddings = 2, + widget = wibox.container.arcchart + } + + local update_graphic = function(widget, stdout, _, _, _) + local mute = string.match(stdout, "%[(o%D%D?)%]") + local volume = string.match(stdout, "(%d?%d?%d)%%") + volume = tonumber(string.format("% 3d", volume)) + + widget.value = volume / 100; + widget.colors = mute == 'off' + and { mute_color } + or { main_color } end - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) - update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + volumearc:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then awful.spawn(inc_volume_cmd, false) + elseif (button == 5) then awful.spawn(dec_volume_cmd, false) + elseif (button == 1) then awful.spawn(tog_volume_cmd, false) + end + + spawn.easy_async(get_volume_cmd, function(stdout, stderr, exitreason, exitcode) + update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + end) end) -end) -watch(GET_VOLUME_CMD, 1, update_graphic, volumearc) + watch(get_volume_cmd, 1, update_graphic, volumearc) -return volumearc \ No newline at end of file + return volumearc +end + +return setmetatable(widget, { __call = function(_, ...) return worker(...) end }) From c06b09703181954387d0e2dddca9680e3c36e21c Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 30 Mar 2019 17:42:59 -0400 Subject: [PATCH 02/12] volumearc - externalize config --- volumearc-widget/README.md | 49 ++++++++++++------- volumearc-widget/volumearc.lua | 89 +++++++++++++++++++++------------- 2 files changed, 87 insertions(+), 51 deletions(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 702b486..79f519d 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,24 +2,39 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -![screenshot](out.gif) - -Supports: - - scroll up - increase volume, - - scroll down - decrease volume, - - left click - mute/unmute. +![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} ## Installation -Clone repo, include widget and use it in **rc.lua**: +1. Clone this repo under **~/.config/awesome/** -```lua -require("volumearc") -... -s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - ... - volumearc_widget, - ... -``` + ```bash + git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/ + ``` + +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 diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 63500bc..4a91cd3 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -21,47 +21,68 @@ local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/audio-volume-muted-symbolic.svg" -local icon = { - id = "icon", - image = PATH_TO_ICON, - resize = true, - widget = wibox.widget.imagebox, -} +local widget = {} -local volumearc = wibox.widget { - icon, - max_value = 1, - thickness = 2, - start_angle = 4.71238898, -- 2pi*3/4 - forced_height = 18, - forced_width = 18, - bg = "#ffffff11", - paddings = 2, - widget = wibox.container.arcchart -} +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)%%") - volume = tonumber(string.format("% 3d", volume)) + local args = args or {} - widget.value = volume / 100; - widget.colors = mute == 'off' and { beautiful.widget_red } - or { beautiful.widget_main_color } + local main_color = args.main_color or beautiful.widget_main_color + local mute_color = args.mute_color or beautiful.widget_red + local path_to_icon = args.path_to_icon or PATH_TO_ICON + local thickness = args.thickness or 2 + local height = args.height or 18 -end + local get_volume_cmd = args.get_volume_cmd or GET_VOLUME_CMD + local inc_volume_cmd = args.inc_volume_cmd or INC_VOLUME_CMD + local dec_volume_cmd = args.dec_volume_cmd or DEC_VOLUME_CMD + local tog_volume_cmd = args.tog_volume_cmd or TOG_VOLUME_CMD -volumearc:connect_signal("button::press", function(_, _, _, button) - if (button == 4) then awful.spawn(INC_VOLUME_CMD, false) - elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD, false) - elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD, false) + + local icon = { + id = "icon", + image = path_to_icon, + resize = true, + widget = wibox.widget.imagebox, + } + + local volumearc = wibox.widget { + icon, + max_value = 1, + thickness = thickness, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = height, + forced_width = height, + bg = "#ffffff11", + paddings = 2, + widget = wibox.container.arcchart + } + + local update_graphic = function(widget, stdout, _, _, _) + local mute = string.match(stdout, "%[(o%D%D?)%]") + local volume = string.match(stdout, "(%d?%d?%d)%%") + volume = tonumber(string.format("% 3d", volume)) + + widget.value = volume / 100; + widget.colors = mute == 'off' + and { mute_color } + or { main_color } end - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) - update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + volumearc:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then awful.spawn(inc_volume_cmd, false) + elseif (button == 5) then awful.spawn(dec_volume_cmd, false) + elseif (button == 1) then awful.spawn(tog_volume_cmd, false) + end + + spawn.easy_async(get_volume_cmd, function(stdout, stderr, exitreason, exitcode) + update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + end) end) -end) -watch(GET_VOLUME_CMD, 1, update_graphic, volumearc) + watch(get_volume_cmd, 1, update_graphic, volumearc) -return volumearc \ No newline at end of file + return volumearc +end + +return setmetatable(widget, { __call = function(_, ...) return worker(...) end }) From 7128c2740b9db4034610a84099a0d771bbed4567 Mon Sep 17 00:00:00 2001 From: Jakub Podlaha Date: Tue, 9 Apr 2019 15:13:54 +0200 Subject: [PATCH 03/12] fix: mpdarc is not a wigdet --- mpdarc-widget/mpdarc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua index ca0f411..d70e6ee 100644 --- a/mpdarc-widget/mpdarc.lua +++ b/mpdarc-widget/mpdarc.lua @@ -111,7 +111,7 @@ mpdarc:connect_signal("mouse::leave", function() naughty.destroy(notification) e watch(GET_MPD_CMD, 1, update_graphic, mpdarc) -local mpdarc_widget = { +local mpdarc_widget = wibox.widget{ mpdarc_icon_widget, mpdarc_current_song_widget, layout = wibox.layout.align.horizontal, From 93ef029bdbcc1a1f6de927b1351d7169ba9b698e Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 13 Apr 2019 20:51:54 -0400 Subject: [PATCH 04/12] update volumearc readme --- volumearc-widget/README.md | 24 +++++++++++++++++++++--- volumearc-widget/custom.png | Bin 0 -> 9424 bytes volumearc-widget/volumearc.lua | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 volumearc-widget/custom.png diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 79f519d..5bd8e83 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -4,6 +4,24 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm ![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +```lua +volumearc_widget({ + main_color = '#af13f7', + mute_color = '#ff0000', + path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', + thickness = 5, + height = 25 +}) +``` + +Above config results in following widget: + +![custom](./custom.png) + ## Installation 1. Clone this repo under **~/.config/awesome/** @@ -29,12 +47,12 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm volumearc_widget(), --[[or customized]] volumearc_widget({ - main_color = '#0000ff', + main_color = '#af13f7', mute_color = '#ff0000', - path_to_icon = '/usr/share/icons/Arc/actions/symbolic/view-grid-symbolic.svg', + path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', thickness = 5, height = 25 }), ... - ``` \ No newline at end of file + ``` diff --git a/volumearc-widget/custom.png b/volumearc-widget/custom.png new file mode 100644 index 0000000000000000000000000000000000000000..f1873452f33ce862bdbe3fdf48f070f504717acb GIT binary patch literal 9424 zcmV;>Brn^EP)^geT+3kzw6g4W zVT-yJ&9D@;9T25K69uA7kr1Fl0vRfEDwRrVOiiy|z2Tegy=U0{$N9eV&b#kbEJ+|) zcJ`|E*7x1-4EyZ;+r!!C+yu|O_!aQtqto>T=l8DMm~S1|r`*5dOSeyc(lJ|Ov@zD& z7n-~O$aL(`;pfs_K3{x1Uv!$;`ljQ*yuN>S{16ERpb$xtCf3-zC|*L<_lc}7pG)@_ z7oM)}{M^;YZ$zeNX(Oa)h$dNxn+gQS<|uRB>V4Jl0%rCvn#@Djm`#6LCN_>Ud?<;ue&*`7N`Zr+*PJ134o z+X*StBq6cL0J1DIrpwGfKxSW}XQLMdp04QrRL!>HC*K+W{O4OAw`d068JyNy>nux? zBnizBF-ek_qTY*#UU)na(8crD#7`b;ZTqK@k1!0p&g80<^;+%7(W!o(=XpU$G758v zQYVimBs%}~S50hO?~Fyl`J>0~`=@_dw&i)Rze?xDjytw3GYI03zULRqUjL3i|C^JX zw?eg%)?|K9GaHf=ob z+N+*<`0>Vtqv7FQpT5O^SiNQQ*{^-oi4=VAEw?)70H8Us;zxezrd{9uPHm*M;rw&I z`jJ0n=SYax{pv66d+^cz+U-$GK55GqUWx%t*JF1uvq#`WxYY|ZM!Pd>Hh-Us5w8!tTXz$1_M=jS(Ec<$U+ zjs}73-TsiuvaH#dJACxvuiUP(^qOCJ=b;@>j;vm_?XN#$hSd!uyz`TvN$T}eFWkD6 zH+>x~q2I z^FVE+wRFH|pKd{7NJ*ATrG%77$d0WsMr%X@SX2mn-u%<5O&gi{-dk?{_jYW$@%ZbJ zbhrQTvp@Bg@bHRPUAANAuE%yhIXcpsott;g0xaMO5#i)$=9xps_UyarT|W=Z0B~@} zlaJnZ2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kWRu|8j3W+t#C5@PDzVBxC>>yd!{# z)I3~Rq}qx>S9HLHj@iFoV1XSo5Xvl>+qD;ZeJKf)B zNE2~UCb5*_W)-%VA}=0oSp+Y|@dEOM(Cv<%?Tlm21~AmKlhoLKMycf*`3F1*7ObeLyj$NrINOL?Z6LJl zm=F+El6XFdnXR)70D_uhqm5QGM3#8s6M@MXN-4!rTEom4iKKLVXlBEkF5mc}cVv^}y#q&Axb(>JnG{B9 z9V@e}X(W*-8f5Ikp=>O78Xf~wLf*1LkfXFR=D*UoqTrCeR8SZ%IdnwC(rH;*SkYW{ z)+XniNE2iLYr^=kvw`SBU!W6#$qmZ^u>%XMv%~jMVR6m}QrMBKRY2M4v2`%s>^}J9 zq3=A{8XMJG`}VzFuPjTIrR3NEaUByVof)k&q1T)*wD{V0mSxU46eN_Ci4sbpAphC| z3Q7_Qy^hXYEt4gjz^{RvDH?3dtRw8VMHJ^wLF6*KT7_;*u7Gp_<`ZFpPN zIX5_iPm;k4u80Tr?eA@S)U6&JP3r~Qkw()oPqao!k^lx>lvqnevxWxz=rQ*gz0V&n z##^(sHg^U~!^{eWsAsv=#m;>YT`Oj0WbiQ~s4Ad`qrzsqVT{cvR=_|p+K!*MC9BuU z`L2^>BuOOJ);3Tz(k7~uC0JKjEwW71n-%92f(0zemvMMLjf-F5^3Yj&GQ-hk4WpFH zFEHNz_yu~$ztmGAA`qFmepeUcoaUJrzx=|)A@_>-|5{MV2OyOjZg}1J51q}rEVV|% z%nV8*V%UEL7*X^}*3tus_%jUCz6BGKqF)weS(238>mB&(e<_>7IhR{)N{v!rY5pIK Wpls~|uXn2e0000 Date: Sat, 30 Mar 2019 17:42:59 -0400 Subject: [PATCH 05/12] volumearc - externalize config --- volumearc-widget/README.md | 49 ++++++++++++------- volumearc-widget/volumearc.lua | 89 +++++++++++++++++++++------------- 2 files changed, 87 insertions(+), 51 deletions(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 702b486..79f519d 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,24 +2,39 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -![screenshot](out.gif) - -Supports: - - scroll up - increase volume, - - scroll down - decrease volume, - - left click - mute/unmute. +![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} ## Installation -Clone repo, include widget and use it in **rc.lua**: +1. Clone this repo under **~/.config/awesome/** -```lua -require("volumearc") -... -s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - ... - volumearc_widget, - ... -``` + ```bash + git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/ + ``` + +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 diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 63500bc..4a91cd3 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -21,47 +21,68 @@ local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/audio-volume-muted-symbolic.svg" -local icon = { - id = "icon", - image = PATH_TO_ICON, - resize = true, - widget = wibox.widget.imagebox, -} +local widget = {} -local volumearc = wibox.widget { - icon, - max_value = 1, - thickness = 2, - start_angle = 4.71238898, -- 2pi*3/4 - forced_height = 18, - forced_width = 18, - bg = "#ffffff11", - paddings = 2, - widget = wibox.container.arcchart -} +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)%%") - volume = tonumber(string.format("% 3d", volume)) + local args = args or {} - widget.value = volume / 100; - widget.colors = mute == 'off' and { beautiful.widget_red } - or { beautiful.widget_main_color } + local main_color = args.main_color or beautiful.widget_main_color + local mute_color = args.mute_color or beautiful.widget_red + local path_to_icon = args.path_to_icon or PATH_TO_ICON + local thickness = args.thickness or 2 + local height = args.height or 18 -end + local get_volume_cmd = args.get_volume_cmd or GET_VOLUME_CMD + local inc_volume_cmd = args.inc_volume_cmd or INC_VOLUME_CMD + local dec_volume_cmd = args.dec_volume_cmd or DEC_VOLUME_CMD + local tog_volume_cmd = args.tog_volume_cmd or TOG_VOLUME_CMD -volumearc:connect_signal("button::press", function(_, _, _, button) - if (button == 4) then awful.spawn(INC_VOLUME_CMD, false) - elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD, false) - elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD, false) + + local icon = { + id = "icon", + image = path_to_icon, + resize = true, + widget = wibox.widget.imagebox, + } + + local volumearc = wibox.widget { + icon, + max_value = 1, + thickness = thickness, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = height, + forced_width = height, + bg = "#ffffff11", + paddings = 2, + widget = wibox.container.arcchart + } + + local update_graphic = function(widget, stdout, _, _, _) + local mute = string.match(stdout, "%[(o%D%D?)%]") + local volume = string.match(stdout, "(%d?%d?%d)%%") + volume = tonumber(string.format("% 3d", volume)) + + widget.value = volume / 100; + widget.colors = mute == 'off' + and { mute_color } + or { main_color } end - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) - update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + volumearc:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then awful.spawn(inc_volume_cmd, false) + elseif (button == 5) then awful.spawn(dec_volume_cmd, false) + elseif (button == 1) then awful.spawn(tog_volume_cmd, false) + end + + spawn.easy_async(get_volume_cmd, function(stdout, stderr, exitreason, exitcode) + update_graphic(volumearc, stdout, stderr, exitreason, exitcode) + end) end) -end) -watch(GET_VOLUME_CMD, 1, update_graphic, volumearc) + watch(get_volume_cmd, 1, update_graphic, volumearc) -return volumearc \ No newline at end of file + return volumearc +end + +return setmetatable(widget, { __call = function(_, ...) return worker(...) end }) From c40075136423a5602d27325a1366c371acfe801c Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 13 Apr 2019 20:51:54 -0400 Subject: [PATCH 06/12] update volumearc readme --- volumearc-widget/README.md | 24 +++++++++++++++++++++--- volumearc-widget/custom.png | Bin 0 -> 9424 bytes volumearc-widget/volumearc.lua | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 volumearc-widget/custom.png diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 79f519d..5bd8e83 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -4,6 +4,24 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm ![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +```lua +volumearc_widget({ + main_color = '#af13f7', + mute_color = '#ff0000', + path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', + thickness = 5, + height = 25 +}) +``` + +Above config results in following widget: + +![custom](./custom.png) + ## Installation 1. Clone this repo under **~/.config/awesome/** @@ -29,12 +47,12 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm volumearc_widget(), --[[or customized]] volumearc_widget({ - main_color = '#0000ff', + main_color = '#af13f7', mute_color = '#ff0000', - path_to_icon = '/usr/share/icons/Arc/actions/symbolic/view-grid-symbolic.svg', + path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', thickness = 5, height = 25 }), ... - ``` \ No newline at end of file + ``` diff --git a/volumearc-widget/custom.png b/volumearc-widget/custom.png new file mode 100644 index 0000000000000000000000000000000000000000..f1873452f33ce862bdbe3fdf48f070f504717acb GIT binary patch literal 9424 zcmV;>Brn^EP)^geT+3kzw6g4W zVT-yJ&9D@;9T25K69uA7kr1Fl0vRfEDwRrVOiiy|z2Tegy=U0{$N9eV&b#kbEJ+|) zcJ`|E*7x1-4EyZ;+r!!C+yu|O_!aQtqto>T=l8DMm~S1|r`*5dOSeyc(lJ|Ov@zD& z7n-~O$aL(`;pfs_K3{x1Uv!$;`ljQ*yuN>S{16ERpb$xtCf3-zC|*L<_lc}7pG)@_ z7oM)}{M^;YZ$zeNX(Oa)h$dNxn+gQS<|uRB>V4Jl0%rCvn#@Djm`#6LCN_>Ud?<;ue&*`7N`Zr+*PJ134o z+X*StBq6cL0J1DIrpwGfKxSW}XQLMdp04QrRL!>HC*K+W{O4OAw`d068JyNy>nux? zBnizBF-ek_qTY*#UU)na(8crD#7`b;ZTqK@k1!0p&g80<^;+%7(W!o(=XpU$G758v zQYVimBs%}~S50hO?~Fyl`J>0~`=@_dw&i)Rze?xDjytw3GYI03zULRqUjL3i|C^JX zw?eg%)?|K9GaHf=ob z+N+*<`0>Vtqv7FQpT5O^SiNQQ*{^-oi4=VAEw?)70H8Us;zxezrd{9uPHm*M;rw&I z`jJ0n=SYax{pv66d+^cz+U-$GK55GqUWx%t*JF1uvq#`WxYY|ZM!Pd>Hh-Us5w8!tTXz$1_M=jS(Ec<$U+ zjs}73-TsiuvaH#dJACxvuiUP(^qOCJ=b;@>j;vm_?XN#$hSd!uyz`TvN$T}eFWkD6 zH+>x~q2I z^FVE+wRFH|pKd{7NJ*ATrG%77$d0WsMr%X@SX2mn-u%<5O&gi{-dk?{_jYW$@%ZbJ zbhrQTvp@Bg@bHRPUAANAuE%yhIXcpsott;g0xaMO5#i)$=9xps_UyarT|W=Z0B~@} zlaJnZ2LRml>6?9n^RK=7lrvA?{)I1{DBh)w`l`(vx8M5ZqT9Xrx;H#_+c$!aAOHHc zve!q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D;ZeJKf)B zNE2~UCb5*_W)-%VA}=0oSp+Y|@dEOM(Cv<%?Tlm21~AmKlhoLKMycf*`3F1*7ObeLyj$NrINOL?Z6LJl zm=F+El6XFdnXR)70D_uhqm5QGM3#8s6M@MXN-4!rTEom4iKKLVXlBEkF5mc}cVv^}y#q&Axb(>JnG{B9 z9V@e}X(W*-8f5Ikp=>O78Xf~wLf*1LkfXFR=D*UoqTrCeR8SZ%IdnwC(rH;*SkYW{ z)+XniNE2iLYr^=kvw`SBU!W6#$qmZ^u>%XMv%~jMVR6m}QrMBKRY2M4v2`%s>^}J9 zq3=A{8XMJG`}VzFuPjTIrR3NEaUByVof)k&q1T)*wD{V0mSxU46eN_Ci4sbpAphC| z3Q7_Qy^hXYEt4gjz^{RvDH?3dtRw8VMHJ^wLF6*KT7_;*u7Gp_<`ZFpPN zIX5_iPm;k4u80Tr?eA@S)U6&JP3r~Qkw()oPqao!k^lx>lvqnevxWxz=rQ*gz0V&n z##^(sHg^U~!^{eWsAsv=#m;>YT`Oj0WbiQ~s4Ad`qrzsqVT{cvR=_|p+K!*MC9BuU z`L2^>BuOOJ);3Tz(k7~uC0JKjEwW71n-%92f(0zemvMMLjf-F5^3Yj&GQ-hk4WpFH zFEHNz_yu~$ztmGAA`qFmepeUcoaUJrzx=|)A@_>-|5{MV2OyOjZg}1J51q}rEVV|% z%nV8*V%UEL7*X^}*3tus_%jUCz6BGKqF)weS(238>mB&(e<_>7IhR{)N{v!rY5pIK Wpls~|uXn2e0000 Date: Sat, 13 Apr 2019 20:53:50 -0400 Subject: [PATCH 07/12] Update README.md --- volumearc-widget/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 5bd8e83..38e7e05 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,7 +2,7 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} +![screenshot](out.gif) ## Customization From aa6f0363ad3385f9cd68efc45429948669de5422 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 13 Apr 2019 20:56:13 -0400 Subject: [PATCH 08/12] update readme --- volumearc-widget/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 5bd8e83..38e7e05 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -2,7 +2,7 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget), but using arcchart: -![screenshot]({{'/assets/img/screenshots/volumearc-widget.gif' | relative_url }}){:.center-image} +![screenshot](out.gif) ## Customization From ed8bd0a96a353d309ca5d9750d8ce0919db6a7c8 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 13 Apr 2019 22:44:47 -0400 Subject: [PATCH 09/12] update volumebar widget --- volumebar-widget/README.md | 61 ++++++++++++++++++++---- volumebar-widget/custom.png | Bin 0 -> 9126 bytes volumebar-widget/volumebar.lua | 84 +++++++++++++++++++-------------- 3 files changed, 100 insertions(+), 45 deletions(-) create mode 100644 volumebar-widget/custom.png diff --git a/volumebar-widget/README.md b/volumebar-widget/README.md index d6b9117..92beee2 100644 --- a/volumebar-widget/README.md +++ b/volumebar-widget/README.md @@ -9,21 +9,62 @@ Supports - scroll down - decrease volume, - left click - mute/unmute. - ## Installation + ## Customization - Clone repo, include widget and use it in **rc.lua**: + It is possible to customize widget by providing a table with all or some of the following config parameters: ```lua -local volumebar_widget = require("awesome-wm-widgets.volumebar-widget.volumebar") -... -s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - ... - volumebar_widget, - ... + 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 +}) ``` +Above config results in following widget: + +![custom](./custom.png) + + + ## Installation + +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 + }), + + ... + ``` + ## 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. diff --git a/volumebar-widget/custom.png b/volumebar-widget/custom.png new file mode 100644 index 0000000000000000000000000000000000000000..d86143b31166ea93b79acae4a15a4e3f0affbf57 GIT binary patch literal 9126 zcmV;XBU#*uP)S_9f00003b3#c}2nYz< z;ZNWI000?uMObuGZ)S9NVRB^vXKrt8Wi4}Ka%E+1b7*gL?*qR+001BWNkl&7gf9SyF6aVH+=!9m^(G2*waWVgv>kE^tz0VJSiti&I6Y zii4p7gv10KJ9e;HEbu0z1@9I{^;-P>G!=SS(b&t zrFZJptMA?K-tNz1ly4*1#Qmnc7-bXpoAP3mP26wFi%~XlzbP+9*{tXMV-zI1AM=PTa+gAd*Ew-5Zy ztTceaBr4Ug>ID`-aAWY5V^TfR=i);S*f&j5_zQpdVcTx+z4YSs zx|y;F&OejpJW;zI3;{q{>l?TJV%h7x?kBIme1WoYR&ZWNqZI@ zHkdIaTNc_Fr8N=?OYq)1he!Y+zw?FU`)z0J6Or3LcEdOH)MYELe*ty)M=r*g=Yspi zCyyL|?BG@J`cV)8fWrqK`s$500l*hO^wD_3CD&Yi+PP=l`SDLaQ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b!9)x|sS`;$)}`i1w0qsPsbS;vh?7>aL#hXAFqQ<% zcef$XKs!hYn`!k;i7Z=&{;wbE`$*OSCOg7$=M;HIq^vDA$jllrtB2r zbLCG>(V(g%s6kViFns**9iK5_e3v;uF@H-UoqmWeJ79M25KkzhP@kxxC1x07`M5kgReTA@}#=!I+V;v#k2 z`^2aWqLhNkYnKsT*4lQvEdcSA*}x1jj~`c+)~w-D$WBv?h=vq1dtq&D|B1uRu|*(c z9}qDR0FP5-S-T0v*;)UbDPR(p^9(25-wk>&9Q1ZY-%eVjH z56y|0J<_*j!OY4tcFMl5r&v7a+7!ofS??7&;PR9MCV6Huao$3Xf!wiE?J`F#C>4&L z@C4g0zZgKQ6Y&ncBR-Woj`{rsc$**#K*58?&B%w59uP88csZ6hEfd){Z+hz5a kw^vK6ZnjMEB#%7*9|Y+Kp{YsN;Q#;t07*qoM6N<$g8ppToB#j- literal 0 HcmV?d00001 diff --git a/volumebar-widget/volumebar.lua b/volumebar-widget/volumebar.lua index 9fd6a99..c1fcf71 100644 --- a/volumebar-widget/volumebar.lua +++ b/volumebar-widget/volumebar.lua @@ -9,6 +9,7 @@ ------------------------------------------------- local awful = require("awful") +local beautiful = require("beautiful") local gears = require("gears") local spawn = require("awful.spawn") local watch = require("awful.widget.watch") @@ -19,48 +20,61 @@ local INC_VOLUME_CMD = 'amixer -D pulse sset Master 5%+' local DEC_VOLUME_CMD = 'amixer -D pulse sset Master 5%-' local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' -local bar_color = "#74aeab" -local mute_color = "#ff0000" -local background_color = "#3a3a3a" +local widget = {} -local volumebar_widget = wibox.widget { - max_value = 1, - forced_width = 50, - paddings = 0, - border_width = 0.5, - color = bar_color, - background_color = background_color, - shape = gears.shape.bar, - clip = true, - margins = { - top = 10, - bottom = 10, - }, - widget = wibox.widget.progressbar -} +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)%%") - volume = tonumber(string.format("% 3d", volume)) + local args = args or {} - widget.value = volume / 100; - widget.color = mute == "off" and mute_color - or bar_color + local main_color = args.main_color or beautiful.widget_main_color + local mute_color = args.mute_color or beautiful.widget_red + local width = args.width or 50 + local shape = args.shape or 'bar' + local margins = args.margins or 10 -end + local volumebar_widget = wibox.widget { + max_value = 1, + forced_width = width, + color = main_color, + background_color = '#ffffff11', + shape = gears.shape[shape], + margins = { + top = margins, + bottom = margins, + }, + widget = wibox.widget.progressbar + } + + local update_graphic = function(widget, stdout, _, _, _) + 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; + widget.color = mute == "off" + and mute_color + or main_color -volumebar_widget:connect_signal("button::press", function(_,_,_,button) - if (button == 4) then awful.spawn(INC_VOLUME_CMD) - elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD) - elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD) end - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) - update_graphic(volumebar_widget, stdout, stderr, exitreason, exitcode) + volumebar_widget:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then + awful.spawn(INC_VOLUME_CMD) + elseif (button == 5) then + awful.spawn(DEC_VOLUME_CMD) + elseif (button == 1) then + awful.spawn(TOG_VOLUME_CMD) + end + + spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) + update_graphic(volumebar_widget, stdout, stderr, exitreason, exitcode) + end) end) -end) -watch(GET_VOLUME_CMD, 1, update_graphic, volumebar_widget) + watch(GET_VOLUME_CMD, 1, update_graphic, volumebar_widget) + + return volumebar_widget +end + +return setmetatable(widget, { __call = function(_, ...) return worker(...) end }) -return volumebar_widget \ No newline at end of file From 8e92a8541bba98132ce92307400f458bda65295b Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 13 Apr 2019 22:46:16 -0400 Subject: [PATCH 10/12] add mouse control info to readme --- volumearc-widget/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index 38e7e05..f791d3a 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -4,6 +4,11 @@ Almost the same as [volumebar widget](https://github.com/streetturtle/awesome-wm ![screenshot](out.gif) +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: From d0cbdc1647f793ea9b2922970022794e92202d4a Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 14 Apr 2019 20:07:15 -0400 Subject: [PATCH 11/12] Add table with config to the readme --- volumearc-widget/README.md | 16 ++++++++++++++-- volumearc-widget/volumearc.lua | 5 ++--- volumebar-widget/README.md | 25 +++++++++++++++++++------ volumebar-widget/volumebar.lua | 19 ++++++++++++------- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/volumearc-widget/README.md b/volumearc-widget/README.md index f791d3a..aac7e90 100644 --- a/volumearc-widget/README.md +++ b/volumearc-widget/README.md @@ -13,11 +13,24 @@ Supports 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', - path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', thickness = 5, height = 25 }) @@ -54,7 +67,6 @@ Above config results in following widget: volumearc_widget({ main_color = '#af13f7', mute_color = '#ff0000', - path_to_icon = '/usr/share/icons/Papirus-Dark/symbolic/status/audio-volume-high-symbolic.svg', thickness = 5, height = 25 }), diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 5fbf3dd..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, diff --git a/volumebar-widget/README.md b/volumebar-widget/README.md index 92beee2..35169b7 100644 --- a/volumebar-widget/README.md +++ b/volumebar-widget/README.md @@ -9,17 +9,30 @@ Supports - 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: +## 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 bar | +| `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 | +| `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 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 + shape = 'rounded_bar', margins = 8 }) ``` @@ -29,7 +42,7 @@ Above config results in following widget: ![custom](./custom.png) - ## Installation +## Installation 1. Clone this repo under **~/.config/awesome/** diff --git a/volumebar-widget/volumebar.lua b/volumebar-widget/volumebar.lua index c1fcf71..18e0f40 100644 --- a/volumebar-widget/volumebar.lua +++ b/volumebar-widget/volumebar.lua @@ -26,12 +26,17 @@ 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_normal + local mute_color = args.mute_color or beautiful.fg_urgent local width = args.width or 50 local shape = args.shape or 'bar' local margins = args.margins or 10 + local get_volume_cmd = args.get_volume_cmd or GET_VOLUME_CMD + local inc_volume_cmd = args.inc_volume_cmd or INC_VOLUME_CMD + 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 volumebar_widget = wibox.widget { max_value = 1, forced_width = width, @@ -59,19 +64,19 @@ local function worker(args) volumebar_widget:connect_signal("button::press", function(_, _, _, button) if (button == 4) then - awful.spawn(INC_VOLUME_CMD) + awful.spawn(inc_volume_cmd) elseif (button == 5) then - awful.spawn(DEC_VOLUME_CMD) + awful.spawn(dec_volume_cmd) elseif (button == 1) then - awful.spawn(TOG_VOLUME_CMD) + awful.spawn(tog_volume_cmd) end - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) + spawn.easy_async(get_volume_cmd, function(stdout, stderr, exitreason, exitcode) update_graphic(volumebar_widget, stdout, stderr, exitreason, exitcode) end) end) - watch(GET_VOLUME_CMD, 1, update_graphic, volumebar_widget) + watch(get_volume_cmd, 1, update_graphic, volumebar_widget) return volumebar_widget end From 429e6eb54a5bab17d7adba8956fcbc0a63257ed5 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Thu, 2 May 2019 21:35:30 -0400 Subject: [PATCH 12/12] external config for brightness and brightnessarc --- brightness-widget/README.md | 35 +++++++++++- brightness-widget/brightness.lua | 75 ++++++++++++++++--------- brightnessarc-widget/README.md | 63 ++++++++++++++++----- brightnessarc-widget/brightnessarc.lua | 78 ++++++++++++++++---------- 4 files changed, 177 insertions(+), 74 deletions(-) diff --git a/brightness-widget/README.md b/brightness-widget/README.md index 5d592b6..7b05d2f 100644 --- a/brightness-widget/README.md +++ b/brightness-widget/README.md @@ -2,6 +2,29 @@ This widget represents current brightness level: ![Brightness widget](./br-wid-1.png) +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `get_brightness_cmd` | `light -G` | Get current screen brightness | +| `inc_brightness_cmd` | `light -A 5` | Increase brightness | +| `dec_brightness_cmd` | `light -U 5`| Decrease brightness | +| `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon | +| `font` | `Play 9` | Font | + +### Example: + +```lua +brightness_widget({ + get_brightness_cmd = 'xbacklight -get', + inc_brightness_cmd = 'xbacklight -inc 5', + dec_brightness_cmd = 'xbacklight -dec 5' +}) +``` + + ## Installation First you need to get the current brightness level. There are two options: @@ -29,8 +52,6 @@ First you need to get the current brightness level. There are two options: 49.18 ``` -Depending on the chosen option change `GET_BRIGHTNESS_CMD` variable in **brightness.lua**. - Then clone this repo under **~/.config/awesome/**: ```bash @@ -50,7 +71,15 @@ s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, ... - brightness_widget, + -- default + brightness_widget(), + -- or customized + brightness_widget({ + get_brightness_cmd = 'xbacklight -get', + inc_brightness_cmd = 'xbacklight -inc 5', + dec_brightness_cmd = 'xbacklight -dec 5' + }) + } ... ``` diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua index 075765c..28e7015 100644 --- a/brightness-widget/brightness.lua +++ b/brightness-widget/brightness.lua @@ -5,7 +5,7 @@ -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/brightness-widget -- @author Pavel Makhov --- @copyright 2017 Pavel Makhov +-- @copyright 2017-2019 Pavel Makhov ------------------------------------------------- local wibox = require("wibox") @@ -17,36 +17,55 @@ local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get" local INC_BRIGHTNESS_CMD = "light -A 5" -- "xbacklight -inc 5" local DEC_BRIGHTNESS_CMD = "light -U 5" -- "xbacklight -dec 5" -local brightness_text = wibox.widget.textbox() -brightness_text:set_font('Play 9') +local widget = {} -local brightness_icon = wibox.widget { - { - image = PATH_TO_ICON, - resize = false, - widget = wibox.widget.imagebox, - }, - top = 3, - widget = wibox.container.margin -} +local function worker(args) -local brightness_widget = wibox.widget { - brightness_icon, - brightness_text, - layout = wibox.layout.fixed.horizontal, -} + local args = args or {} -local update_widget = function(widget, stdout, stderr, exitreason, exitcode) - local brightness_level = tonumber(string.format("%.0f", stdout)) - widget:set_text(" " .. brightness_level .. "%") -end, + local get_brightness_cmd = args.get_brightness_cmd or GET_BRIGHTNESS_CMD + local inc_brightness_cmd = args.inc_brightness_cmd or INC_BRIGHTNESS_CMD + local dec_brightness_cmd = args.dec_brightness_cmd or DEC_BRIGHTNESS_CMD + local path_to_icon = args.path_to_icon or PATH_TO_ICON + local font = args.font or 'Play 9' -brightness_widget:connect_signal("button::press", function(_,_,_,button) - if (button == 4) then spawn(INC_BRIGHTNESS_CMD, false) - elseif (button == 5) then spawn(DEC_BRIGHTNESS_CMD, false) - end -end) + local brightness_text = wibox.widget.textbox() + brightness_text:set_font(font) -watch(GET_BRIGHTNESS_CMD, 1, update_widget, brightness_text) + local brightness_icon = wibox.widget { + { + image = path_to_icon, + resize = false, + widget = wibox.widget.imagebox, + }, + top = 3, + widget = wibox.container.margin + } -return brightness_widget + widget = wibox.widget { + brightness_icon, + brightness_text, + layout = wibox.layout.fixed.horizontal, + } + + local update_widget = function(widget, stdout, _, _, _) + local brightness_level = tonumber(string.format("%.0f", stdout)) + widget:set_text(" " .. brightness_level .. "%") + end, + + widget:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then + spawn(inc_brightness_cmd, false) + elseif (button == 5) then + spawn(dec_brightness_cmd, false) + end + end) + + watch(get_brightness_cmd, 1, update_widget, brightness_text) + + return widget +end + +return setmetatable(widget, { __call = function(_, ...) + return worker(...) +end }) diff --git a/brightnessarc-widget/README.md b/brightnessarc-widget/README.md index fa123c1..d122d3a 100644 --- a/brightnessarc-widget/README.md +++ b/brightnessarc-widget/README.md @@ -1,12 +1,32 @@ # Brightness widget -![Brightness widget](./br-wid-1.png) +This widget represents current brightness level: ![Brightness widget](./br-wid-1.png) + +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `get_brightness_cmd` | `light -G` | Get current screen brightness | +| `inc_brightness_cmd` | `light -A 5` | Increase brightness | +| `dec_brightness_cmd` | `light -U 5`| Decrease brightness | +| `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon | + +### Example: + +```lua +brightnessarc_widget({ + get_brightness_cmd = 'xbacklight -get', + inc_brightness_cmd = 'xbacklight -inc 5', + dec_brightness_cmd = 'xbacklight -dec 5' +}) +``` -This widget represents current brightness level. ## Installation -Firstly you need to get the current brightness level. There are two options: +First you need to get the current brightness level. There are two options: - using `xbacklight` command (depending on your video card (I guess) it may or may not work) @@ -30,19 +50,36 @@ Firstly you need to get the current brightness level. There are two options: light -G 49.18 ``` -Depending on the chosen option change `GET_BRIGHTNESS_CMD` variable in **brightness.lua**. -Then in **rc.lua** add the import on top of the file and then add widget to the wibox: +Then clone this repo under **~/.config/awesome/**: + +```bash +git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/ +``` + +Require widget at the beginning of **rc.lua**: ```lua -require("awesome-wm-widgets.brightness-widget.brightness") -... --- Add widgets to the wibox -s.mywibox:setup { -... -{ -- Right widgets -... -brightness_widget +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +``` + +Add widget to the tasklist: + +```lua +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + -- default + brightnessarc_widget(), + -- or customized + brightnessarc_widget({ + get_brightness_cmd = 'xbacklight -get', + inc_brightness_cmd = 'xbacklight -inc 5', + dec_brightness_cmd = 'xbacklight -dec 5' + }) + } + ... ``` ## Controls diff --git a/brightnessarc-widget/brightnessarc.lua b/brightnessarc-widget/brightnessarc.lua index 7633218..dac08e4 100644 --- a/brightnessarc-widget/brightnessarc.lua +++ b/brightnessarc-widget/brightnessarc.lua @@ -2,7 +2,7 @@ -- Brightness Widget for Awesome Window Manager -- Shows the brightness level of the laptop display -- More details could be found here: --- https://github.com/streetturtle/awesome-wm-widgets/tree/master/brightnessarc-widget +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/widget-widget -- @author Pavel Makhov -- @copyright 2019 Pavel Makhov @@ -17,38 +17,56 @@ local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get" local INC_BRIGHTNESS_CMD = "light -A 5" -- "xbacklight -inc 5" local DEC_BRIGHTNESS_CMD = "light -U 5" -- "xbacklight -dec 5" -local icon = { - id = "icon", - image = PATH_TO_ICON, - resize = true, - widget = wibox.widget.imagebox, -} +local widget = {} -local brightnessarc = wibox.widget { - icon, - max_value = 1, - thickness = 2, - start_angle = 4.71238898, -- 2pi*3/4 - forced_height = 18, - forced_width = 18, - bg = "#ffffff11", - paddings = 2, - widget = wibox.container.arcchart -} +local function worker(args) -local update_widget = function(widget, stdout) - local brightness_level = string.match(stdout, "(%d?%d?%d?)") - brightness_level = tonumber(string.format("% 3d", brightness_level)) + local args = args or {} - widget.value = brightness_level / 100; -end, + local get_brightness_cmd = args.get_brightness_cmd or GET_BRIGHTNESS_CMD + local inc_brightness_cmd = args.inc_brightness_cmd or INC_BRIGHTNESS_CMD + local dec_brightness_cmd = args.dec_brightness_cmd or DEC_BRIGHTNESS_CMD + local path_to_icon = args.path_to_icon or PATH_TO_ICON -brightnessarc:connect_signal("button::press", function(_, _, _, button) - if (button == 4) then spawn(INC_BRIGHTNESS_CMD, false) - elseif (button == 5) then spawn(DEC_BRIGHTNESS_CMD, false) - end -end) + local icon = { + id = "icon", + image = path_to_icon, + resize = true, + widget = wibox.widget.imagebox, + } -watch(GET_BRIGHTNESS_CMD, 1, update_widget, brightnessarc) + widget = wibox.widget { + icon, + max_value = 1, + thickness = 2, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = 18, + forced_width = 18, + bg = "#ffffff11", + paddings = 2, + widget = wibox.container.arcchart + } -return brightnessarc + local update_widget = function(widget, stdout) + local brightness_level = string.match(stdout, "(%d?%d?%d?)") + brightness_level = tonumber(string.format("% 3d", brightness_level)) + + widget.value = brightness_level / 100; + end, + + widget:connect_signal("button::press", function(_, _, _, button) + if (button == 4) then + spawn(inc_brightness_cmd, false) + elseif (button == 5) then + spawn(dec_brightness_cmd, false) + end + end) + + watch(get_brightness_cmd, 1, update_widget, widget) + + return widget +end + +return setmetatable(widget, { __call = function(_, ...) + return worker(...) +end })