Reworked config, added module autoloader
parent
9da54839fb
commit
2c034c36ed
|
@ -1 +1 @@
|
|||
conf.lua
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"conf_dir",
|
||||
"req_rel",
|
||||
"debug_message",
|
||||
"conf",
|
||||
"config",
|
||||
"core",
|
||||
"modules"
|
||||
|
||||
|
|
|
@ -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",
|
||||
function ()
|
||||
awful.spawn(conf.terminal)
|
||||
awful.spawn(config.core.terminal)
|
||||
end,
|
||||
|
||||
{
|
||||
|
@ -89,7 +50,7 @@ return gears.table.join(
|
|||
|
||||
awful.key( {"Mod4"}, "\\",
|
||||
function ()
|
||||
awful.spawn(conf.browser)
|
||||
awful.spawn(config.core.browser)
|
||||
end,
|
||||
|
||||
{
|
||||
|
|
165
conf-example.lua
165
conf-example.lua
|
@ -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
|
|
@ -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
|
|
@ -7,9 +7,9 @@ local LayoutManager = {}
|
|||
|
||||
|
||||
-- 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)
|
||||
for k, v in pairs(conf.layouts) do
|
||||
for k, v in pairs(config.core.layouts) do
|
||||
for l, m in pairs(v) do
|
||||
if (layout == m) then
|
||||
return k
|
||||
|
@ -19,7 +19,7 @@ function LayoutManager:get_group(layout)
|
|||
end
|
||||
|
||||
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
|
||||
if (layout == m) then
|
||||
return l
|
||||
|
@ -31,7 +31,7 @@ end
|
|||
|
||||
|
||||
function LayoutManager:default_layout()
|
||||
return conf.layouts[1][1]
|
||||
return config.core.layouts[1][1]
|
||||
end
|
||||
|
||||
-- Change layout group
|
||||
|
@ -44,9 +44,9 @@ function LayoutManager:group(step)
|
|||
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
|
||||
|
||||
-- Change layout alternate
|
||||
|
@ -60,9 +60,9 @@ function LayoutManager:alt(step)
|
|||
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
|
||||
|
||||
function LayoutManager:next()
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
local function start()
|
||||
local desktop = {
|
||||
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)
|
||||
return wibox.widget {
|
||||
{
|
||||
|
@ -39,6 +32,7 @@ local function start()
|
|||
}
|
||||
|
||||
|
||||
local tasklist = require("core.tasklist")
|
||||
|
||||
-- Manages tag grid and widget
|
||||
local tagger = require("core.tagger.tagger")
|
||||
|
@ -48,19 +42,6 @@ local function start()
|
|||
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 (type(beautiful.wallpaper) == "table") then
|
||||
desktop.wallpaper = require("desktop.wallpaper")
|
||||
|
@ -89,7 +70,7 @@ local function start()
|
|||
timeout = 2,
|
||||
call_now = false,
|
||||
autostart = true,
|
||||
single_shot = not conf.continuous_tag_updates,
|
||||
single_shot = not config.core.continuous_tag_updates,
|
||||
|
||||
callback = function()
|
||||
for s in screen do
|
||||
|
@ -112,12 +93,12 @@ local function start()
|
|||
|
||||
-- Create the bar
|
||||
s.bar = awful.wibar({
|
||||
position = conf.bar_position,
|
||||
position = config.core.bar_position,
|
||||
screen = s,
|
||||
--bg = "#00000000",
|
||||
bg = beautiful.color.bar.color,
|
||||
border_width = 0,
|
||||
height = beautiful.dpi(conf.bar_height),
|
||||
height = beautiful.dpi(config.core.bar_height),
|
||||
type = "desktop"
|
||||
})
|
||||
|
||||
|
@ -134,14 +115,14 @@ local function start()
|
|||
end)
|
||||
|
||||
-- Create shortcut list from config value
|
||||
if (#conf.bar_shortcuts > 0) then
|
||||
if (#config.core.bar_shortcuts > 0) then
|
||||
s.shortcuts = {
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
desktop.widgets.separator(2, 5, 3),
|
||||
desktop.widgets.space(6)
|
||||
}
|
||||
for k, v in pairs(conf.bar_shortcuts) do
|
||||
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut(v[1], v[2])
|
||||
for k, v in pairs(config.core.bar_shortcuts) do
|
||||
s.shortcuts[#s.shortcuts + 1] = modules.simple_widgets.make_shortcut(v[1], v[2])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -169,26 +150,25 @@ local function start()
|
|||
desktop.widgets.space(10),
|
||||
})
|
||||
|
||||
if (conf.mpc_enabled) then
|
||||
if (modules.mpc ~= nil) then
|
||||
rightside = gears.table.join(rightside, {
|
||||
desktop.widgets.mpc,
|
||||
modules.mpc.widgets.mpc,
|
||||
desktop.widgets.space(5),
|
||||
desktop.widgets.separator(2, 5, 3),
|
||||
desktop.widgets.space(15),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
rightside = gears.table.join(rightside, {
|
||||
desktop.widgets.textclock,
|
||||
modules.simple_widgets.textclock,
|
||||
desktop.widgets.space(8),
|
||||
|
||||
desktop.widgets.battery,
|
||||
desktop.widgets.backlight,
|
||||
desktop.widgets.volume,
|
||||
--modules.battery.widgets.battery,
|
||||
--modules.backlight.widgets.backlight,
|
||||
modules.volume.widgets.volume,
|
||||
desktop.widgets.space(8),
|
||||
|
||||
desktop.widgets.keymap,
|
||||
modules.ibus.widgets.keymap,
|
||||
desktop.widgets.space(8),
|
||||
|
||||
})
|
||||
|
@ -197,7 +177,7 @@ local function start()
|
|||
|
||||
s.bar:setup {
|
||||
layout = wibox.container.margin,
|
||||
margins = beautiful.dpi(conf.bar_margin),
|
||||
margins = beautiful.dpi(config.core.bar_margin),
|
||||
|
||||
{
|
||||
layout = wibox.layout.align.horizontal,
|
||||
|
@ -207,7 +187,7 @@ local function start()
|
|||
desktop.widgets.space(8),
|
||||
|
||||
|
||||
desktop.widgets.launcher,
|
||||
modules.launcher.widgets.launcher,
|
||||
|
||||
desktop.widgets.space(18),
|
||||
s.tagger.widget.widget,
|
||||
|
@ -218,7 +198,7 @@ local function start()
|
|||
desktop.widgets.space(6),
|
||||
desktop.widgets.separator(2, 5, 3),
|
||||
desktop.widgets.space(18),
|
||||
desktop.widgets.tasklist(s),
|
||||
tasklist(s),
|
||||
},
|
||||
|
||||
s.mypromptbox,
|
||||
|
|
|
@ -26,11 +26,11 @@ local function make(tagger)
|
|||
}
|
||||
|
||||
-- Calculate checkbox size limit
|
||||
local cbox_maxsize = beautiful.dpi(conf.bar_height)
|
||||
cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(conf.bar_margin))
|
||||
local cbox_maxsize = beautiful.dpi(config.core.bar_height)
|
||||
cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(config.core.bar_margin))
|
||||
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
|
||||
else
|
||||
cbox_maxsize = cbox_maxsize / tagger.cols
|
||||
|
|
|
@ -60,7 +60,7 @@ tasklist.make = function(screen)
|
|||
{
|
||||
id = "clienticon",
|
||||
widget = awful.widget.clienticon,
|
||||
forced_width = conf.clienticon_width
|
||||
forced_width = config.core.clienticon_width
|
||||
},
|
||||
margins = beautiful.dpi(3),
|
||||
widget = wibox.container.margin
|
||||
|
|
|
@ -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()
|
||||
|
|
37
rc.lua
37
rc.lua
|
@ -23,9 +23,8 @@ debug_message = function(msg)
|
|||
end
|
||||
|
||||
-- Order matters.
|
||||
conf = require("conf")
|
||||
config = require("config")
|
||||
beautiful.init(require("theme"))
|
||||
core = require("core")
|
||||
|
||||
|
||||
-- Load key bindings
|
||||
|
@ -33,26 +32,31 @@ local binds = require("binds")
|
|||
local keys = binds.keys
|
||||
local buttons = binds.buttons
|
||||
|
||||
|
||||
-- Load modules
|
||||
-- Every config table key (except "core") represents a module we should load.
|
||||
modules = {}
|
||||
for k, v in ipairs({
|
||||
"mpc",
|
||||
"ibus",
|
||||
"volume",
|
||||
"launcher",
|
||||
"simple_widgets",
|
||||
"screenshot",
|
||||
"i3lock"
|
||||
}) do
|
||||
modules[v] = require("modules." .. v)
|
||||
for k, v in pairs(config) do
|
||||
if (k == "core") then
|
||||
goto skip_module
|
||||
elseif (config[k].enabled == false) then
|
||||
goto skip_module
|
||||
elseif (config[k].enabled == nil) then
|
||||
debug_message("Module " .. k .. " is not explicitly enabled")
|
||||
goto skip_module
|
||||
end
|
||||
|
||||
modules[k] = require("modules." .. k)
|
||||
|
||||
-- If module defines keybinds, load keybinds.
|
||||
if (modules[v]["keybinds"] ~= nil) then
|
||||
if (modules[k]["keybinds"] ~= nil) then
|
||||
keys = gears.table.join(
|
||||
keys,
|
||||
modules[v]["keybinds"]
|
||||
modules[k]["keybinds"]
|
||||
)
|
||||
end
|
||||
|
||||
::skip_module::
|
||||
end
|
||||
|
||||
-- Run all module init methods
|
||||
|
@ -61,6 +65,7 @@ for _, mod in ipairs(modules) do
|
|||
mod["init"]()
|
||||
end
|
||||
end
|
||||
core = require("core")
|
||||
|
||||
|
||||
-- Finalize keybinds
|
||||
|
@ -70,7 +75,7 @@ root.buttons(buttons)
|
|||
|
||||
|
||||
-- Autostart
|
||||
for i, v in ipairs(conf.startup_commands) do
|
||||
for i, v in ipairs(config.core.startup_commands) do
|
||||
awful.spawn(v)
|
||||
end
|
||||
|
||||
|
@ -84,7 +89,7 @@ core.start()
|
|||
-- Check for errors
|
||||
dofile(conf_dir .. "errors.lua")
|
||||
|
||||
menubar.utils.terminal = conf.terminal
|
||||
menubar.utils.terminal = config.core.terminal
|
||||
|
||||
-- Load client methods
|
||||
awful.rules.rules = require("clients.rules")
|
||||
|
|
|
@ -21,7 +21,7 @@ local theme = notifications(theme)
|
|||
|
||||
theme.font = "Hack NF 12"
|
||||
|
||||
theme.wallpaper = conf.wallpaper
|
||||
theme.wallpaper = config.core.wallpaper
|
||||
|
||||
theme.bg_normal = theme.color.lblack
|
||||
theme.bg_focus = theme.color.black
|
||||
|
|
Loading…
Reference in New Issue