117 lines
4.3 KiB
Lua
117 lines
4.3 KiB
Lua
local awful = require("awful")
|
|
local gears = require("gears")
|
|
local wibox = require("wibox")
|
|
local beautiful = require("beautiful")
|
|
local colors = require("config.colors")
|
|
local widgets = require("config.widgets")
|
|
|
|
local M = {}
|
|
|
|
local taglist_buttons = gears.table.join(
|
|
awful.button({ }, 1, function(t) t:view_only() end),
|
|
awful.button({ modkey }, 1, function(t) if client.focus then client.focus:move_to_tag(t) end end),
|
|
awful.button({ }, 3, awful.tag.viewtoggle)
|
|
)
|
|
|
|
local function set_wallpaper(s)
|
|
if beautiful.wallpaper then
|
|
local wp = beautiful.wallpaper
|
|
if type(wp) == "function" then wp = wp(s) end
|
|
gears.wallpaper.maximized(wp, s, true)
|
|
end
|
|
end
|
|
screen.connect_signal("property::geometry", set_wallpaper)
|
|
|
|
function M.setup()
|
|
awful.screen.connect_for_each_screen(function(s)
|
|
set_wallpaper(s)
|
|
awful.tag({ "1", "2", "3", "4", "5" }, s, awful.layout.layouts[1])
|
|
|
|
s.mypromptbox = awful.widget.prompt()
|
|
s.mylayoutbox = awful.widget.layoutbox(s)
|
|
s.mylayoutbox:buttons(gears.table.join(
|
|
awful.button({ }, 1, function() awful.layout.inc(1) end),
|
|
awful.button({ }, 3, function() awful.layout.inc(-1) end)
|
|
))
|
|
|
|
s.mytaglist = awful.widget.taglist {
|
|
screen = s, filter = awful.widget.taglist.filter.all, buttons = taglist_buttons,
|
|
style = { shape = function(cr, w, h) gears.shape.rounded_rect(cr, w, h, 4) end },
|
|
layout = { spacing = 4, layout = wibox.layout.fixed.horizontal },
|
|
widget_template = {
|
|
{ { id = "text_role", widget = wibox.widget.textbox }, left = 10, right = 10, top = 4, bottom = 4, widget = wibox.container.margin },
|
|
id = "background_role", widget = wibox.container.background,
|
|
},
|
|
}
|
|
|
|
-- Per-screen monitor widgets (created here so multi-monitor stays valid)
|
|
local title = widgets.make_title()
|
|
local vol = widgets.make_vol()
|
|
local brightness = widgets.make_brightness()
|
|
local cpu = widgets.make_cpu()
|
|
local clock = wibox.widget.textclock("%Y-%m-%d %H:%M")
|
|
|
|
local right = wibox.layout.fixed.horizontal()
|
|
local function push(w) right:add(widgets.padded(w, 4, 4)) end
|
|
push(wibox.widget.systray()); right:add(widgets.sep())
|
|
push(brightness);
|
|
push(vol); right:add(widgets.sep())
|
|
push(cpu); right:add(widgets.sep())
|
|
push(clock); right:add(widgets.sep())
|
|
push(s.mylayoutbox)
|
|
|
|
s.mywibox = awful.wibar {
|
|
position = "top", screen = s, height = 45, bg = colors.background, fg = colors.foreground,
|
|
shape = function(cr, w, h) gears.shape.rounded_rect(cr, w, h, 0) end,
|
|
}
|
|
|
|
s.mywibox:setup {
|
|
layout = wibox.container.margin, left = 8, right = 8, top = 10, bottom = 10,
|
|
{
|
|
layout = wibox.layout.align.horizontal,
|
|
{ -- Left: workspaces + focused window title
|
|
layout = wibox.layout.fixed.horizontal,
|
|
widgets.padded(s.mytaglist, 8, 4), s.mypromptbox,
|
|
{ title, left = 18, widget = wibox.container.margin },
|
|
},
|
|
nil, -- empty center
|
|
widgets.padded(right, 4, 12),
|
|
}
|
|
}
|
|
end)
|
|
|
|
-- Overlay for rofi launchers
|
|
local dim_overlay = wibox({
|
|
visible = false,
|
|
ontop = true,
|
|
type = "splash",
|
|
bg = "#00000099",
|
|
})
|
|
dim_overlay.name = "awesome_dim_overlay"
|
|
|
|
awful.screen.connect_for_each_screen(function(s)
|
|
dim_overlay.screen = s -- adjust if you want it per-screen vs spanning all
|
|
end)
|
|
|
|
-- span the primary screen's geometry (or loop over all screens if you use a multi-monitor dim)
|
|
local function update_dim_geometry()
|
|
local geo = screen.primary.geometry
|
|
dim_overlay:geometry(geo)
|
|
end
|
|
update_dim_geometry()
|
|
screen.connect_signal("property::geometry", update_dim_geometry)
|
|
|
|
-- expose functions over awesome-client
|
|
_G.show_dim = function() dim_overlay.visible = true end
|
|
_G.hide_dim = function() dim_overlay.visible = false end
|
|
|
|
-- Prime the window so X/picom register its type before first real use,
|
|
-- avoiding a one-time grow animation on the very first show_dim() call
|
|
dim_overlay.visible = true
|
|
gears.timer.delayed_call(function()
|
|
dim_overlay.visible = false
|
|
end)
|
|
end
|
|
|
|
return M
|