220 lines
5.6 KiB
Lua
220 lines
5.6 KiB
Lua
-- luacheck: globals client
|
|
local awful = require("awful")
|
|
local beautiful = require("beautiful")
|
|
local gears = require("gears")
|
|
local wibox = require("wibox")
|
|
|
|
local win9x = require("modules/win9x")
|
|
|
|
local function make_win9x_button(child)
|
|
return {
|
|
{
|
|
{
|
|
wibox.widget({}),
|
|
shape = win9x.button,
|
|
layout = wibox.container.background,
|
|
},
|
|
top = 1,
|
|
bottom = 1,
|
|
layout = wibox.container.margin,
|
|
},
|
|
child,
|
|
layout = wibox.layout.stack,
|
|
}
|
|
end
|
|
|
|
-- serentiy uses 19px tall titlebars :(
|
|
--[[local _lines = {}
|
|
for i = 1, 8 do
|
|
_lines[#_lines + 1] = wibox.widget({
|
|
widget = wibox.widget.separator,
|
|
color = beautiful.win9x_dark,
|
|
orientation = "horizontal",
|
|
thickness = 1,
|
|
forced_height = 1,
|
|
border_width = 0,
|
|
})
|
|
_lines[#_lines + 1] = wibox.widget({
|
|
widget = wibox.widget.separator,
|
|
color = "#00000000",
|
|
orientation = "horizontal",
|
|
thickness = 1,
|
|
forced_height = 1,
|
|
border_width = 0,
|
|
})
|
|
end
|
|
_lines[#_lines + 1] = wibox.widget({
|
|
widget = wibox.widget.separator,
|
|
color = beautiful.win9x_dark,
|
|
orientation = "horizontal",
|
|
thickness = 1,
|
|
forced_height = 1,
|
|
border_width = 0,
|
|
})
|
|
_lines.layout = wibox.layout.fixed.vertical
|
|
|
|
local serenity_lines = {
|
|
_lines,
|
|
top = 2,
|
|
left = 2,
|
|
bottom = 2,
|
|
right = 0,
|
|
layout = wibox.container.margin,
|
|
}--]]
|
|
|
|
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
|
client.connect_signal("request::titlebars", function(c)
|
|
-- buttons for the titlebar
|
|
local buttons = gears.table.join(
|
|
awful.button({}, 1, function()
|
|
c:emit_signal("request::activate", "titlebar", {raise = true})
|
|
awful.mouse.client.move(c)
|
|
end),
|
|
awful.button({}, 3, function()
|
|
c:emit_signal("request::activate", "titlebar", {raise = true})
|
|
awful.mouse.client.resize(c)
|
|
end)
|
|
)
|
|
|
|
awful.titlebar(c, {
|
|
position = "left",
|
|
size = 4,
|
|
bg_normal = "#00000000",
|
|
bg_focus = "#00000000",
|
|
}):setup({
|
|
wibox.widget({}),
|
|
shape = win9x.border.left,
|
|
layout = wibox.container.background,
|
|
})
|
|
awful.titlebar(c, {
|
|
position = "right",
|
|
size = 4,
|
|
bg_normal = "#00000000",
|
|
bg_focus = "#00000000",
|
|
}):setup({
|
|
wibox.widget({}),
|
|
shape = win9x.border.right,
|
|
layout = wibox.container.background,
|
|
})
|
|
|
|
awful.titlebar(c, {
|
|
position = "bottom",
|
|
size = 4,
|
|
bg_normal = "#00000000",
|
|
bg_focus = "#00000000",
|
|
}):setup({
|
|
wibox.widget({}),
|
|
shape = win9x.border.bottom,
|
|
layout = wibox.container.background,
|
|
})
|
|
|
|
local titlebar = awful.titlebar(c, {
|
|
size = 24,
|
|
fg_normal = beautiful.win9x_unfocus,
|
|
fg_focus = beautiful.fg_focus,
|
|
bg_normal = beautiful.win9x_dark,
|
|
bg_focus = beautiful.win9x_focus,
|
|
})
|
|
|
|
titlebar:setup({
|
|
{
|
|
wibox.widget({}),
|
|
forced_height = 4,
|
|
shape = win9x.border.top,
|
|
layout = wibox.container.background,
|
|
},
|
|
{
|
|
{
|
|
wibox.widget({}),
|
|
forced_width = 4,
|
|
shape = win9x.border.left,
|
|
layout = wibox.container.background,
|
|
},
|
|
{
|
|
{
|
|
{ -- Left
|
|
{
|
|
awful.titlebar.widget.iconwidget(c),
|
|
left = 2,
|
|
right = 2,
|
|
top = 1,
|
|
bottom = 1,
|
|
layout = wibox.container.margin,
|
|
},
|
|
{
|
|
awful.titlebar.widget.titlewidget(c),
|
|
left = 2,
|
|
layout = wibox.container.margin,
|
|
},
|
|
buttons = buttons,
|
|
layout = wibox.layout.fixed.horizontal
|
|
},
|
|
{ -- Middle
|
|
--serenity_lines,
|
|
buttons = buttons,
|
|
layout = wibox.layout.flex.horizontal
|
|
},
|
|
{ -- Right
|
|
{
|
|
{
|
|
make_win9x_button(awful.titlebar.widget.ontopbutton(c)),
|
|
make_win9x_button(awful.titlebar.widget.stickybutton(c)),
|
|
make_win9x_button(awful.titlebar.widget.floatingbutton(c)),
|
|
layout = wibox.layout.fixed.horizontal,
|
|
},
|
|
{
|
|
make_win9x_button(awful.titlebar.widget.minimizebutton(c)),
|
|
make_win9x_button(awful.titlebar.widget.maximizedbutton(c)),
|
|
layout = wibox.layout.fixed.horizontal,
|
|
},
|
|
make_win9x_button(awful.titlebar.widget.closebutton(c)),
|
|
spacing = 2,
|
|
layout = wibox.layout.fixed.horizontal
|
|
},
|
|
left = 2,
|
|
right = 2,
|
|
top = 1,
|
|
bottom = 1,
|
|
layout = wibox.container.margin,
|
|
},
|
|
forced_height = 18,
|
|
layout = wibox.layout.align.horizontal,
|
|
},
|
|
{
|
|
wibox.widget({
|
|
widget = wibox.widget.separator,
|
|
color = beautiful.win9x_main,
|
|
orientation = "horizontal",
|
|
thickness = 2,
|
|
forced_height = 2,
|
|
border_width = 0,
|
|
}),
|
|
forced_height = 2,
|
|
layout = wibox.layout.fixed.vertical,
|
|
},
|
|
layout = wibox.layout.align.vertical,
|
|
},
|
|
{
|
|
wibox.widget({}),
|
|
forced_width = 4,
|
|
shape = win9x.border.right,
|
|
layout = wibox.container.background,
|
|
},
|
|
layout = wibox.layout.align.horizontal,
|
|
},
|
|
layout = wibox.layout.align.vertical,
|
|
})
|
|
end)
|
|
|
|
-- Enable sloppy focus, so that focus follows mouse.
|
|
--[[client.connect_signal("mouse::enter", function(c)
|
|
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
|
end)
|
|
|
|
client.connect_signal("focus", function(c)
|
|
c.border_color = beautiful.border_focus
|
|
end)
|
|
client.connect_signal("unfocus", function(c)
|
|
c.border_color = beautiful.border_normal
|
|
end)
|
|
--]]
|