Added: Allow users to disable `termux-am` server

The user can add `run-termux-am-socket-server=false` entry to `termux.properties` file to disable the `termux-am` server to run at app startup which is connected to by `$PREFIX/bin/termux-am` from the `termux-am-socket` package. The default value is `true`. Changes require `termux-app` to be force stopped and restarted to provide consistent state for all termux sessions and tasks.

The prop will be used in a later commit.
This commit is contained in:
agnostic-apollo 2022-04-17 08:14:18 +05:00
parent 9a71074c7d
commit 5f8a922201
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.termux.shared.termux.settings.properties;
import com.google.common.collect.ImmutableBiMap;
import com.termux.shared.termux.shell.am.TermuxAmSocketServer;
import com.termux.shared.theme.NightMode;
import com.termux.shared.file.FileUtils;
import com.termux.shared.file.filesystem.FileType;
@ -120,6 +121,11 @@ public final class TermuxPropertyConstants {
/** Defines the key for whether the {@link TermuxAmSocketServer} should be run at app startup */
public static final String KEY_RUN_TERMUX_AM_SOCKET_SERVER = "run-termux-am-socket-server"; // Default: "run-termux-am-socket-server"
/** Defines the key for whether url links in terminal transcript will automatically open on click or on tap */
public static final String KEY_TERMINAL_ONCLICK_URL_OPEN = "terminal-onclick-url-open"; // Default: "terminal-onclick-url-open"
@ -379,6 +385,7 @@ public final class TermuxPropertyConstants {
KEY_ENFORCE_CHAR_BASED_INPUT,
KEY_EXTRA_KEYS_TEXT_ALL_CAPS,
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
KEY_RUN_TERMUX_AM_SOCKET_SERVER,
KEY_TERMINAL_ONCLICK_URL_OPEN,
KEY_USE_CTRL_SPACE_WORKAROUND,
KEY_USE_FULLSCREEN,
@ -436,7 +443,8 @@ public final class TermuxPropertyConstants {
* default: true
*/
public static final Set<String> TERMUX_DEFAULT_TRUE_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
KEY_EXTRA_KEYS_TEXT_ALL_CAPS
KEY_EXTRA_KEYS_TEXT_ALL_CAPS,
KEY_RUN_TERMUX_AM_SOCKET_SERVER
));
/** Defines the set for keys loaded by termux that have default inverted boolean behaviour with false as default.

View File

@ -583,6 +583,10 @@ public abstract class TermuxSharedProperties {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP, true);
}
public boolean shouldRunTermuxAmSocketServer() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_RUN_TERMUX_AM_SOCKET_SERVER, true);
}
public boolean shouldOpenTerminalTranscriptURLOnClick() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_TERMINAL_ONCLICK_URL_OPEN, true);
}