Reworked config, added module autoloader

master
Mark 2022-07-16 19:06:55 -07:00
parent 9da54839fb
commit 2c034c36ed
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
20 changed files with 256 additions and 292 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
conf.lua

View File

@ -19,7 +19,7 @@
"conf_dir", "conf_dir",
"req_rel", "req_rel",
"debug_message", "debug_message",
"conf", "config",
"core", "core",
"modules" "modules"

View File

@ -37,48 +37,9 @@ return gears.table.join(
} }
), ),
awful.key( {"Mod4", "Shift", "Control"}, "1",
function ()
awful.spawn(conf.app_1)
end,
{
description = "Run app 1",
group = "Launcher"
}
),
awful.key( {"Mod4", "Shift", "Control"}, "2",
function ()
awful.spawn(conf.app_2)
end,
{
description = "Run app 2",
group = "Launcher"
}
),
awful.key( {"Mod4", "Shift", "Control"}, "3",
function ()
awful.spawn(conf.app_3)
end,
{
description = "Run app 3",
group = "Launcher"
}
),
awful.key( {"Mod4", "Shift", "Control"}, "4",
function ()
awful.spawn(conf.app_4)
end,
{
description = "Run app 4",
group = "Launcher"
}
),
awful.key( {"Mod4"}, "Return", awful.key( {"Mod4"}, "Return",
function () function ()
awful.spawn(conf.terminal) awful.spawn(config.core.terminal)
end, end,
{ {
@ -89,7 +50,7 @@ return gears.table.join(
awful.key( {"Mod4"}, "\\", awful.key( {"Mod4"}, "\\",
function () function ()
awful.spawn(conf.browser) awful.spawn(config.core.browser)
end, end,
{ {

View File

@ -1,165 +0,0 @@
-- Per-machine config file
-- Make a copy of this file named "conf.lua"
-- and set options there.
local conf = {}
conf.screenshot_dir = "screenshot_target_dir"
-- See bar.shortcuts
conf.app_icon_dir = "theme_icon_dir"
-- Mount root dir for system mount keybind.
-- Must end with a /.
conf.user_mount_root = "user_mount_path"
-- Should tag indicators be updated continuously?
-- Once every two seconds. The timer is in desktop.init
conf.continuous_tag_updates = true
-- Wallpaper configuration
-- Wallpapers are managed by the desktop module.
-- Static walls will be set in desktop/init.lua; dynamic, time-based
-- walls will be managed by desktop/wallpaper.lua
--
-- Static: a path to an image file
conf.wallpaper = "path-to-wallpaper.png"
--
-- Dynamic: a table of files and times
-- {file = "path", start_time = {hour, minute}}
--[[
conf.wallpaper = {
{ file = "morning-file.png", start_time = {04, 00} },
{ file = "noon-file.png", start_time = {11, 00} },
{ file = "night-file.png", start_time = {19, 00} },
}
]]--
-- Enable/disable the battery and backlight control and widgets
conf.battery_enabled = false
conf.backlight_enabled = false
-- Fixed width of all clienticons in tasklist
conf.clienticon_width = 50
-- The position of the bar on each screen
conf.bar_position = "bottom"
-- Bar size in dpi
conf.bar_height = 44
-- Size of bar widget margins
conf.bar_margin = 3
-- A list of shortcuts in the bar.
--[[ defined as follows:
conf.bar_shortcuts = {
{
"command-to-run",
"icon-file" (relative to conf.app_icon_dir)
},
}
]]--
conf.bar_shortcuts = {}
-- Enable/Disable the MPC widget
conf.mpc_enabled = true
-- MPC server. Usually localhost.
-- If your MPC server has a password, use the following format: "passwd@host"
conf.mpd_host = "localhost"
-- Fixed width of the mpc widget
conf.mpc_width = 250
-- Preferred terminal.
conf.terminal = "kitty"
-- Preferred browser.
conf.browser = "firefox-developer-edition --new-tab"
-- The pulse sink volume widgets and keybinds should use.
-- To use the default, keep this value an empty string.
-- Applies the --sink option to pamixer in wrapper.volume
conf.pamixer_sink = ""
-- Table of layouts.
-- This is not handled by the regular awesomewm facility.
-- It's handled by layoutmanager, to add extra features.
--
-- This table is a table of tables.
-- (see the example)
-- the tables it contains are groups, switched through using the main
-- layout keybind.
--
-- groups contain one or more layouts. The first layout is selected by default,
-- and is used whenever that group is seleced.
-- Likewise, the first group is the default, and is applied to all tags at the start.
conf.layouts = {
{
awful.layout.suit.tile.left,
awful.layout.suit.tile,
},
{
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
},
{
awful.layout.suit.floating,
}
--awful.layout.suit.tile.bottom,
--awful.layout.suit.tile.top,
--awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle,
--awful.layout.suit.max,
--awful.layout.suit.max.fullscreen,
--awful.layout.suit.magnifier,
--awful.layout.suit.corner.nw,
--awful.layout.suit.corner.ne,
--awful.layout.suit.corner.sw,
--awful.layout.suit.corner.se,
}
-- Order matters!
-- The first entry will be activated at startup.
-- Use ibus engine to get the current engine name.
-- DUPLICATE IBUS_ENGINE VALUES WILL BREAK THE SWITCHER!
--
-- Some overlay layours require a switch to en:us first.
-- For example, switching from russian (xkb remap) to pinyin (ibus overlay on en:us)
-- will not work.
--
conf.ibus_language_list = {
{
title = "English",
indicator_code = "en",
ibus_engine = "xkb:us::eng",
},
{
title = "Russian",
indicator_code = "ru",
ibus_engine = "xkb:ru::rus"
},
{
title = "Mathwriter",
indicator_code = "∫x",
ibus_engine = "table:mathwriter-ibus",
requires_engine = "xkb:us::eng"
}
}
-- Run these commands, in this order, when awesome starts.
conf.startup_commands = {
"ibus-daemon --daemonize --replace --xim",
"keepassxc",
"mictray"
}
return conf

184
config.lua Executable file
View File

@ -0,0 +1,184 @@
-- Per-machine config file
-- Make a copy of this file named "config.lua"
-- and set options there.
local config = {}
config.core = {
wallpaper = "/home/assets/wallpapers/Themed/Stellaris/Gigapixel/City.png",
--
-- Dynamic: a table of files and times
-- {file = "path", start_time = {hour, minute}}
--[[
config.wallpaper = {
{ file = "morning-file.png", start_time = {04, 00} },
{ file = "noon-file.png", start_time = {11, 00} },
{ file = "night-file.png", start_time = {19, 00} },
}
]]--
-- Fixed width of all clienticons in tasklist
clienticon_width = 50,
-- The position of the bar on each screen
bar_position = "bottom",
-- Bar size in dpi
bar_height = 50,
-- Size of bar widget margins
bar_margin = 3,
-- Preferred terminal.
terminal = "kitty",
-- Preferred browser.
browser = "firefox-developer-edition --new-tab",
-- Table of layouts.
-- This is not handled by the regular awesomewm facility.
-- It's handled by layoutmanager, to add extra features.
--
-- This table is a table of tables.
-- (see the example)
-- the tables it contains are groups, switched through using the main
-- layout keybind.
--
-- groups contain one or more layouts. The first layout is selected by default,
-- and is used whenever that group is seleced.
-- Likewise, the first group is the default, and is applied to all tags at the start.
layouts = {
{
awful.layout.suit.tile.left,
awful.layout.suit.tile,
},
{
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
},
{
awful.layout.suit.floating,
}
--awful.layout.suit.tile.bottom,
--awful.layout.suit.tile.top,
--awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle,
--awful.layout.suit.max,
--awful.layout.suit.max.fullscreen,
--awful.layout.suit.magnifier,
--awful.layout.suit.corner.nw,
--awful.layout.suit.corner.ne,
--awful.layout.suit.corner.sw,
--awful.layout.suit.corner.se,
},
-- Run these commands, in this order, when awesome starts.
startup_commands = {
"ibus-daemon --daemonize --replace --xim",
"keepassxc",
"mictray"
},
continuous_tag_updates = true,
app_icon_dir = "/home/assets/icons/papirus/",
bar_shortcuts = {
{
"pcmanfm",
"places/folder-green.svg"
},
{
"firefox-developer-edition",
"apps/firefox-developer-icon.svg"
},
{
"thunderbird",
"apps/thunderbird.svg"
},
{
"onlyoffice-desktopeditors",
"apps/libreoffice-writer.svg"
},
{
"signal-desktop",
"apps/signal-desktop.svg"
},
{
"keepassxc",
"apps/password-manager.svg"
}
}
}
config.mpc = {
enabled = true,
-- If your MPC server has a password, do "passwd@host"
host = "localhost",
-- Fixed width of the mpc widget
width = 250,
}
config.screenshot = {
enabled = true,
-- Should end with a slash
save_dir = "/home/mark/Desktop/Documents/screenshots/"
}
config.battery = {
enabled = false
}
config.backlight = {
enabled = false
}
config.volume = {
enabled = true,
-- The pulse sink volume widgets and keybinds should use.
-- To use the default, keep this value an empty string.
-- Applies the --sink option to pamixer in wrapper.volume
pamixer_sink = ""
}
config.simple_widgets = { enabled = true }
config.launcher = { enabled = true }
config.ibus = {
enabled = true,
-- The first entry will be activated at startup.
-- Use ibus engine to get the current engine name.
-- DUPLICATE IBUS_ENGINE VALUES WILL BREAK THE SWITCHER!
--
-- Some overlay layours require a switch to en:us first.
-- For example, switching from russian (xkb remap) to pinyin (ibus overlay on en:us)
-- will not work. `requires_engine` fixes this.
-- If it is defined, we will switch to that engine before switching to ibus_engine.
language_list = {
{
title = "English",
indicator_code = "en",
ibus_engine = "xkb:us::eng",
},
{
title = "Russian",
indicator_code = "ru",
ibus_engine = "xkb:ru::rus"
},
{
title = "Mathwriter",
indicator_code = "∫x",
ibus_engine = "table:mathwriter-ibus",
requires_engine = "xkb:us::eng"
}
}
}
return config

View File

@ -7,9 +7,9 @@ local LayoutManager = {}
-- Get group from layout -- Get group from layout
-- We assume that this layout is in conf.layouts -- We assume that this layout is in config.core.layouts
function LayoutManager:get_group(layout) function LayoutManager:get_group(layout)
for k, v in pairs(conf.layouts) do for k, v in pairs(config.core.layouts) do
for l, m in pairs(v) do for l, m in pairs(v) do
if (layout == m) then if (layout == m) then
return k return k
@ -19,7 +19,7 @@ function LayoutManager:get_group(layout)
end end
function LayoutManager:get_alt(layout) function LayoutManager:get_alt(layout)
for k, v in pairs(conf.layouts) do for k, v in pairs(config.core.layouts) do
for l, m in pairs(v) do for l, m in pairs(v) do
if (layout == m) then if (layout == m) then
return l return l
@ -31,7 +31,7 @@ end
function LayoutManager:default_layout() function LayoutManager:default_layout()
return conf.layouts[1][1] return config.core.layouts[1][1]
end end
-- Change layout group -- Change layout group
@ -44,9 +44,9 @@ function LayoutManager:group(step)
local group = self:get_group(layout) - 1 local group = self:get_group(layout) - 1
group = ((group + step) % #conf.layouts) + 1 group = ((group + step) % #config.core.layouts) + 1
awful.layout.set(conf.layouts[group][1], tag) awful.layout.set(config.core.layouts[group][1], tag)
end end
-- Change layout alternate -- Change layout alternate
@ -60,9 +60,9 @@ function LayoutManager:alt(step)
local group = self:get_group(layout) local group = self:get_group(layout)
alt = ((alt + step) % #conf.layouts[group]) + 1 alt = ((alt + step) % #config.core.layouts[group]) + 1
awful.layout.set(conf.layouts[group][alt], tag) awful.layout.set(config.core.layouts[group][alt], tag)
end end
function LayoutManager:next() function LayoutManager:next()

View File

@ -1,13 +1,6 @@
local function start() local function start()
local desktop = { local desktop = {
widgets = { widgets = {
tasklist = require("core.tasklist"),
textclock = modules.simple_widgets.textclock,
keymap = modules.ibus.widgets.ibus,
volume = modules.volume.widgets.volume,
launcher = modules.launcher.widgets.launcher,
shortcut = modules.simple_widgets.make_shortcut,
space = function(size) space = function(size)
return wibox.widget { return wibox.widget {
{ {
@ -39,6 +32,7 @@ local function start()
} }
local tasklist = require("core.tasklist")
-- Manages tag grid and widget -- Manages tag grid and widget
local tagger = require("core.tagger.tagger") local tagger = require("core.tagger.tagger")
@ -48,19 +42,6 @@ local function start()
local make_layoutbox = require("core.layouts.widget") local make_layoutbox = require("core.layouts.widget")
-- Load conditional modules
if conf.backlight_enabled then
desktop.widgets.backlight = modules.backlight.widgets.backlight
end
if conf.battery_enabled then
desktop.widgets.battery = modules.battery.widgets.battery
end
if conf.mpc_enabled then
desktop.widgets.mpc = modules.mpc.widgets.mpc
end
-- If timed wallpaper is enabled, load timed manager -- If timed wallpaper is enabled, load timed manager
if (type(beautiful.wallpaper) == "table") then if (type(beautiful.wallpaper) == "table") then
desktop.wallpaper = require("desktop.wallpaper") desktop.wallpaper = require("desktop.wallpaper")
@ -89,7 +70,7 @@ local function start()
timeout = 2, timeout = 2,
call_now = false, call_now = false,
autostart = true, autostart = true,
single_shot = not conf.continuous_tag_updates, single_shot = not config.core.continuous_tag_updates,
callback = function() callback = function()
for s in screen do for s in screen do
@ -112,12 +93,12 @@ local function start()
-- Create the bar -- Create the bar
s.bar = awful.wibar({ s.bar = awful.wibar({
position = conf.bar_position, position = config.core.bar_position,
screen = s, screen = s,
--bg = "#00000000", --bg = "#00000000",
bg = beautiful.color.bar.color, bg = beautiful.color.bar.color,
border_width = 0, border_width = 0,
height = beautiful.dpi(conf.bar_height), height = beautiful.dpi(config.core.bar_height),
type = "desktop" type = "desktop"
}) })
@ -134,14 +115,14 @@ local function start()
end) end)
-- Create shortcut list from config value -- Create shortcut list from config value
if (#conf.bar_shortcuts > 0) then if (#config.core.bar_shortcuts > 0) then
s.shortcuts = { s.shortcuts = {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
desktop.widgets.separator(2, 5, 3), desktop.widgets.separator(2, 5, 3),
desktop.widgets.space(6) desktop.widgets.space(6)
} }
for k, v in pairs(conf.bar_shortcuts) do for k, v in pairs(config.core.bar_shortcuts) do
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut(v[1], v[2]) s.shortcuts[#s.shortcuts + 1] = modules.simple_widgets.make_shortcut(v[1], v[2])
end end
end end
@ -169,26 +150,25 @@ local function start()
desktop.widgets.space(10), desktop.widgets.space(10),
}) })
if (conf.mpc_enabled) then if (modules.mpc ~= nil) then
rightside = gears.table.join(rightside, { rightside = gears.table.join(rightside, {
desktop.widgets.mpc, modules.mpc.widgets.mpc,
desktop.widgets.space(5), desktop.widgets.space(5),
desktop.widgets.separator(2, 5, 3), desktop.widgets.separator(2, 5, 3),
desktop.widgets.space(15), desktop.widgets.space(15),
}) })
end end
rightside = gears.table.join(rightside, { rightside = gears.table.join(rightside, {
desktop.widgets.textclock, modules.simple_widgets.textclock,
desktop.widgets.space(8), desktop.widgets.space(8),
desktop.widgets.battery, --modules.battery.widgets.battery,
desktop.widgets.backlight, --modules.backlight.widgets.backlight,
desktop.widgets.volume, modules.volume.widgets.volume,
desktop.widgets.space(8), desktop.widgets.space(8),
desktop.widgets.keymap, modules.ibus.widgets.keymap,
desktop.widgets.space(8), desktop.widgets.space(8),
}) })
@ -197,7 +177,7 @@ local function start()
s.bar:setup { s.bar:setup {
layout = wibox.container.margin, layout = wibox.container.margin,
margins = beautiful.dpi(conf.bar_margin), margins = beautiful.dpi(config.core.bar_margin),
{ {
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@ -207,7 +187,7 @@ local function start()
desktop.widgets.space(8), desktop.widgets.space(8),
desktop.widgets.launcher, modules.launcher.widgets.launcher,
desktop.widgets.space(18), desktop.widgets.space(18),
s.tagger.widget.widget, s.tagger.widget.widget,
@ -218,7 +198,7 @@ local function start()
desktop.widgets.space(6), desktop.widgets.space(6),
desktop.widgets.separator(2, 5, 3), desktop.widgets.separator(2, 5, 3),
desktop.widgets.space(18), desktop.widgets.space(18),
desktop.widgets.tasklist(s), tasklist(s),
}, },
s.mypromptbox, s.mypromptbox,

View File

@ -26,11 +26,11 @@ local function make(tagger)
} }
-- Calculate checkbox size limit -- Calculate checkbox size limit
local cbox_maxsize = beautiful.dpi(conf.bar_height) local cbox_maxsize = beautiful.dpi(config.core.bar_height)
cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(conf.bar_margin)) cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(config.core.bar_margin))
cbox_maxsize = cbox_maxsize - (tagger.rows - 1)*(beautiful.dpi(widget.tagindicator.spacing)) cbox_maxsize = cbox_maxsize - (tagger.rows - 1)*(beautiful.dpi(widget.tagindicator.spacing))
if ((conf.bar_position == "bottom") or (conf.bar_position == "top")) then if ((config.core.bar_position == "bottom") or (config.core.bar_position == "top")) then
cbox_maxsize = cbox_maxsize / tagger.rows cbox_maxsize = cbox_maxsize / tagger.rows
else else
cbox_maxsize = cbox_maxsize / tagger.cols cbox_maxsize = cbox_maxsize / tagger.cols

View File

@ -60,7 +60,7 @@ tasklist.make = function(screen)
{ {
id = "clienticon", id = "clienticon",
widget = awful.widget.clienticon, widget = awful.widget.clienticon,
forced_width = conf.clienticon_width forced_width = config.core.clienticon_width
}, },
margins = beautiful.dpi(3), margins = beautiful.dpi(3),
widget = wibox.container.margin widget = wibox.container.margin

View File

@ -2,7 +2,7 @@ local util = require("modules.ibus.util")
return { return {
widgets = { widgets = {
ibus = require("modules.ibus.widget").widget keymap = require("modules.ibus.widget").widget
}, },
keybinds = require("modules.ibus.keybinds"), keybinds = require("modules.ibus.keybinds"),

View File

@ -14,7 +14,7 @@ popup.widget = wibox.widget {
} }
for k, l in pairs(conf.ibus_language_list) do for k, l in pairs(config.ibus.language_list) do
l["widget_checkbox"] = wibox.widget { l["widget_checkbox"] = wibox.widget {
checked = false, checked = false,
@ -49,7 +49,7 @@ end
popup.update = function() popup.update = function()
-- Update checkmarks -- Update checkmarks
for _, l in pairs(conf.ibus_language_list) do for _, l in pairs(config.ibus.language_list) do
if (util.current_engine == l["ibus_engine"]) then if (util.current_engine == l["ibus_engine"]) then
l["widget_text"].bg = "#FF0000" l["widget_text"].bg = "#FF0000"
else else

View File

@ -15,9 +15,9 @@ util.get = function(callback)
util.current_engine = string.gsub(stdout, "\n", "") util.current_engine = string.gsub(stdout, "\n", "")
util.current_engine_index = nil util.current_engine_index = nil
-- Find the current engine's index in conf.ibus_language_list. -- Find the current engine's index in config.ibus.language_list.
-- If it is not there, util.current_engine_index will be nil. -- If it is not there, util.current_engine_index will be nil.
for k, v in pairs(conf.ibus_language_list) do for k, v in pairs(config.ibus.language_list) do
if (v["ibus_engine"] == util.current_engine) then if (v["ibus_engine"] == util.current_engine) then
util.current_engine_index = k util.current_engine_index = k
end end
@ -45,11 +45,11 @@ end
util.set = function(language_index, callback) util.set = function(language_index, callback)
-- engine is an index of the language list above -- engine is an index of the language list above
local engine = conf.ibus_language_list[language_index]["ibus_engine"] local engine = config.ibus.language_list[language_index]["ibus_engine"]
-- Get required engine, if one is given -- Get required engine, if one is given
local requires_engine local requires_engine
for k, v in pairs(conf.ibus_language_list) do for k, v in pairs(config.ibus.language_list) do
if (v["ibus_engine"] == engine) then if (v["ibus_engine"] == engine) then
requires_engine = v["requires_engine"] requires_engine = v["requires_engine"]
end end
@ -81,7 +81,7 @@ end
-- Calls util.set(callback) with next language in list. -- Calls util.set(callback) with next language in list.
util.next = function(callback) util.next = function(callback)
if (util.current_engine_index == nil) or (util.current_engine_index == #conf.ibus_language_list) then if (util.current_engine_index == nil) or (util.current_engine_index == #config.ibus.language_list) then
util.current_engine_index = 1 util.current_engine_index = 1
else else
util.current_engine_index = util.current_engine_index + 1 util.current_engine_index = util.current_engine_index + 1

View File

@ -53,7 +53,7 @@ widget.widget:connect_signal("mouse::leave", function(result)
end) end)
widget.update = function() widget.update = function()
widget.ibus_indicator_text.markup = conf.ibus_language_list[util.current_engine_index]["indicator_code"] widget.ibus_indicator_text.markup = config.ibus.language_list[util.current_engine_index]["indicator_code"]
widget.xkb_indicator_text.markup = util.current_xkbmap widget.xkb_indicator_text.markup = util.current_xkbmap
end end

View File

@ -2,14 +2,14 @@ local util = {}
util.mpc_command = function(command, callback) util.mpc_command = function(command, callback)
awful.spawn.easy_async( awful.spawn.easy_async(
"mpc --host " .. conf.mpd_host .. " " .. command, "mpc --host " .. config.mpc.host .. " " .. command,
callback callback
) )
end end
util.mpc_watch = function(command, timeout, callback, widget) util.mpc_watch = function(command, timeout, callback, widget)
awful.widget.watch( awful.widget.watch(
"mpc --host " .. conf.mpd_host .. " " .. command, "mpc --host " .. config.mpc.host .. " " .. command,
timeout, timeout,
callback, callback,
widget widget

View File

@ -6,14 +6,14 @@ mpc_widget.title.valign = "center"
mpc_widget.title.align = "left" mpc_widget.title.align = "left"
mpc_widget.title.font = "Hack NF 12" mpc_widget.title.font = "Hack NF 12"
mpc_widget.title.ellipsize = "end" mpc_widget.title.ellipsize = "end"
mpc_widget.title.forced_width = beautiful.dpi(conf.mpc_width) mpc_widget.title.forced_width = beautiful.dpi(config.mpc.width)
mpc_widget.artist = wibox.widget.textbox("connected") mpc_widget.artist = wibox.widget.textbox("connected")
mpc_widget.artist.valign = "center" mpc_widget.artist.valign = "center"
mpc_widget.artist.align = "left" mpc_widget.artist.align = "left"
mpc_widget.artist.font = "Hack NF 12" mpc_widget.artist.font = "Hack NF 12"
mpc_widget.artist.ellipsize = "end" mpc_widget.artist.ellipsize = "end"
mpc_widget.artist.forced_width = beautiful.dpi(conf.mpc_width) mpc_widget.artist.forced_width = beautiful.dpi(config.mpc.width)
mpc_widget.volume = wibox.widget.textbox("??") mpc_widget.volume = wibox.widget.textbox("??")
mpc_widget.volume.valign = "center" mpc_widget.volume.valign = "center"

View File

@ -7,8 +7,7 @@ local function capture(source, target)
end end
local function flameshot() local function flameshot()
--awful.spawn("flameshot gui -p \"" .. conf.screenshot_dir .. "\"", false) awful.spawn("flameshot gui -p \"" .. config.screenshot.save_dir .. "\"", false)
awful.spawn("flameshot gui", false)
end end

View File

@ -9,7 +9,7 @@ local function make_shortcut(command, icon)
{ {
wibox.widget { wibox.widget {
resize = true, resize = true,
image = conf.app_icon_dir .. icon, image = config.core.app_icon_dir .. icon,
widget = wibox.widget.imagebox widget = wibox.widget.imagebox
}, },
top = beautiful.dpi(3), top = beautiful.dpi(3),

View File

@ -4,8 +4,8 @@ volume.commands = {}
-- Create pamixer option string -- Create pamixer option string
volume.pamixer_options = "" volume.pamixer_options = ""
if (conf.pamixer_sink ~= "") then if (config.volume.pamixer_sink ~= "") then
volume.pamixer_options = volume.pamixer_options .. " --sink " .. conf.pamixer_sink volume.pamixer_options = volume.pamixer_options .. " --sink " .. config.volume.pamixer_sink
end end
function volume.commands:up() function volume.commands:up()

37
rc.lua
View File

@ -23,9 +23,8 @@ debug_message = function(msg)
end end
-- Order matters. -- Order matters.
conf = require("conf") config = require("config")
beautiful.init(require("theme")) beautiful.init(require("theme"))
core = require("core")
-- Load key bindings -- Load key bindings
@ -33,26 +32,31 @@ local binds = require("binds")
local keys = binds.keys local keys = binds.keys
local buttons = binds.buttons local buttons = binds.buttons
-- Load modules -- Load modules
-- Every config table key (except "core") represents a module we should load.
modules = {} modules = {}
for k, v in ipairs({ for k, v in pairs(config) do
"mpc", if (k == "core") then
"ibus", goto skip_module
"volume", elseif (config[k].enabled == false) then
"launcher", goto skip_module
"simple_widgets", elseif (config[k].enabled == nil) then
"screenshot", debug_message("Module " .. k .. " is not explicitly enabled")
"i3lock" goto skip_module
}) do end
modules[v] = require("modules." .. v)
modules[k] = require("modules." .. k)
-- If module defines keybinds, load keybinds. -- If module defines keybinds, load keybinds.
if (modules[v]["keybinds"] ~= nil) then if (modules[k]["keybinds"] ~= nil) then
keys = gears.table.join( keys = gears.table.join(
keys, keys,
modules[v]["keybinds"] modules[k]["keybinds"]
) )
end end
::skip_module::
end end
-- Run all module init methods -- Run all module init methods
@ -61,6 +65,7 @@ for _, mod in ipairs(modules) do
mod["init"]() mod["init"]()
end end
end end
core = require("core")
-- Finalize keybinds -- Finalize keybinds
@ -70,7 +75,7 @@ root.buttons(buttons)
-- Autostart -- Autostart
for i, v in ipairs(conf.startup_commands) do for i, v in ipairs(config.core.startup_commands) do
awful.spawn(v) awful.spawn(v)
end end
@ -84,7 +89,7 @@ core.start()
-- Check for errors -- Check for errors
dofile(conf_dir .. "errors.lua") dofile(conf_dir .. "errors.lua")
menubar.utils.terminal = conf.terminal menubar.utils.terminal = config.core.terminal
-- Load client methods -- Load client methods
awful.rules.rules = require("clients.rules") awful.rules.rules = require("clients.rules")

View File

@ -21,7 +21,7 @@ local theme = notifications(theme)
theme.font = "Hack NF 12" theme.font = "Hack NF 12"
theme.wallpaper = conf.wallpaper theme.wallpaper = config.core.wallpaper
theme.bg_normal = theme.color.lblack theme.bg_normal = theme.color.lblack
theme.bg_focus = theme.color.black theme.bg_focus = theme.color.black