From: Luca CPZ Date: Fri, 16 Feb 2018 18:49:13 +0000 (+0100) Subject: {alsa,pulse}bar: consider wibar orientation when calculating notification size; #384 X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/3136a45015a6662f191c4c8aea6fee19aff76169?ds=inline;hp=--cc {alsa,pulse}bar: consider wibar orientation when calculating notification size; #384 --- 3136a45015a6662f191c4c8aea6fee19aff76169 diff --git a/widget/alsabar.lua b/widget/alsabar.lua index 125b992..b253d4b 100644 --- a/widget/alsabar.lua +++ b/widget/alsabar.lua @@ -113,9 +113,16 @@ local function factory(args) preset.title = preset.title .. " Muted" end - int = math.modf((alsabar._current_level / 100) * awful.screen.focused().mywibox.height) + local wib = awful.screen.focused().mywibox + + local tot = wib.height + if wib.position == "left" or wib.position == "right" then + tot = wib.width + end + + int = math.modf((alsabar._current_level / 100) * tot) preset.text = string.format("[%s%s]", string.rep("|", int), - string.rep(" ", awful.screen.focused().mywibox.height - int)) + string.rep(" ", tot - int)) if alsabar.followtag then preset.screen = awful.screen.focused() end diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index 78b7d49..30fbb40 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -123,9 +123,16 @@ local function factory(args) preset.title = preset.title .. " muted" end - int = math.modf((pulsebar._current_level / 100) * awful.screen.focused().mywibox.height) + local wib = awful.screen.focused().mywibox + + local tot = wib.height + if wib.position == "left" or wib.position == "right" then + tot = wib.width + end + + int = math.modf((pulsebar._current_level / 100) * tot) preset.text = string.format("[%s%s]", string.rep("|", int), - string.rep(" ", awful.screen.focused().mywibox.height - int)) + string.rep(" ", tot - int)) if pulsebar.followtag then preset.screen = awful.screen.focused() end