Merge pull request #3249 from myk002/myk_hide_console

infrastructure for hiding the terminal console on startup
develop
Myk 2023-04-16 22:55:25 -07:00 committed by GitHub
commit ff1cfdb00c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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