Reworked config, added module autoloader
This commit is contained in:
@ -2,7 +2,7 @@ local util = require("modules.ibus.util")
|
||||
|
||||
return {
|
||||
widgets = {
|
||||
ibus = require("modules.ibus.widget").widget
|
||||
keymap = require("modules.ibus.widget").widget
|
||||
},
|
||||
keybinds = require("modules.ibus.keybinds"),
|
||||
|
||||
|
@ -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 {
|
||||
checked = false,
|
||||
@ -49,7 +49,7 @@ end
|
||||
|
||||
popup.update = function()
|
||||
-- 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
|
||||
l["widget_text"].bg = "#FF0000"
|
||||
else
|
||||
|
@ -15,9 +15,9 @@ util.get = function(callback)
|
||||
util.current_engine = string.gsub(stdout, "\n", "")
|
||||
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.
|
||||
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
|
||||
util.current_engine_index = k
|
||||
end
|
||||
@ -45,11 +45,11 @@ end
|
||||
util.set = function(language_index, callback)
|
||||
-- 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
|
||||
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
|
||||
requires_engine = v["requires_engine"]
|
||||
end
|
||||
@ -81,7 +81,7 @@ end
|
||||
|
||||
-- Calls util.set(callback) with next language in list.
|
||||
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
|
||||
else
|
||||
util.current_engine_index = util.current_engine_index + 1
|
||||
|
@ -53,7 +53,7 @@ widget.widget:connect_signal("mouse::leave", function(result)
|
||||
end)
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -2,14 +2,14 @@ local util = {}
|
||||
|
||||
util.mpc_command = function(command, callback)
|
||||
awful.spawn.easy_async(
|
||||
"mpc --host " .. conf.mpd_host .. " " .. command,
|
||||
"mpc --host " .. config.mpc.host .. " " .. command,
|
||||
callback
|
||||
)
|
||||
end
|
||||
|
||||
util.mpc_watch = function(command, timeout, callback, widget)
|
||||
awful.widget.watch(
|
||||
"mpc --host " .. conf.mpd_host .. " " .. command,
|
||||
"mpc --host " .. config.mpc.host .. " " .. command,
|
||||
timeout,
|
||||
callback,
|
||||
widget
|
||||
|
@ -6,14 +6,14 @@ mpc_widget.title.valign = "center"
|
||||
mpc_widget.title.align = "left"
|
||||
mpc_widget.title.font = "Hack NF 12"
|
||||
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.valign = "center"
|
||||
mpc_widget.artist.align = "left"
|
||||
mpc_widget.artist.font = "Hack NF 12"
|
||||
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.valign = "center"
|
||||
|
@ -7,8 +7,7 @@ local function capture(source, target)
|
||||
end
|
||||
|
||||
local function flameshot()
|
||||
--awful.spawn("flameshot gui -p \"" .. conf.screenshot_dir .. "\"", false)
|
||||
awful.spawn("flameshot gui", false)
|
||||
awful.spawn("flameshot gui -p \"" .. config.screenshot.save_dir .. "\"", false)
|
||||
end
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ local function make_shortcut(command, icon)
|
||||
{
|
||||
wibox.widget {
|
||||
resize = true,
|
||||
image = conf.app_icon_dir .. icon,
|
||||
image = config.core.app_icon_dir .. icon,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
top = beautiful.dpi(3),
|
||||
|
@ -4,8 +4,8 @@ volume.commands = {}
|
||||
|
||||
-- Create pamixer option string
|
||||
volume.pamixer_options = ""
|
||||
if (conf.pamixer_sink ~= "") then
|
||||
volume.pamixer_options = volume.pamixer_options .. " --sink " .. conf.pamixer_sink
|
||||
if (config.volume.pamixer_sink ~= "") then
|
||||
volume.pamixer_options = volume.pamixer_options .. " --sink " .. config.volume.pamixer_sink
|
||||
end
|
||||
|
||||
function volume.commands:up()
|
||||
|
Reference in New Issue
Block a user