2022-12-05 01:49:49 +00:00
|
|
|
local naughty = require("naughty")
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
|
2023-12-29 20:53:47 +00:00
|
|
|
-- Error handling
|
2022-12-05 01:49:49 +00:00
|
|
|
naughty.connect_signal(
|
2023-12-28 04:35:27 +00:00
|
|
|
"request::display_error",
|
|
|
|
function(message, startup)
|
|
|
|
naughty.notification {
|
|
|
|
urgency = "critical",
|
|
|
|
title = "Oops, an error happened" .. (startup and " during startup!" or "!"),
|
|
|
|
message = message
|
|
|
|
}
|
|
|
|
end
|
2022-12-05 01:49:49 +00:00
|
|
|
)
|
|
|
|
|
2023-12-29 20:53:47 +00:00
|
|
|
-- Signals
|
2023-06-24 14:15:08 +00:00
|
|
|
-- no borders when rearranging only 1 non-floating or maximized client
|
2022-12-05 01:49:49 +00:00
|
|
|
screen.connect_signal(
|
2023-12-28 04:35:27 +00:00
|
|
|
"arrange",
|
|
|
|
function(s)
|
|
|
|
local max = s.selected_tag.layout.name == "max"
|
|
|
|
local only_one = #s.tiled_clients == 1 -- use tiled_clients so that other floating windows don't affect the count
|
|
|
|
-- but iterate over clients instead of tiled_clients as tiled_clients doesn't include maximized windows
|
|
|
|
for _, c in pairs(s.clients) do
|
|
|
|
if (max or only_one) and not c.floating or c.maximized then
|
|
|
|
c.border_width = 0
|
|
|
|
else
|
|
|
|
c.border_width = beautiful.border_width
|
|
|
|
end
|
|
|
|
end
|
2022-12-05 01:49:49 +00:00
|
|
|
end
|
|
|
|
)
|
2023-12-29 20:53:47 +00:00
|
|
|
|
|
|
|
-- 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)
|
2024-08-11 21:30:43 +00:00
|
|
|
|
|
|
|
-- keep floating windows on top
|
|
|
|
client.connect_signal("property::floating", function(c)
|
|
|
|
if not c.fullscreen then
|
|
|
|
if c.floating then
|
|
|
|
c.ontop = true
|
|
|
|
else
|
|
|
|
c.ontop = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|