convert everything to metatables and added rules

This commit is contained in:
Noella
2024-03-04 18:38:56 -07:00
parent 497a6bd76c
commit 1e248a903d
7 changed files with 212 additions and 158 deletions

106
rc.lua
View File

@@ -8,53 +8,22 @@ local wibox = require("wibox")
local beautiful = require("beautiful")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
local main = require("main")
require("awful.autofocus")
require("main.error_handling")
beautiful.init(require("theme"))
RC = {}
RC.vars = require("main.user_vars")
RC.layouts = require("main.layouts")
RC.taglist = require("main.taglist")
RC.vars = main.user_vars()
RC.layouts = main.layouts()
RC.tags = main.taglist()
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = RC.layouts
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{
"hotkeys",
function()
hotkeys_popup.show_help(nil, awful.screen.focused())
end,
},
{ "manual", RC.vars.terminal .. " -e man awesome" },
{ "edit config", RC.vars.editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{
"quit",
function()
awesome.quit()
end,
},
}
mymainmenu = awful.menu({
items = {
{ "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", RC.vars.terminal },
},
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = RC.vars.terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
@@ -194,9 +163,6 @@ globalkeys = gears.table.join(
awful.key({ RC.vars.modkey }, "k", function()
awful.client.focus.byidx(-1)
end, { description = "focus previous by index", group = "client" }),
awful.key({ RC.vars.modkey }, "w", function()
mymainmenu:show()
end, { description = "show main menu", group = "awesome" }),
-- Layout manipulation
awful.key({ RC.vars.modkey, "Shift" }, "j", function()
@@ -386,67 +352,7 @@ clientbuttons = gears.table.join(
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
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,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
},
},
-- Floating clients.
{
rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"Wpa_gui",
"veromix",
"xtightvncviewer",
},
-- Note that the name property shown in xprop might be set slightly after creation of the client
-- and the name shown there might not match defined rules here.
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
},
},
properties = { floating = true },
},
-- Add titlebars to normal clients and dialogs
{ rule_any = { type = { "normal", "dialog" } }, properties = { titlebars_enabled = true } },
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
awful.rules.rules = main.rules(clientkeys, clientbuttons)
-- {{{ Signals
-- Signal function to execute when a new client appears.