From 63cbce98e0bcdfc7f13b22c8697bb54df2d3a1e7 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Fri, 6 Dec 2024 11:52:33 +0000 Subject: [PATCH] New window follows current terminal working dir --- src/Application.vala | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 5aed8469f4..55dbd97ca4 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -258,12 +258,19 @@ public class Terminal.Application : Gtk.Application { var new_window_action = new SimpleAction ("new-window", null); new_window_action.activate.connect (() => { + 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); - var width = saved_state.get_int ("window-width"); - var height = saved_state.get_int ("window-height"); - new_window.set_size_request (width, height); new_window.present (); - new_window.add_tab_with_working_directory (Environment.get_current_dir ()); + 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);