Skip to content

Commit

Permalink
Allow users to disable terminal margin adjustment
Browse files Browse the repository at this point in the history
The user can add `disable-terminal-margin-adjustment=true` entry to `termux.properties` file to disable terminal view margin adjustment that is done to prevent soft keyboard from covering bottom part of terminal view on some devices. Margin adjustment may cause screen flickering on some devices and so should be disabled. The default value is `false`. So adding the entry `disable-terminal-margin-adjustment=true` to `termux.properties` file will disable margin adjustment. Exit termux and restart for changes to take affect after updating value.

In case e5a9b99 did not fix screen flickering issues for #2127, then this can be used to disable it. Closes #2127.
  • Loading branch information
agnostic-apollo committed Jun 29, 2021
1 parent e5a9b99 commit 3213502
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/com/termux/app/TermuxActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ public void onStart() {
if (mTermuxTerminalViewClient != null)
mTermuxTerminalViewClient.onStart();

addTermuxActivityRootViewGlobalLayoutListener();
if (!mProperties.isTerminalMarginAdjustmentDisabled())
addTermuxActivityRootViewGlobalLayoutListener();

registerTermuxActivityBroadcastReceiver();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ public final class TermuxPropertyConstants {

/* boolean */

/** Defines the key for whether terminal view margin adjustment that is done to prevent soft
* keyboard from covering bottom part of terminal view on some devices is disabled or not.
* Margin adjustment may cause screen flickering on some devices and so should be disabled. */
public static final String KEY_DISABLE_TERMINAL_MARGIN_ADJUSTMENT = "disable-terminal-margin-adjustment"; // Default: "disable-terminal-margin-adjustment"



/** Defines the key for whether a toast will be shown when user changes the terminal session */
public static final String KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST = "disable-terminal-session-change-toast"; // Default: "disable-terminal-session-change-toast"

Expand Down Expand Up @@ -290,6 +297,7 @@ public final class TermuxPropertyConstants {
* */
public static final Set<String> TERMUX_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
/* boolean */
KEY_DISABLE_TERMINAL_MARGIN_ADJUSTMENT,
KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST,
KEY_ENFORCE_CHAR_BASED_INPUT,
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
Expand Down Expand Up @@ -329,6 +337,7 @@ public final class TermuxPropertyConstants {
* default: false
* */
public static final Set<String> TERMUX_DEFAULT_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
KEY_DISABLE_TERMINAL_MARGIN_ADJUSTMENT,
KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST,
KEY_ENFORCE_CHAR_BASED_INPUT,
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ public static String getVolumeKeysBehaviourInternalPropertyValueFromValue(String



public boolean isTerminalMarginAdjustmentDisabled() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_TERMINAL_MARGIN_ADJUSTMENT, true);
}

public boolean areTerminalSessionChangeToastsDisabled() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST, true);
}
Expand Down

0 comments on commit 3213502

Please sign in to comment.