Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to start minimized #715

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public class Terminal.Application : Gtk.Application {
public int minimum_width;
public int minimum_height;
private bool minimized = false;

private string commandline = "\0"; // used to temporary hold the argument to --commandline=
private uint dbus_id = 0;
Expand Down Expand Up @@ -38,6 +39,8 @@ public class Terminal.Application : Gtk.Application {
add_main_option ("working-directory", 'w', 0, OptionArg.FILENAME, _("Set shell working directory"), "DIR");
// -e flag is used for running single strings as a command line
add_main_option ("execute", 'e', 0, OptionArg.FILENAME_ARRAY, _("Run a program in terminal"), "PROGRAM");
// -m flag starts terminal in a minimized state
add_main_option ("minimized", 'm', 0, OptionArg.NONE, _("Open terminal in a minimized state"), null);
// -x flag is used for using the rest of the command line in the new tab/window
add_main_option (
"commandline", 'x', 0, OptionArg.FILENAME, _("Run remainder of line as a command in terminal"), "COMMAND"
Expand Down Expand Up @@ -127,6 +130,10 @@ public class Terminal.Application : Gtk.Application {
options.insert ("commandline", "^&ay", commandline.escape ());
}

if (options.contains ("minimized")) {
minimized = true;
}

return -1;
}

Expand Down Expand Up @@ -214,7 +221,11 @@ public class Terminal.Application : Gtk.Application {
window.add_tab_with_working_directory (working_directory, null, new_tab);
}

window.present ();
if (minimized) {
window.iconify ();
} else {
window.present ();
}
return 0;
}

Expand Down