2022-03-26 08:33:46 -05:00
|
|
|
-- Standard awesome library
|
|
|
|
local gears = require("gears")
|
2022-02-21 05:10:32 -06:00
|
|
|
local awful = require("awful")
|
2022-03-26 08:33:46 -05:00
|
|
|
|
|
|
|
-- Theme handling library
|
2022-02-21 05:10:32 -06:00
|
|
|
local beautiful = require("beautiful")
|
2022-03-26 08:33:46 -05:00
|
|
|
|
|
|
|
-- Notification handling library
|
|
|
|
local naughty = require("naughty")
|
|
|
|
|
|
|
|
-- Ruled
|
2022-02-21 05:10:32 -06:00
|
|
|
local ruled = require("ruled")
|
|
|
|
|
2022-03-26 08:33:46 -05:00
|
|
|
-- Helpers
|
|
|
|
local helpers = require("helpers")
|
|
|
|
|
|
|
|
-- Get screen geometry
|
|
|
|
local screen_width = awful.screen.focused().geometry.width
|
|
|
|
local screen_height = awful.screen.focused().geometry.height
|
|
|
|
|
2022-02-21 05:10:32 -06:00
|
|
|
ruled.client.connect_signal("request::rules", function()
|
2022-04-25 09:51:27 -05:00
|
|
|
-- Global
|
|
|
|
ruled.client.append_rule({
|
|
|
|
id = "global",
|
|
|
|
rule = {},
|
|
|
|
properties = {
|
|
|
|
focus = awful.client.focus.filter,
|
|
|
|
raise = true,
|
|
|
|
size_hints_honor = false,
|
|
|
|
screen = awful.screen.preferred,
|
|
|
|
titlebars_enabled = beautiful.titlebar_enabled,
|
|
|
|
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Tasklist order
|
|
|
|
ruled.client.append_rule({
|
|
|
|
id = "tasklist_order",
|
|
|
|
rule = {},
|
|
|
|
properties = {},
|
|
|
|
callback = awful.client.setslave,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Titlebar rules
|
|
|
|
ruled.client.append_rule({
|
|
|
|
id = "titlebars",
|
|
|
|
rule_any = {
|
|
|
|
class = {
|
|
|
|
"discord",
|
|
|
|
"Spotify",
|
|
|
|
"Org.gnome.Nautilus",
|
|
|
|
},
|
|
|
|
type = {
|
|
|
|
"splash",
|
|
|
|
},
|
|
|
|
name = {
|
|
|
|
"^discord.com is sharing your screen.$", -- Discord (running in browser) screen sharing popup
|
|
|
|
},
|
|
|
|
},
|
|
|
|
properties = {
|
|
|
|
titlebars_enabled = false,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Float
|
|
|
|
ruled.client.append_rule({
|
|
|
|
id = "floating",
|
|
|
|
rule_any = {
|
|
|
|
instance = {
|
|
|
|
"Devtools", -- Firefox devtools
|
|
|
|
},
|
|
|
|
class = {
|
|
|
|
"Lxappearance",
|
|
|
|
"Nm-connection-editor",
|
|
|
|
},
|
|
|
|
name = {
|
|
|
|
"Event Tester", -- xev
|
|
|
|
},
|
|
|
|
role = {
|
|
|
|
"AlarmWindow",
|
|
|
|
"pop-up",
|
|
|
|
"GtkFileChooserDialog",
|
|
|
|
"conversation",
|
|
|
|
},
|
|
|
|
type = {
|
|
|
|
"dialog",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
properties = { floating = true, placement = helpers.centered_client_placement },
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Centered
|
|
|
|
ruled.client.append_rule({
|
|
|
|
id = "centered",
|
|
|
|
rule_any = {
|
|
|
|
type = {
|
|
|
|
"dialog",
|
|
|
|
},
|
|
|
|
class = {
|
|
|
|
-- "discord",
|
|
|
|
},
|
|
|
|
role = {
|
|
|
|
"GtkFileChooserDialog",
|
|
|
|
"conversation",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
properties = { placement = helpers.centered_client_placement },
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Music clients (usually a terminal running ncmpcpp)
|
|
|
|
|
|
|
|
-- Image viewers
|
|
|
|
ruled.client.append_rule({
|
|
|
|
rule_any = {
|
|
|
|
class = {
|
|
|
|
"feh",
|
|
|
|
"imv",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
properties = {
|
|
|
|
floating = true,
|
|
|
|
width = screen_width * 0.7,
|
|
|
|
height = screen_height * 0.75,
|
|
|
|
},
|
|
|
|
callback = function(c)
|
|
|
|
awful.placement.centered(c, { honor_padding = true, honor_workarea = true })
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Mpv
|
|
|
|
ruled.client.append_rule({
|
|
|
|
rule = { class = "mpv" },
|
|
|
|
properties = {},
|
|
|
|
callback = function(c)
|
|
|
|
-- make it floating, ontop and move it out of the way if the current tag is maximized
|
|
|
|
if awful.layout.get(awful.screen.focused()) == awful.layout.suit.floating then
|
|
|
|
c.floating = true
|
|
|
|
c.ontop = true
|
|
|
|
c.width = screen_width * 0.30
|
|
|
|
c.height = screen_height * 0.35
|
|
|
|
awful.placement.bottom_right(c, {
|
|
|
|
honor_padding = true,
|
|
|
|
honor_workarea = true,
|
|
|
|
margins = { bottom = beautiful.useless_gap * 2, right = beautiful.useless_gap * 2 },
|
|
|
|
})
|
|
|
|
awful.titlebar.hide(c, beautiful.titlebar_pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- restore `ontop` after fullscreen is disabled
|
|
|
|
c:connect_signal("property::fullscreen", function()
|
|
|
|
if not c.fullscreen then
|
|
|
|
c.ontop = true
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end,
|
|
|
|
})
|
2022-02-21 05:10:32 -06:00
|
|
|
end)
|