Skip to content

Commit

Permalink
WIP polising
Browse files Browse the repository at this point in the history
  • Loading branch information
LycanDarko666 committed Apr 2, 2023
1 parent 59de315 commit cbd5be5
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 62 deletions.
2 changes: 1 addition & 1 deletion bunny_bar/center_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ return function(s, widgets)
screen = s,
widget = wibox.container.background,
ontop = false,
bg = color["Grey900"],
bg = color["Blur"], -- requires picom to be turned on
visible = true,
maximum_width = dpi(500),
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
Expand Down
2 changes: 2 additions & 0 deletions bunny_bar/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Bunny_bar - Rabbithole's segmented wibar system

-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
Expand Down
126 changes: 65 additions & 61 deletions bunny_bar/right_bar.lua
Original file line number Diff line number Diff line change
@@ -1,73 +1,77 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")

return function(s, widgets)

local top_right = awful.popup {
widget = wibox.container.background,
ontop = false,
bg = color["BlueA400"],
visible = true,
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
}

top_right:struts {
top = 55
}
-- Custom local libraries
local color = require("src.theme.colors")

local function prepare_widgets(widgets)
local layout = {
forced_height = 40,
layout = wibox.layout.fixed.horizontal
-- This freturns a widget function for the right bar
return function(s, widgets)
-- create right wibar as a floating popup widget
local top_right = awful.popup {
widget = wibox.container.background,
ontop = false,
bg = color["BlueA400"],
visible = true,
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
-- rounded edges
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
}
-- this sets the distance between the top of the screen and the clients
top_right:struts {
top = 55
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end

local function prepare_widgets(widgets)
local layout = {
forced_height = 40,
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
return layout
end

top_right:setup {
nil,
nil,
prepare_widgets(widgets),
layout = wibox.layout.align.horizontal
}
top_right:setup {
nil,
nil,
prepare_widgets(widgets),
layout = wibox.layout.align.horizontal
}
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- Awesome libs
local wibox = require("wibox")
local gears = require("gears")

Expand Down

0 comments on commit cbd5be5

Please sign in to comment.