mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-12-11 19:41:15 +01:00
introduce a property for configuring default working directory
Issue https://github.com/termux/termux-app/issues/1192.
This commit is contained in:
parent
407e4e003a
commit
496da3f877
2 changed files with 18 additions and 2 deletions
|
|
@ -652,7 +652,14 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||||
.setPositiveButton(android.R.string.ok, null).show();
|
.setPositiveButton(android.R.string.ok, null).show();
|
||||||
} else {
|
} else {
|
||||||
TerminalSession currentSession = getCurrentTermSession();
|
TerminalSession currentSession = getCurrentTermSession();
|
||||||
String workingDirectory = (currentSession == null) ? null : currentSession.getCwd();
|
|
||||||
|
String workingDirectory;
|
||||||
|
if (currentSession == null) {
|
||||||
|
workingDirectory = mSettings.mDefaultWorkingDir;
|
||||||
|
} else {
|
||||||
|
workingDirectory = currentSession.getCwd();
|
||||||
|
}
|
||||||
|
|
||||||
TerminalSession newSession = mTermService.createTermSession(null, null, workingDirectory, failSafe);
|
TerminalSession newSession = mTermService.createTermSession(null, null, workingDirectory, failSafe);
|
||||||
if (sessionName != null) {
|
if (sessionName != null) {
|
||||||
newSession.mSessionName = sessionName;
|
newSession.mSessionName = sessionName;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ final class TermuxPreferences {
|
||||||
boolean mBackIsEscape;
|
boolean mBackIsEscape;
|
||||||
boolean mDisableVolumeVirtualKeys;
|
boolean mDisableVolumeVirtualKeys;
|
||||||
boolean mShowExtraKeys;
|
boolean mShowExtraKeys;
|
||||||
|
String mDefaultWorkingDir;
|
||||||
|
|
||||||
ExtraKeysInfos mExtraKeys;
|
ExtraKeysInfos mExtraKeys;
|
||||||
|
|
||||||
|
|
@ -227,6 +228,14 @@ final class TermuxPreferences {
|
||||||
mUseFullScreenWorkAround = false;
|
mUseFullScreenWorkAround = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDefaultWorkingDir = props.getProperty("default-working-directory", TermuxService.HOME_PATH);
|
||||||
|
File workDir = new File(mDefaultWorkingDir);
|
||||||
|
if (!workDir.exists() || !workDir.isDirectory()) {
|
||||||
|
// Fallback to home directory if user configured working directory is not exist
|
||||||
|
// or is a regular file.
|
||||||
|
mDefaultWorkingDir = TermuxService.HOME_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
String defaultExtraKeys = "[[ESC, TAB, CTRL, ALT, {key: '-', popup: '|'}, DOWN, UP]]";
|
String defaultExtraKeys = "[[ESC, TAB, CTRL, ALT, {key: '-', popup: '|'}, DOWN, UP]]";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue