convert everything to metatables and added rules
This commit is contained in:
@@ -1,24 +1,40 @@
|
|||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
|
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
local _M = {}
|
||||||
-- another config (This code will only ever execute for the fallback config)
|
|
||||||
if awesome.startup_errors then
|
|
||||||
naughty.notify({ preset = naughty.config.presets.critical,
|
|
||||||
title = "Oops, there were errors during startup!",
|
|
||||||
text = awesome.startup_errors })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle runtime errors after startup
|
function _M.get()
|
||||||
do
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
|
-- another config (This code will only ever execute for the fallback config)
|
||||||
|
if awesome.startup_errors then
|
||||||
|
naughty.notify({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
|
title = "Oops, there were errors during startup!",
|
||||||
|
text = awesome.startup_errors,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Handle runtime errors after startup
|
||||||
|
do
|
||||||
local in_error = false
|
local in_error = false
|
||||||
awesome.connect_signal("debug::error", function (err)
|
awesome.connect_signal("debug::error", function(err)
|
||||||
-- Make sure we don't go into an endless error loop
|
-- Make sure we don't go into an endless error loop
|
||||||
if in_error then return end
|
if in_error then
|
||||||
|
return
|
||||||
|
end
|
||||||
in_error = true
|
in_error = true
|
||||||
|
|
||||||
naughty.notify({ preset = naughty.config.presets.critical,
|
naughty.notify({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
title = "Oops, an error happened!",
|
title = "Oops, an error happened!",
|
||||||
text = tostring(err) })
|
text = tostring(err),
|
||||||
|
})
|
||||||
in_error = false
|
in_error = false
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
9
main/init.lua
Normal file
9
main/init.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local _M = {
|
||||||
|
error_handling = require("main.error_handling"),
|
||||||
|
rules = require("main.rules"),
|
||||||
|
layouts = require("main.layouts"),
|
||||||
|
taglist = require("main.taglist"),
|
||||||
|
user_vars = require("main.user_vars"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return _M
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
|
||||||
local _L = {}
|
local _M = {}
|
||||||
|
|
||||||
_L = {
|
function _M.get()
|
||||||
|
local _L = {}
|
||||||
|
|
||||||
|
_L = {
|
||||||
awful.layout.suit.tile,
|
awful.layout.suit.tile,
|
||||||
awful.layout.suit.fair,
|
awful.layout.suit.fair,
|
||||||
awful.layout.suit.max,
|
awful.layout.suit.max,
|
||||||
awful.layout.suit.floating,
|
awful.layout.suit.floating,
|
||||||
}
|
}
|
||||||
|
|
||||||
return _L
|
return _L
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
93
main/rules.lua
Normal file
93
main/rules.lua
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(clientkeys, clientbuttons)
|
||||||
|
local _R = {
|
||||||
|
{
|
||||||
|
rule = {},
|
||||||
|
properties = {
|
||||||
|
border_width = beautiful.border_width,
|
||||||
|
border_color = beautiful.border_normal,
|
||||||
|
focus = awful.client.focus.filter,
|
||||||
|
raise = true,
|
||||||
|
titlebars_enabled = false,
|
||||||
|
keys = clientkeys,
|
||||||
|
buttons = clientbuttons,
|
||||||
|
screen = awful.screen.preferred,
|
||||||
|
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Floating clients.
|
||||||
|
{
|
||||||
|
rule_any = {
|
||||||
|
instance = {
|
||||||
|
"DTA",
|
||||||
|
"copyq",
|
||||||
|
"pinentry",
|
||||||
|
},
|
||||||
|
class = {
|
||||||
|
"Arandr",
|
||||||
|
"Blueman-manager",
|
||||||
|
"Gpick",
|
||||||
|
"Kruler",
|
||||||
|
"MessageWin",
|
||||||
|
"Sxiv",
|
||||||
|
"Tor Browser",
|
||||||
|
"Wpa_gui",
|
||||||
|
"veromix",
|
||||||
|
"xtightvncviewer",
|
||||||
|
},
|
||||||
|
name = {
|
||||||
|
"Event Tester",
|
||||||
|
},
|
||||||
|
role = {
|
||||||
|
"AlarmWindow",
|
||||||
|
"ConfigManager",
|
||||||
|
"pop-up",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
properties = {
|
||||||
|
floating = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add titlebars to normal clients and dialogs
|
||||||
|
{
|
||||||
|
rule_any = {
|
||||||
|
type = { "normal", "dialog" },
|
||||||
|
},
|
||||||
|
properties = {
|
||||||
|
titlebars_enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
rule = { class = "Firefox" },
|
||||||
|
properties = {
|
||||||
|
screen = 1,
|
||||||
|
tag = RC.tags[2],
|
||||||
|
titlebars_enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
rule = { class = "Discord" },
|
||||||
|
properties = {
|
||||||
|
screen = 1,
|
||||||
|
tag = RC.tags[6],
|
||||||
|
titlebars_enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return _R
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -1,27 +1,37 @@
|
|||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
|
||||||
local _T = {}
|
local _M = {}
|
||||||
|
|
||||||
local tags = {
|
function _M.get()
|
||||||
|
local _T = {}
|
||||||
|
|
||||||
|
local tags = {
|
||||||
" Terminal",
|
" Terminal",
|
||||||
" Web",
|
" Web",
|
||||||
" Code",
|
" Code",
|
||||||
" Junk",
|
" Junk",
|
||||||
" Music",
|
" Music",
|
||||||
" Chat",
|
" Chat",
|
||||||
}
|
}
|
||||||
|
|
||||||
local layouts = {
|
local layouts = {
|
||||||
RC.layouts[0],
|
RC.layouts[0],
|
||||||
RC.layouts[1],
|
RC.layouts[1],
|
||||||
RC.layouts[2],
|
RC.layouts[2],
|
||||||
RC.layouts[3],
|
RC.layouts[3],
|
||||||
RC.layouts[3],
|
RC.layouts[3],
|
||||||
RC.layouts[3],
|
RC.layouts[3],
|
||||||
}
|
}
|
||||||
|
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
_T[s] = awful.tag(tags, s, layouts)
|
_T[s] = awful.tag(tags, s, layouts)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return _T
|
return _T
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
local _V = {}
|
local _M = {}
|
||||||
|
|
||||||
_V = {
|
function _M.get()
|
||||||
|
local _V = {}
|
||||||
|
|
||||||
|
_V = {
|
||||||
terminal = "alacritty",
|
terminal = "alacritty",
|
||||||
editor = os.getenv("EDITOR") or "nvim",
|
editor = os.getenv("EDITOR") or "nvim",
|
||||||
modkey = "Mod4",
|
modkey = "Mod4",
|
||||||
wallpaper = os.getenv("HOME") .. "/.config/awesome/theme/background.jpg",
|
wallpaper = os.getenv("HOME") .. "/.config/awesome/theme/background.jpg",
|
||||||
}
|
}
|
||||||
_V.editor_cmd = _V.terminal .. " -e " .. _V.editor
|
_V.editor_cmd = _V.terminal .. " -e " .. _V.editor
|
||||||
|
|
||||||
return _V
|
return _V
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
106
rc.lua
106
rc.lua
@@ -8,53 +8,22 @@ local wibox = require("wibox")
|
|||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local menubar = require("menubar")
|
local menubar = require("menubar")
|
||||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||||
|
local main = require("main")
|
||||||
require("awful.autofocus")
|
require("awful.autofocus")
|
||||||
require("main.error_handling")
|
require("main.error_handling")
|
||||||
|
|
||||||
beautiful.init(require("theme"))
|
beautiful.init(require("theme"))
|
||||||
|
|
||||||
RC = {}
|
RC = {}
|
||||||
RC.vars = require("main.user_vars")
|
RC.vars = main.user_vars()
|
||||||
RC.layouts = require("main.layouts")
|
RC.layouts = main.layouts()
|
||||||
RC.taglist = require("main.taglist")
|
RC.tags = main.taglist()
|
||||||
|
|
||||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||||
awful.layout.layouts = RC.layouts
|
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
|
-- Keyboard map indicator and switcher
|
||||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
-- mykeyboardlayout = awful.widget.keyboardlayout()
|
||||||
|
|
||||||
-- {{{ Wibar
|
-- {{{ Wibar
|
||||||
-- Create a textclock widget
|
-- Create a textclock widget
|
||||||
@@ -194,9 +163,6 @@ globalkeys = gears.table.join(
|
|||||||
awful.key({ RC.vars.modkey }, "k", function()
|
awful.key({ RC.vars.modkey }, "k", function()
|
||||||
awful.client.focus.byidx(-1)
|
awful.client.focus.byidx(-1)
|
||||||
end, { description = "focus previous by index", group = "client" }),
|
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
|
-- Layout manipulation
|
||||||
awful.key({ RC.vars.modkey, "Shift" }, "j", function()
|
awful.key({ RC.vars.modkey, "Shift" }, "j", function()
|
||||||
@@ -386,67 +352,7 @@ clientbuttons = gears.table.join(
|
|||||||
root.keys(globalkeys)
|
root.keys(globalkeys)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Rules
|
awful.rules.rules = main.rules(clientkeys, clientbuttons)
|
||||||
-- 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" } },
|
|
||||||
}
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- {{{ Signals
|
-- {{{ Signals
|
||||||
-- Signal function to execute when a new client appears.
|
-- Signal function to execute when a new client appears.
|
||||||
|
|||||||
Reference in New Issue
Block a user