Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions data/io.elementary.terminal.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/terminal/issues/814">New window created with Ctrl Shift N has zero tabs and is transparent</issue>
<issue url="https://github.com/elementary/terminal/issues/812">Notifications are not withdrawn</issue>
<issue url="https://github.com/elementary/terminal/issues/806">Fails to build in Launchpad due to tests</issue>
<issue url="https://github.com/elementary/terminal/issues/793">Drag-drop command bypasses sudo warning</issue>
Expand Down
18 changes: 15 additions & 3 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

public class Terminal.Application : Gtk.Application {
public int minimum_width;
public int minimum_height;
public const int MINIMUM_WIDTH = 600;
public const int MINIMUM_HEIGHT = 400;

private string commandline = "\0"; // used to temporary hold the argument to --commandline=
private uint dbus_id = 0;
Expand Down Expand Up @@ -258,7 +258,19 @@ public class Terminal.Application : Gtk.Application {

var new_window_action = new SimpleAction ("new-window", null);
new_window_action.activate.connect (() => {
new MainWindow (this, active_window == null).present ();
string dir = Environment.get_home_dir ();
if (active_window != null) {
dir = ((MainWindow)active_window).current_terminal.current_working_directory;
}

var new_window = new MainWindow (this, active_window == null);
new_window.present ();
new_window.set_size_request (
saved_state.get_int ("window-width"),
saved_state.get_int ("window-height")
);

new_window.add_tab_with_working_directory (dir);
});

var quit_action = new SimpleAction ("quit", null);
Expand Down
19 changes: 9 additions & 10 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ namespace Terminal {
Application.settings_sys.changed["monospace-font-name"].connect (update_font);
Application.settings.changed["font"].connect (update_font);

set_size_request (app.minimum_width, app.minimum_height);
set_size_request (Application.MINIMUM_WIDTH, Application.MINIMUM_HEIGHT);

show_all ();

Expand All @@ -256,9 +256,14 @@ namespace Terminal {
delete_event.connect (on_delete_event);
}

public void add_tab_with_working_directory (string? directory, string? command = null, bool create_new_tab = false) {
/* This requires all restored tabs to be initialized first so that the shell location is available */
/* Do not add a new tab if location is already open in existing tab */
public void add_tab_with_working_directory (
string? directory,
string? command = null,
bool create_new_tab = false
) {
/* This requires all restored tabs to be initialized first so that
* the shell location is available.
* Do not add a new tab if location is already open in existing tab */
string? location = null;
if (directory == null || directory == "") {
if (notebook.n_pages == 0 || command != null || create_new_tab) { //Ensure at least one tab
Expand Down Expand Up @@ -708,12 +713,6 @@ namespace Terminal {
terminal_widget.font_scale = Terminal.Application.saved_state.get_double ("zoom");
}

int minimum_width = terminal_widget.calculate_width (80) / 2;
int minimum_height = terminal_widget.calculate_height (24) / 2;
set_size_request (minimum_width, minimum_height);
app.minimum_width = minimum_width;
app.minimum_height = minimum_height;

if (focus) {
notebook.selected_page = tab;
}
Expand Down
Loading