Skip to content

Commit 199d41b

Browse files
committed
Merge pull request #107310 from timothyqiu/terminal-args
Fix not being able to open directory in certain terminals
2 parents 2e216b5 + cd5ddf7 commit 199d41b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

editor/filesystem_dock.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
22712271
#endif
22722272

22732273
List<String> terminal_emulator_args; // Required for `execute()`, as it doesn't accept `Vector<String>`.
2274+
bool append_default_args = true;
2275+
22742276
#ifdef LINUXBSD_ENABLED
22752277
// Prepend default arguments based on the terminal emulator name.
22762278
// Use `String.ends_with()` so that installations in non-default paths
@@ -2284,12 +2286,21 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
22842286
terminal_emulator_args.push_back("-cd");
22852287
} else if (chosen_terminal_emulator.ends_with("xfce4-terminal")) {
22862288
terminal_emulator_args.push_back("--working-directory");
2289+
} else if (chosen_terminal_emulator.ends_with("lxterminal")) {
2290+
terminal_emulator_args.push_back("--working-directory={directory}");
2291+
append_default_args = false;
2292+
} else if (chosen_terminal_emulator.ends_with("kitty")) {
2293+
terminal_emulator_args.push_back("--directory");
2294+
} else if (chosen_terminal_emulator.ends_with("alacritty")) {
2295+
terminal_emulator_args.push_back("--working-directory");
2296+
} else if (chosen_terminal_emulator.ends_with("xterm")) {
2297+
terminal_emulator_args.push_back("-e");
2298+
terminal_emulator_args.push_back("cd '{directory}' && exec $SHELL");
2299+
append_default_args = false;
22872300
}
22882301
}
22892302
#endif
22902303

2291-
bool append_default_args = true;
2292-
22932304
#ifdef WINDOWS_ENABLED
22942305
// Prepend default arguments based on the terminal emulator name.
22952306
// Use `String.get_basename().to_lower()` to handle Windows' case-insensitive paths

0 commit comments

Comments
 (0)