mirror of https://github.com/termux/termux-app
Allow users to disable terminal session change toast
The user can add `disable-terminal-session-change-toast=true` entry to `termux.properties` file to disable terminal session change toast. The default value is `false`. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. Closes #2118
This commit is contained in:
parent
fd80cdaf23
commit
7ac62c9840
|
@ -255,8 +255,10 @@ public class TermuxTerminalSessionClient extends TermuxTerminalSessionClientBase
|
||||||
void notifyOfSessionChange() {
|
void notifyOfSessionChange() {
|
||||||
if (!mActivity.isVisible()) return;
|
if (!mActivity.isVisible()) return;
|
||||||
|
|
||||||
TerminalSession session = mActivity.getCurrentSession();
|
if (!mActivity.getProperties().areTerminalSessionChangeToastsDisabled()) {
|
||||||
mActivity.showToast(toToastTitle(session), false);
|
TerminalSession session = mActivity.getCurrentSession();
|
||||||
|
mActivity.showToast(toToastTitle(session), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchToSession(boolean forward) {
|
public void switchToSession(boolean forward) {
|
||||||
|
|
|
@ -72,6 +72,11 @@ public final class TermuxPropertyConstants {
|
||||||
|
|
||||||
/* boolean */
|
/* boolean */
|
||||||
|
|
||||||
|
/** 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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Defines the key for whether to enforce character based input to fix the issue where for some devices like Samsung, the letters might not appear until enter is pressed */
|
/** Defines the key for whether to enforce character based input to fix the issue where for some devices like Samsung, the letters might not appear until enter is pressed */
|
||||||
public static final String KEY_ENFORCE_CHAR_BASED_INPUT = "enforce-char-based-input"; // Default: "enforce-char-based-input"
|
public static final String KEY_ENFORCE_CHAR_BASED_INPUT = "enforce-char-based-input"; // Default: "enforce-char-based-input"
|
||||||
|
|
||||||
|
@ -285,6 +290,7 @@ public final class TermuxPropertyConstants {
|
||||||
* */
|
* */
|
||||||
public static final Set<String> TERMUX_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
|
public static final Set<String> TERMUX_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
|
||||||
/* boolean */
|
/* boolean */
|
||||||
|
KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST,
|
||||||
KEY_ENFORCE_CHAR_BASED_INPUT,
|
KEY_ENFORCE_CHAR_BASED_INPUT,
|
||||||
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
|
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
|
||||||
KEY_USE_BLACK_UI,
|
KEY_USE_BLACK_UI,
|
||||||
|
@ -323,6 +329,7 @@ public final class TermuxPropertyConstants {
|
||||||
* default: false
|
* default: false
|
||||||
* */
|
* */
|
||||||
public static final Set<String> TERMUX_DEFAULT_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
|
public static final Set<String> TERMUX_DEFAULT_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
|
||||||
|
KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST,
|
||||||
KEY_ENFORCE_CHAR_BASED_INPUT,
|
KEY_ENFORCE_CHAR_BASED_INPUT,
|
||||||
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
|
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
|
||||||
KEY_USE_CTRL_SPACE_WORKAROUND,
|
KEY_USE_CTRL_SPACE_WORKAROUND,
|
||||||
|
|
|
@ -460,6 +460,10 @@ public class TermuxSharedProperties {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean areTerminalSessionChangeToastsDisabled() {
|
||||||
|
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST, true);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEnforcingCharBasedInput() {
|
public boolean isEnforcingCharBasedInput() {
|
||||||
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_ENFORCE_CHAR_BASED_INPUT, true);
|
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_ENFORCE_CHAR_BASED_INPUT, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue