client.connect_signal("request::titlebars", function(c)
local buttons = gears.table.join(
awful.button({}, 1, function()
c:activate { context = "titlebar", action = "mouse_move" }
end),
awful.button({}, 3, function()
c:activate { context = "titlebar", action = "mouse_resize" }
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton(c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton(c),
awful.titlebar.widget.ontopbutton(c),
awful.titlebar.widget.closebutton(c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
Per-Application Rules and Signals: Define specific behaviors for applications, such as setting certain apps to always open on designated tags or screens.
ruled.client.append_rule {
id = "browser",
rule = { class = "Firefox" },
properties = { screen = 1, tag = "2", maximized = false }
}
client.connect_signal("manage", function(c)
if c.class == "Firefox" then
c:move_to_screen(1)
c:move_to_tag("2")
c.maximized = false
end
end)
This configuration ensures that Firefox always opens on screen 1, tag 2, and is not maximized by default.
Custom Widgets and Wibar Enhancements: Create custom widgets, such as a system monitor, and integrate them into the wibar for real-time system information.
local cpu_widget = wibox.widget {
{
max_value = 100,
value = 0,
forced_height = 20,
forced_width = 100,
paddings = 1,
border_width = 1,
border_color = "#000000",
widget = wibox.widget.progressbar,
},
direction = 'east',
layout = wibox.container.rotate,
}
gears.timer {
timeout = 2,
call_now = true,
autostart = true,
callback = function()
awful.spawn.easy_async_with_shell("grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'", function(out)
cpu_widget.widget.value = tonumber(out)
end)
end
}
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ --