2022-07-16 17:10:17 -07:00
|
|
|
local function start()
|
|
|
|
local desktop = {
|
|
|
|
widgets = {
|
|
|
|
space = function(size)
|
|
|
|
return wibox.widget {
|
|
|
|
{
|
|
|
|
widget = wibox.widget.separator,
|
|
|
|
color = beautiful.color.transparent,
|
|
|
|
forced_width = beautiful.dpi(size)
|
|
|
|
},
|
|
|
|
layout = wibox.container.background,
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
separator = function(size, margin_h, margin_v)
|
|
|
|
return wibox.widget {
|
|
|
|
{
|
|
|
|
widget = wibox.widget.separator,
|
|
|
|
color = "#FFFFFF55",
|
|
|
|
forced_width = beautiful.dpi(size),
|
|
|
|
thickness = beautiful.dpi(size)
|
|
|
|
},
|
|
|
|
layout = wibox.container.margin,
|
|
|
|
top = beautiful.dpi(margin_v),
|
|
|
|
bottom = beautiful.dpi(margin_v),
|
|
|
|
left = beautiful.dpi(margin_h),
|
|
|
|
right = beautiful.dpi(margin_h)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-16 19:06:55 -07:00
|
|
|
local tasklist = require("core.tasklist")
|
2022-07-16 17:10:17 -07:00
|
|
|
|
|
|
|
-- Manages tag grid and widget
|
|
|
|
local tagger = require("core.tagger.tagger")
|
|
|
|
|
|
|
|
-- Makes a layout indicator.
|
|
|
|
-- make_layoutbox(screen) will return a widget for the given screen.
|
|
|
|
local make_layoutbox = require("core.layouts.widget")
|
|
|
|
|
2022-07-16 19:12:29 -07:00
|
|
|
-- Quick hack to allow disabling modules.
|
|
|
|
-- Replace with a better system later
|
|
|
|
local function try_mod(module)
|
|
|
|
if (module == nil) then
|
|
|
|
return {}
|
|
|
|
end
|
|
|
|
|
|
|
|
return module
|
|
|
|
end
|
|
|
|
|
2022-07-16 17:10:17 -07:00
|
|
|
|
|
|
|
-- If timed wallpaper is enabled, load timed manager
|
|
|
|
if (type(beautiful.wallpaper) == "table") then
|
2022-11-05 08:16:41 -07:00
|
|
|
local wallpaper = require("core.wallpaper")
|
|
|
|
screen.connect_signal(
|
|
|
|
"property::geometry",
|
|
|
|
wallpaper.update
|
|
|
|
)
|
|
|
|
wallpaper.update()
|
|
|
|
wallpaper.start()
|
2022-07-16 17:10:17 -07:00
|
|
|
else
|
2022-11-05 08:16:41 -07:00
|
|
|
-- Otherwise, set a static wallpaper
|
|
|
|
-- on each screen. We need to iterate
|
|
|
|
-- because a single call to wallpaper.maximized
|
|
|
|
-- will stretch one image over all screens
|
2022-07-16 17:10:17 -07:00
|
|
|
for s in screen do
|
2022-11-05 08:16:41 -07:00
|
|
|
gears.wallpaper.maximized(
|
|
|
|
beautiful.wallpaper,
|
|
|
|
s
|
|
|
|
)
|
2022-07-16 17:10:17 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Set a timer that will update the tag indicators of all screens.
|
|
|
|
-- Even if we do not want continuous updates, we still need a timer:
|
|
|
|
-- there must be a significant delay (1ish second) before awesome prepares
|
|
|
|
-- all clients
|
|
|
|
desktop.screen_timer = gears.timer {
|
|
|
|
timeout = 2,
|
|
|
|
call_now = false,
|
|
|
|
autostart = true,
|
2022-07-16 19:06:55 -07:00
|
|
|
single_shot = not config.core.continuous_tag_updates,
|
2022-07-16 17:10:17 -07:00
|
|
|
|
|
|
|
callback = function()
|
|
|
|
for s in screen do
|
|
|
|
s.tagger:update_widget()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Prepare screens
|
|
|
|
awful.screen.connect_for_each_screen(
|
|
|
|
function(s)
|
|
|
|
|
2022-11-05 08:08:15 -07:00
|
|
|
-- Run module screen initialization methods
|
|
|
|
for _, mod in pairs(modules) do
|
|
|
|
if (mod["for_each_screen"] ~= nil) then
|
|
|
|
mod["for_each_screen"](s)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Create tag table
|
2022-07-16 17:10:17 -07:00
|
|
|
s.tagger = tagger:new(s)
|
|
|
|
|
2022-11-05 08:16:41 -07:00
|
|
|
-- Create a promptbox for each screen
|
2022-07-16 17:10:17 -07:00
|
|
|
s.mypromptbox = awful.widget.prompt()
|
|
|
|
|
|
|
|
-- Create the bar
|
|
|
|
s.bar = awful.wibar({
|
2022-07-16 19:06:55 -07:00
|
|
|
position = config.core.bar_position,
|
2022-07-16 17:10:17 -07:00
|
|
|
screen = s,
|
|
|
|
--bg = "#00000000",
|
|
|
|
bg = beautiful.color.bar.color,
|
|
|
|
border_width = 0,
|
2022-07-16 19:06:55 -07:00
|
|
|
height = beautiful.dpi(config.core.bar_height),
|
2022-07-16 17:10:17 -07:00
|
|
|
type = "desktop"
|
|
|
|
})
|
|
|
|
|
|
|
|
s.systray = wibox.widget.systray()
|
|
|
|
s.systraysep = desktop.widgets.separator(2, 5, 3)
|
|
|
|
s.bar:connect_signal("button::press",
|
|
|
|
function(_, _, _, button, mods)
|
|
|
|
|
|
|
|
-- Middle-click
|
|
|
|
if (button == 2) then
|
|
|
|
s.systray.visible = not s.systray.visible
|
|
|
|
s.systraysep.visible = s.systray.visible
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- Create shortcut list from config value
|
2022-07-16 19:06:55 -07:00
|
|
|
if (#config.core.bar_shortcuts > 0) then
|
2022-07-16 17:10:17 -07:00
|
|
|
s.shortcuts = {
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
desktop.widgets.separator(2, 5, 3),
|
|
|
|
desktop.widgets.space(6)
|
|
|
|
}
|
2022-07-16 19:06:55 -07:00
|
|
|
for k, v in pairs(config.core.bar_shortcuts) do
|
|
|
|
s.shortcuts[#s.shortcuts + 1] = modules.simple_widgets.make_shortcut(v[1], v[2])
|
2022-07-16 17:10:17 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Assemble left bar widgets
|
|
|
|
|
|
|
|
local rightside = {
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
spacing = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
rightside = gears.table.join(rightside, {
|
|
|
|
desktop.widgets.space(10),
|
|
|
|
s.systraysep,
|
|
|
|
desktop.widgets.space(10),
|
|
|
|
{
|
|
|
|
s.systray,
|
|
|
|
top = beautiful.dpi(3),
|
|
|
|
bottom = beautiful.dpi(3),
|
|
|
|
left = 0, right = 0,
|
|
|
|
layout = wibox.container.margin,
|
|
|
|
},
|
|
|
|
desktop.widgets.separator(2, 5, 3),
|
|
|
|
desktop.widgets.space(10),
|
|
|
|
})
|
|
|
|
|
2022-07-16 19:06:55 -07:00
|
|
|
if (modules.mpc ~= nil) then
|
2022-07-16 17:10:17 -07:00
|
|
|
rightside = gears.table.join(rightside, {
|
2022-07-16 19:12:29 -07:00
|
|
|
modules.mpc.widget,
|
2022-07-16 17:10:17 -07:00
|
|
|
desktop.widgets.space(5),
|
|
|
|
desktop.widgets.separator(2, 5, 3),
|
|
|
|
desktop.widgets.space(15),
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
rightside = gears.table.join(rightside, {
|
2022-07-16 19:06:55 -07:00
|
|
|
modules.simple_widgets.textclock,
|
2022-07-16 17:10:17 -07:00
|
|
|
desktop.widgets.space(8),
|
|
|
|
|
2022-07-16 19:12:29 -07:00
|
|
|
try_mod(modules.battery).widget,
|
|
|
|
try_mod(modules.backlight).widget,
|
|
|
|
try_mod(modules.volume).widget,
|
2022-07-16 17:10:17 -07:00
|
|
|
desktop.widgets.space(8),
|
|
|
|
|
2022-07-16 19:12:29 -07:00
|
|
|
try_mod(modules.ibus).widget,
|
2022-07-16 17:10:17 -07:00
|
|
|
desktop.widgets.space(8),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.bar:setup {
|
|
|
|
layout = wibox.container.margin,
|
2022-07-16 19:06:55 -07:00
|
|
|
margins = beautiful.dpi(config.core.bar_margin),
|
2022-07-16 17:10:17 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
layout = wibox.layout.align.horizontal,
|
|
|
|
{
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
|
|
|
|
desktop.widgets.space(8),
|
|
|
|
|
|
|
|
|
2022-07-16 19:12:29 -07:00
|
|
|
try_mod(modules.launcher).widget,
|
2022-07-16 17:10:17 -07:00
|
|
|
|
|
|
|
desktop.widgets.space(18),
|
2022-07-16 18:00:46 -07:00
|
|
|
s.tagger.widget.widget,
|
2022-07-16 17:10:17 -07:00
|
|
|
make_layoutbox(s),
|
|
|
|
|
|
|
|
s.shortcuts,
|
|
|
|
|
|
|
|
desktop.widgets.space(6),
|
|
|
|
desktop.widgets.separator(2, 5, 3),
|
|
|
|
desktop.widgets.space(18),
|
2022-07-16 19:06:55 -07:00
|
|
|
tasklist(s),
|
2022-07-16 17:10:17 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
s.mypromptbox,
|
|
|
|
rightside
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
return start
|