awesomewm/rules.lua

146 lines
5.5 KiB
Lua
Raw Permalink Normal View History

2014-08-28 08:58:03 +00:00
local awful = require("awful")
awful.rules = require("awful.rules")
local localconf = require("localconf")
2014-08-28 08:58:03 +00:00
local beautiful = require("beautiful")
2024-02-06 16:25:23 +00:00
local naughty = require("naughty")
local binder = require("separable.binder")
2017-09-13 17:30:10 +00:00
local log = require("talkative")
2010-06-06 02:56:07 +00:00
-- create a notification when given client becomes urgent
local function popup_urgent(client, message)
2024-04-25 15:13:43 +00:00
client:connect_signal("property::urgent", function(c)
2021-07-12 09:40:53 +00:00
if c.urgent and not c.focus then
2024-04-25 15:13:43 +00:00
naughty.notify({ text = message })
2021-07-12 09:40:53 +00:00
end
end)
end
local function keyboard_layer(num)
return function(client)
client:connect_signal("focus", function(c)
awful.util.spawn("kontroll-launch set-layer --index " .. num)
naughty.notify({ text = "kontroll: switching to layer " .. num })
end)
client:connect_signal("unfocus", function(c)
awful.util.spawn("kontroll-launch set-layer --index 0")
naughty.notify({ text = "kontroll: switching to base layer" })
end)
end
end
if not localconf.screen then
2021-07-12 09:40:53 +00:00
localconf.screen = {}
end
2021-03-24 13:07:42 +00:00
local screen_main = math.min(localconf.screen.main or 1, screen.count())
local screen_chat = math.min(localconf.screen.chat or screen.count(), screen.count())
local screen_mail = math.min(localconf.screen.mail or screen.count(), screen.count())
2024-04-25 15:13:43 +00:00
print("Screens: main: " .. screen_main .. ", chat: " .. screen_chat .. ", mail: " .. screen_mail)
awful.rules.rules = {
2021-06-23 11:05:45 +00:00
-- All clients will match this rule.
{
2024-04-25 15:13:43 +00:00
rule = {},
2021-06-23 11:05:45 +00:00
properties = {
border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
minimized = false,
size_hints_honor = false,
keys = binder.client.keys(),
buttons = binder.client.buttons(),
screen = awful.screen.preferred,
2024-04-25 15:13:43 +00:00
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
2021-06-23 11:05:45 +00:00
},
-- log name and class of new windows for debugging purposes
callback = function(c)
log("-----------\nnew client\n")
2024-04-25 15:13:43 +00:00
if c["name"] ~= nil then
log("name: " .. c["name"])
end
if c["class"] ~= nil then
log("class: " .. c["class"])
end
if c["type"] ~= nil then
log("type: " .. c["type"])
end
if c["instance"] ~= nil then
log("instance: " .. c["instance"])
end
end,
},
{ rule = { class = "qutebrowser" }, properties = { tag = "2" } },
{ rule = { class = "Passprompt" }, properties = { ontop = true, focus = true } },
{ rule = { class = "Dragon" }, properties = { ontop = true, sticky = true } },
{ rule = { class = "Sm" }, properties = { floating = true, size_hints_honor = true, fullscreen = true } },
{
rule_any = { class = { "pinentry", "Passprompt", "copyq" } },
properties = { floating = true, size_hints_honor = true },
2021-06-23 11:05:45 +00:00
},
2024-04-25 15:13:43 +00:00
{
rule_any = { class = { "Pidgin" }, instance = { "Weechat" }, name = { "Weechat" } },
2021-06-23 11:05:45 +00:00
properties = { screen = screen_chat, tag = "3", opacity = 0.8 },
2024-04-25 15:13:43 +00:00
callback = function(c)
popup_urgent(c, "new chat message")
end,
},
{ rule = { role = "buddy_list" }, callback = awful.client.setmaster },
{ rule_any = { class = { "factorio" } }, callback = keyboard_layer(3) },
2024-04-25 15:13:43 +00:00
{
rule = { class = "steam", name = "Friends" },
2021-06-23 11:05:45 +00:00
properties = { screen = screen_chat, tag = "3" },
2024-04-25 15:13:43 +00:00
callback = awful.client.setmaster,
},
{
rule = { class = "steam", name = "Chat" },
2021-06-23 11:05:45 +00:00
properties = { screen = screen_chat, tag = "3" },
2024-04-25 15:13:43 +00:00
callback = awful.client.setslave,
},
{ rule = { class = "steam", name = "Steam" }, properties = { tag = "F1" } },
{
rule_any = { class = { "Rocket.Chat", "rocketchat" }, instance = { "rocket.chat" } },
properties = { screen = screen_chat, tag = "5" },
},
{
2024-06-27 13:03:01 +00:00
rule_any = { class = { "Element", "SchildiChat" }, instance = { "element", "schildichat" } },
2024-04-25 15:13:43 +00:00
properties = { screen = screen_chat, tag = "1" },
},
{
rule = { class = "TelegramDesktop" },
2021-06-23 11:05:45 +00:00
except = { name = "Media viewer" },
2024-04-25 15:13:43 +00:00
properties = { screen = screen_chat, tag = "3" },
},
{
rule = { class = "Telegram", name = "Media viewer" },
properties = { size_hints_honor = true, floating = true, fullscreen = true },
},
{
rule = { class = "TelegramDesktop", name = "Media viewer" },
properties = { size_hints_honor = true, floating = true, fullscreen = true },
},
{ rule_any = { role = { "conversation" }, instance = { "Weechat" } }, callback = awful.client.setslave },
{ rule = { class = "Irssi" }, properties = { tag = "3" }, callback = awful.client.setslave },
{ rule_any = { instance = { "Gmutt" }, name = { "Gmutt" } }, properties = { tag = "4", screen = screen_mail } },
{ rule_any = { class = { "Gmpc", "Spotify" } }, properties = { tag = "6" } },
{ rule = { class = "Pdfpc" }, properties = { size_hints_honor = true, floating = true, fullscreen = true } },
{
rule = { class = "zoom", instance = "zoom", name = "zoom" },
properties = { size_hints_honor = true, floating = false, border_width = 0 },
},
{ rule_any = { class = { "URxvt", "Alacritty", "GVim", "kitty", "handy" } }, properties = { opacity = 0.9 } },
{ rule = { name = "Awesomelog" }, properties = { tag = "F4" } },
{ rule = { class = "Dragon" }, properties = { sticky = true, ontop = true } },
{ rule = { class = "adobe dng converter.exe" }, properties = { floating = true, size_hints_honor = true } },
{ rule = { class = "pentablet", type = "normal" }, properties = { floating = true, size_hints_honor = true } },
{
rule = { class = "pentablet", type = "utility" },
properties = { floating = true, size_hints_honor = true, focusable = false },
},
{ rule = { class = "Onboard" }, properties = { sticky = true, ontop = true, focusable = false } },
2024-06-27 13:03:01 +00:00
{
rule = { class = "zenity" },
properties = { ontop = true, floating = true, placement = awful.placement.centered },
},
}