infrastructure for hiding the terminal console on startup

develop
Myk Taylor 2023-04-16 22:34:29 -07:00
parent 2dbfa37f54
commit d1d521fbdb
No known key found for this signature in database
3 changed files with 17 additions and 0 deletions

@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Misc Improvements
- `buildingplan`: minimized planner panel stays minimized until you change it again
- ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K)
- `gui/control-panel`: add option for hiding the terminal console by default
## Documentation

@ -1314,6 +1314,15 @@ static void run_dfhack_init(color_ostream &out, Core *core)
// load user overrides
std::vector<std::string> prefixes(1, "dfhack");
loadScriptFiles(core, out, prefixes, CONFIG_PATH + "init");
// if the option is set, hide the terminal
auto L = Lua::Core::State;
Lua::StackUnwinder top(L);
Lua::CallLuaModuleFunction(out, L, "dfhack", "getHideConsoleOnStartup", 0, 1,
Lua::DEFAULT_LUA_LAMBDA, [&](lua_State* L) {
if (lua_toboolean(L, -1))
core->getConsole().hide();
}, false);
}
// Load dfhack.init in a dedicated thread (non-interactive console mode)

@ -51,6 +51,13 @@ if dfhack.is_core_context then
SC_UNPAUSED = 8
end
-- User-changeable options
dfhack.HIDE_CONSOLE_ON_STARTUP = true
function dfhack.getHideConsoleOnStartup()
return dfhack.HIDE_CONSOLE_ON_STARTUP
end
-- Error handling
safecall = dfhack.safecall