awesomewm/rules.lua
Alexander Gehrke 8d61745f9c update rules
2021-07-12 11:47:57 +02:00

103 lines
4.2 KiB
Lua

local awful = require("awful")
awful.rules = require("awful.rules")
local localconf = require("localconf")
local beautiful = require("beautiful")
local binder = binder or require("separable.binder")
local log = require("talkative")
-- create a notification when given client becomes urgent
local function popup_urgent(client, message)
client:connect_signal("property::urgent", function (c)
if c.urgent and not c.focus then
naughty.notify({ text=message })
end
end)
end
if not localconf.screen then
localconf.screen = {}
end
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())
print("Screens: main: ".. screen_main .. ", chat: ".. screen_chat .. ", mail: " .. screen_mail)
awful.rules.rules = {
-- All clients will match this rule.
{
rule = { },
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,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
},
-- log name and class of new windows for debugging purposes
callback = function(c)
log("-----------\nnew client\n")
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 }},
{ rule_any = { class = {"Pidgin"}, instance = {"Weechat"}, name = {"Weechat"}},
properties = { screen = screen_chat, tag = "3", opacity = 0.8 },
callback = function(c) popup_urgent(c, "new chat message") end},
{ rule = { role = "buddy_list" },
callback = awful.client.setmaster},
{ rule = { class = "Steam", name = "Friends" },
properties = { screen = screen_chat, tag = "3" },
callback = awful.client.setmaster},
{ rule = { class = "Steam", name = "Chat" },
properties = { screen = screen_chat, tag = "3" },
callback = awful.client.setslave },
{ rule = { class = "Steam", name = "Steam" },
properties = { tag = "F1" }},
{ rule_any = { class = {"Rocket.Chat"}, instance = {"rocket.chat"}},
properties = { screen = screen_chat, tag = "5" }},
{ rule_any = { class = {"Element"}, instance = {"element"}},
properties = { screen = screen_chat, tag = "1" }},
{ rule = { class = "Telegram" },
except = { name = "Media viewer" },
properties = { screen = screen_chat, tag = "3" }},
{ rule = { class = "Telegram", name = "Media viewer" },
properties = { size_hints_honor = true, float = 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, float = true, fullscreen = true }},
{ rule_any = { class = {"URxvt", "Alacritty", "GVim", "kitty" }},
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 = "Onboard" },
properties = { sticky = true, ontop = true, focusable = false}},
}