Open Elv13 opened 8 years ago
Importing useful things by default sounds good.
Dunno about awesome-clientrc.lua
. Such a file would further complicate our build system and be hard to find / learn about. How about awful.remote
exporting its "global env table" as awful.remote.env
or something like that and people can add entries to it by modifying this tbale?
Implementation-wise, this sounds like "Yay, fun with differences between Lua versions". Also, this brings fun with cyclic dependencies (awful.remote
depending on awful
).
Just to think about what the differences are, Lua 5.2 and 5.3 need something like this:
load(code, nil, ni, setmetatable({ awful = require("awful"), etc }, { __index = _G, __newindex = _G }))
Lua 5.1 (and thus likely also LuaJIT) need:
local f = load(code)
setfenv(f, setmetatable({ awful = require("awful"), etc }, { __index = _G, __newindex = _G }))
All is in the title. I checked the logs and many common use case need extra
require("awful").do_somehting
. Givenawesome-client
is limited when it comes to variables definition and that all "globals" such asclient
are defined. I was wondering if we should require all common libraries by default (same ones asrc.lua
)? Also, anawesome-clientrc.lua
could be a good idea? This file could define some functions/variables available when using the tool. This also confuse the users a lot when they see the error popup.Show 5 this year alone (I am connected ~30% of the time)
It can be hacked into
remote.lua
to avoid setting "real" globals.