awesome: add dividers to emulate toolbars in xp instead of spamming inset boxes

This commit is contained in:
Cynthia Foxwell 2022-12-22 15:25:42 -07:00
parent 35b6a53205
commit abde63f76b
2 changed files with 73 additions and 16 deletions

View File

@ -85,7 +85,11 @@ local function make_bar_icon(icon)
local img = wibox.widget.imagebox(beautiful["bar_" .. icon], false)
img.forced_height = 18
img.forced_width = 18
return img
return {
img,
top = 1,
layout = wibox.container.margin,
}
end
local function make_inset(child)
@ -100,6 +104,35 @@ local function make_inset(child)
}
end
local function make_divider()
return {
{
wibox.widget({}),
forced_width = 3,
shape = win9x.divider,
layout = wibox.container.background,
},
left = 4,
right = 4,
top = 2,
bottom = 2,
layout = wibox.container.margin,
}
end
local function status_box(child)
return {
make_divider(),
{
child,
top = 2,
bottom = 2,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.horizontal,
}
end
-- Widgets
--local clock_icon = make_bar_icon("clock")
local uclock = wibox.widget.textclock(markup(beautiful.widget_clock or beautiful.wibar_fg, "(UTC: %H) "), 1, "UTC")
@ -200,7 +233,7 @@ awful.widget.watch(
local packages_icon = make_bar_icon("packages")
local packages = wibox.widget.textbox()
local packages_wrapper = wibox.widget(make_inset({
local packages_wrapper = wibox.widget(status_box({
packages_icon,
packages,
layout = wibox.layout.fixed.horizontal,
@ -236,7 +269,7 @@ local net_up = lain.widget.net({
local music_icon = make_bar_icon("music")
local music = wibox.widget.textbox()
local music_wrapper = wibox.widget(make_inset({
local music_wrapper = wibox.widget(status_box({
music_icon,
music,
layout = wibox.layout.fixed.horizontal,
@ -288,7 +321,11 @@ awful.widget.watch(
local start = wibox.widget({
{
{
wibox.widget.imagebox(beautiful.awesome_icon),
{
wibox.widget.imagebox(beautiful.awesome_icon),
margins = 1,
layout = wibox.container.margin,
},
--wibox.widget.textbox("Start"),
spacing = 2,
layout = wibox.layout.fixed.horizontal,
@ -385,15 +422,15 @@ awful.screen.connect_for_each_screen(function(s)
-- Left widgets
{
start,
make_inset(s.__taglist),
make_inset(s.__layoutbox),
--[[{
s.__layoutbox,
margins = 2,
layout = wibox.container.margin,
},--]]
s.__promptbox,
spacing = 4,
make_divider(),
s.__taglist,
{
s.__layoutbox,
margins = 3,
layout = wibox.container.margin,
},
make_divider(),
layout = wibox.layout.fixed.horizontal,
},
@ -403,7 +440,7 @@ awful.screen.connect_for_each_screen(function(s)
-- Right widgets
{
music_wrapper,
make_inset({
status_box({
{
cpu_icon,
cpu.widget,
@ -417,7 +454,7 @@ awful.screen.connect_for_each_screen(function(s)
spacing = 2,
layout = wibox.layout.fixed.horizontal,
}),
make_inset({
status_box({
{
gpu_icon,
gpu,
@ -431,7 +468,7 @@ awful.screen.connect_for_each_screen(function(s)
spacing = 2,
layout = wibox.layout.fixed.horizontal,
}),
make_inset({
status_box({
memory_icon,
memory.widget,
layout = wibox.layout.fixed.horizontal,

View File

@ -127,9 +127,28 @@ local function taskbar(cr, width, height)
cr:rectangle(0, 0, width, height)
cr:fill()
cr:set_source(gears.color(beautiful.win9x_bright))
cr:set_source(gears.color(beautiful.win9x_dark))
cr:rectangle(0, height - 2, width, 1)
cr:fill()
cr:set_source(gears.color(beautiful.win9x_outer))
cr:rectangle(0, height - 1, width, 1)
cr:fill()
end
local function divider(cr, width, height)
cr:set_source(gears.color(beautiful.win9x_main))
cr:rectangle(0, 0, width, height)
cr:fill()
cr:set_source(gears.color(beautiful.win9x_bright))
cr:rectangle(0, 0, width - 1, 1)
cr:rectangle(0, 1, 1, height - 1)
cr:fill()
cr:set_source(gears.color(beautiful.win9x_dark))
cr:rectangle(width - 1, 0, 1, height - 1)
cr:rectangle(0, height - 1, width, 1)
cr:fill()
end
return {
@ -143,4 +162,5 @@ return {
top = border_top,
},
taskbar = taskbar,
divider = divider,
}