mirror of https://github.com/lcpz/lain.git
{alsa,pulse}bar: fallback for mywibox variable; closes #384
This commit is contained in:
parent
1b909160d6
commit
63c9c7616a
|
@ -113,11 +113,18 @@ local function factory(args)
|
||||||
preset.title = preset.title .. " Muted"
|
preset.title = preset.title .. " Muted"
|
||||||
end
|
end
|
||||||
|
|
||||||
local wib = awful.screen.focused().mywibox
|
-- tot is the maximum number of ticks to display in the notification
|
||||||
|
-- fallback: default horizontal wibox height
|
||||||
|
local wib, tot = awful.screen.focused().mywibox, 20
|
||||||
|
|
||||||
local tot = wib.height
|
-- if we can grab mywibox, tot is defined as its height if
|
||||||
|
-- horizontal, or width otherwise
|
||||||
|
if wib then
|
||||||
if wib.position == "left" or wib.position == "right" then
|
if wib.position == "left" or wib.position == "right" then
|
||||||
tot = wib.width
|
tot = wib.width
|
||||||
|
else
|
||||||
|
tot = wib.height
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
int = math.modf((alsabar._current_level / 100) * tot)
|
int = math.modf((alsabar._current_level / 100) * tot)
|
||||||
|
|
|
@ -123,11 +123,18 @@ local function factory(args)
|
||||||
preset.title = preset.title .. " muted"
|
preset.title = preset.title .. " muted"
|
||||||
end
|
end
|
||||||
|
|
||||||
local wib = awful.screen.focused().mywibox
|
-- tot is the maximum number of ticks to display in the notification
|
||||||
|
-- fallback: default horizontal wibox height
|
||||||
|
local wib, tot = awful.screen.focused().mywibox, 20
|
||||||
|
|
||||||
local tot = wib.height
|
-- if we can grab mywibox, tot is defined as its height if
|
||||||
|
-- horizontal, or width otherwise
|
||||||
|
if wib then
|
||||||
if wib.position == "left" or wib.position == "right" then
|
if wib.position == "left" or wib.position == "right" then
|
||||||
tot = wib.width
|
tot = wib.width
|
||||||
|
else
|
||||||
|
tot = wib.height
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
int = math.modf((pulsebar._current_level / 100) * tot)
|
int = math.modf((pulsebar._current_level / 100) * tot)
|
||||||
|
|
Loading…
Reference in New Issue