-- luacheck: globals awesome screen debug_print pcall(require, "luarocks.loader") local awful = require("awful") local beautiful = require("beautiful") local cyclefocus = require("cyclefocus") local lain = require("lain") local naughty = require("naughty") local wibox = require("wibox") require("awful.autofocus") require("awful.hotkeys_popup.keys") -- 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 awesome.connect_signal("debug::error", function (err) -- Make sure we don't go into an endless error loop if in_error then return end in_error = true naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, an error happened!", text = tostring(err) }) in_error = false end) end function debug_print(...) local str = "" local args = {...} for i, val in ipairs(args) do str = str .. tostring(val) .. (i == #args and "" or "\n") end naughty.notify({ title = "debug", text = str }) end local vars = require("modules/vars") -- Table of layouts to cover with awful.layout.inc, order matters. -- this HAS to be set before everything so it sets default layout properly awful.layout.layouts = {} for _, layout in ipairs(vars.config.layouts) do local layoutRef = awful.layout.suit if layout:find("^lain:") then layoutRef = lain.layout layout = layout:gsub("^lain:","") end if layout:find("%.") then local perStart, perEnd = layout:find("%.") local first = layout:sub(1, perStart - 1) local second = layout:sub(perEnd + 1, #layout) table.insert(awful.layout.layouts, layoutRef[first][second]) else table.insert(awful.layout.layouts, layoutRef[layout]) end end local utils = require("modules/utils") require("modules/theme") require("modules/bar") require("modules/binds") require("modules/windows") require("modules/titlebar") -- cyclefocus settings cyclefocus.move_mouse_pointer = false cyclefocus.cycle_filters = { function() return true end, } cyclefocus.preset_for_offset = { default = function(preset, args) preset.font = vars.config.font preset.icon_size = 16 local title = cyclefocus.get_client_title(args.client, false) local col = args.client.minimized and beautiful.fg_minimize or beautiful.fg_normal preset.text = lain.util.markup(col, title) end, ["0"] = function(preset, args) preset.font = vars.config.font preset.icon_size = 16 preset.text = lain.util.markup(beautiful.tasklist_fg_focus, cyclefocus.get_client_title(args.client, false)) end, } cyclefocus.icon_col_width = 2 -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", utils.set_wallpaper) -- Autostart -- taken from: https://gitlab.com/luna/til/-/blob/main/awesome/rc.lua awful.spawn.with_line_callback(vars.env.HOME .. "/.local/bin/autostart.sh", { stdout = function() --[[naughty.notify({ title = "autostart", text = "pid: "..line.." already started", timeout = 7, position = "top_right" })--]] end, exit = function(reason, code) local data = { title = "autostart exited", text = reason .. ' ' .. code, timeout = 4, } if reason ~= "exit" and code ~= 0 then data.preset = naughty.config.presets.critical end naughty.notify(data) end }) --}}}