1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:27:45 +00:00

Terminal: Add config for startup command

This is useful when working on a program as you can put the command into
the config file, instead of having to type it up each time on boot.
This commit is contained in:
Shannon Booth 2020-05-02 21:28:26 +12:00 committed by Andreas Kling
parent 548ecceb75
commit 0e403a43a4
2 changed files with 8 additions and 2 deletions

View file

@ -216,14 +216,18 @@ int main(int argc, char** argv)
return 1; return 1;
} }
run_command(ptm_fd, command_to_execute); RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Terminal");
if (command_to_execute)
run_command(ptm_fd, command_to_execute);
else
run_command(ptm_fd, config->read_entry("Startup", "Command"));
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_title("Terminal"); window->set_title("Terminal");
window->set_background_color(Color::Black); window->set_background_color(Color::Black);
window->set_double_buffering_enabled(false); window->set_double_buffering_enabled(false);
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Terminal");
auto& terminal = window->set_main_widget<TerminalWidget>(ptm_fd, true, config); auto& terminal = window->set_main_widget<TerminalWidget>(ptm_fd, true, config);
terminal.on_command_exit = [&] { terminal.on_command_exit = [&] {
app.quit(0); app.quit(0);

View file

@ -1,3 +1,5 @@
[Startup]
Command=
[Window] [Window]
Opacity=255 Opacity=255
AudibleBeep=0 AudibleBeep=0