diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 73a0c99f..c7672f9d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,7 +39,9 @@ + android:theme="@android:style/Theme.Material.Light.DarkActionBar" + android:parentActivityName=".app.TermuxActivity" + android:label="@string/application_name" /> - - - - - - Termux Help - - - - -
-

Termux Help

- - - -

Introduction

-

Termux is a terminal emulator for Android combined with a collection of packages for command line software. This help - explains both the terminal interface and the packaging tool available from inside the terminal.

-

Want to ask a question, report a bug or have an idea for a new package or feature? - Visit the Google+ Termux Community!

- -

User interface

-

At launch Termux shows a terminal interface, whose text size can be adjusted by pinch zooming or double tapping - and pulling the content towards or from you.

-

Besides the terminal (with keyboard shortcuts explained below) there are three additional interface elements available: - A context menu, navigation drawer - and notification.

-

The context menu can be shown by long pressing anywhere on the terminal. It provides menu entries for:

-
    -
  • Selecting and pasting text.
  • -
  • Sharing text from the terminal to other apps (e.g. email or SMS)
  • -
  • Resetting the terminal if it gets stuck.
  • -
  • Switching the terminal to full-screen.
  • -
  • Hangup (exiting the current terminal session).
  • -
  • Styling the terminal by selecting a font and a color scheme.
  • -
  • Showing this help page.
  • -
-

The navigation drawer is revealed by swiping from the left part of the screen. It has three - elements:

-
    -
  • A list of sessions. Clicking on a session shows it in the terminal while long pressing allows you to specify a session title.
  • -
  • A button to toggle visibility of the touch keyboard.
  • -
  • A button to create new terminal sessions (long press for creating a named session or a fail-safe one).
  • -
-

The notification, available when a terminal session is running, is available by pulling down the notification menu. - Pressing the notification leads to the most current terminal session. The notification may also be expanded - (by pinch-zooming or performing a single-finger glide) to expose three actions:

-
    -
  • Exiting all running terminal sessions.
  • -
  • Use a wake lock to avoid entering sleep mode.
  • -
  • Use a high performance wifi lock to maximize wifi performance.
  • -
-

With a wake or wifi lock held the notification and Termux background processes will be available even if no terminal - session is running, which allows server and other background processes to run more reliably.

- -

Using a touch keyboard

-

Using the Ctrl key is necessary for working with a terminal - but most touch keyboards - does not include one. For that purpose Termux uses the Volume down button to emulate - the Ctrl key. For example, pressing Volume down+L on a touch keyboard sends the same input as - pressing Ctrl+L on a hardware keyboard. The result of using Ctrl in combination - with a key depends on which program is used, but for many command line tools the following - shortcuts works:

-
    -
  • Ctrl+A → Move cursor to the beginning of line.
  • -
  • Ctrl+C → Abort (send SIGINT to) current process.
  • -
  • Ctrl+D → Logout of a terminal session.
  • -
  • Ctrl+E → Move cursor to the end of line.
  • -
  • Ctrl+K → Delete from cursor to the end of line.
  • -
  • Ctrl+L → Clear the terminal.
  • -
  • Ctrl+Z → Suspend (send SIGTSTP to) current process.
  • -
-

The Volume up key also serves as a special key to produce certain input:

-
    -
  • Volume Up+L → | (the pipe character).
  • -
  • Volume Up+E → Escape key.
  • -
  • Volume Up+T → Tab key.
  • -
  • Volume Up+1 → F1 (and Volume Up+2 → F2, etc).
  • -
  • Volume Up+B → Alt+B, back a word when using readline.
  • -
  • Volume Up+F → Alt+F, forward a word when using readline.
  • -
  • Volume Up+W → Up arrow key.
  • -
  • Volume Up+A → Left arrow key.
  • -
  • Volume Up+S → Down arrow key.
  • -
  • Volume Up+D → Right arrow key.
  • -
- -

Using a hardware keyboard

-

The following shortcuts are available when using Termux with a hardware (e.g. bluetooth) keyboard by combining them with Ctrl+Shift:

-
    -
  • 'C' → Create new session
  • -
  • 'R' → Rename current session
  • -
  • Down arrow (or 'N') → Next session
  • -
  • Up arrow (or 'P') → Previous session
  • -
  • Right arrow → Open drawer
  • -
  • Left arrow → Close drawer
  • -
  • 'F' → Toggle full screen
  • -
  • 'M' → Show menu
  • -
  • 'V' → Paste
  • -
  • +/- → Adjust text size
  • -
  • 1-9 → Go to numbered session
  • -
- -

Package management

-

A minimal base system consisting of the Apt package manager and the busybox collection of system utilities - is installed when first starting Termux. Additional packages are available using the apt command:

-
-
apt update
Updates the list of available packages. This commands needs to be run initially directly after installation - and regularly afterwards to receive updates.
-
apt search <query>
Search among available packages.
-
apt install <package>
Install a new package.
-
apt upgrade
Upgrade outdated packages. For Apt to know about newer packages you will need to update the package index, so you will normally want to run apt update before upgrading.
-
apt show <package>
Show information about a package.
-
apt list
List all available packages.
-
apt list --installed
List all installed packages.
-
apt remove <package>
Remove an installed package.
-
- -

Apt as a package manager uses a package format named dpkg. Normally direct use of dpkg is not necessary, but the - following two commands may be of use:

-
-
dpkg -L <package>
-
List installed files of a package.
-
dpkg --verify
-
Verify the integrity of installed packages.
-
-

View the apt manual page (execute apt install man to install a man page viewer first) for more information.

- -

Text editing

-

By default the busybox version of vi is available. This is a barebone and somewhat unfriendly editor - - install nano for a more straight-forward editor and - vim for a more powerful one.

- -

Using SSH

-

By installing the openssh package (by executing apt install openssh) you may SSH into remote systems, - optionally putting private keys or configuration under $HOME/.ssh/.

-

If you wish to use an SSH agent to avoid entering passwords, the Termux openssh package provides - a wrapper script named ssha (note the 'a' at the end) for ssh which:

-
    -
  1. Starts the ssh agent if necessary (or connect to it if already running).
  2. -
  3. Runs ssh-add if necessary.
  4. -
  5. Runs ssh with the provided arguments.
  6. -
-

This means that the agent will prompt for a key password at first run, but remember the authorization for subsequent ones.

- -

Interactive shells

-

The base system that is installed when first starting Termux uses the bash shell while zsh is available as - an installable alternative:

- - -

Termux and Android

-

Termux is designed to cope with the restrictions of running as an ordinary Android app without requiring root, which - leads to several differences between Termux and a traditional desktop system. The file system layout is drastically different:

-
    -
  • Common folders such as /bin, /usr/, /var and /etc does not exist.
  • -
  • The Android system provides a basic non-standard file system hierarchy, where e.g. /system/bin contains some system binaries.
  • -
  • The user folder $HOME is inside the private file area exposed to Termux as an ordinary Android app. - Uninstalling Termux will cause this file area to be wiped - so save important files outside this area such as in /sdcard - or use a version control system such as git.
  • -
  • Termux installs its packages in a folder exposed through the $PREFIX environment variable (with e.g. binaries in $PREFIX/bin, - and configuration in $PREFIX/etc).
  • -
  • Shared libraries are installed in $PREFIX/lib, which are available from binaries due to Termux setting the $LD_LIBRARY_PATH - environment variable. These may clash with Android system binaries in /system/bin, which may force LD_LIBRARY_PATH to be - cleared before running system binaries.
  • -
-

Besides the file system being different, Termux is running as a single-user system without root - each Android app is running as - its own Linux user, so running commands inside Termux may not interfere with other installed applications.

-

Running as non-root implies that ports below 1024 cannot be bound to. Many packages have been configured to have compatible - default values - the ftpd, httpd, and sshd servers default to 8021, 8080 and 8022, respectively.

- -

Add-on: API

-

The API add-on exposes Android system functionality such as SMS messages, GPS location or the Text-to-speech functionality through command line tools.

- - -

Add-on: Float

-

The Float add-on consists of a floating terminal window visible while running other apps.

- - -

Add-on: Styling

-

The Styling add-on provides color schemes and fonts to beabeautify and customize the appearance of the Termux terminal.

- - -

Add-on: Widget

-

The Widget add-on brings a widget to your homescreen, providing links to run scripts in your $HOME/.shortcuts/ folder.

- - -

Source and licenses

-

Termux uses terminal emulation code from Terminal Emulator for Android - which is under the Apache License, Version 2.0. - Packages available through Termux are distributed under their respective licenses with scripts and patches used to build them - available on github.

- -
- - diff --git a/app/src/main/java/com/termux/app/TermuxHelpActivity.java b/app/src/main/java/com/termux/app/TermuxHelpActivity.java index a072b443..d1aae8c7 100644 --- a/app/src/main/java/com/termux/app/TermuxHelpActivity.java +++ b/app/src/main/java/com/termux/app/TermuxHelpActivity.java @@ -5,33 +5,63 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.view.ViewGroup; +import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; -/** Basic embedded browser for viewing the bundled help page. */ +/** Basic embedded browser for viewing help pages. */ public final class TermuxHelpActivity extends Activity { private WebView mWebView; + private ProgressBar mProgressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + final RelativeLayout progressLayout = new RelativeLayout(this); + RelativeLayout.LayoutParams lParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + lParams.addRule(RelativeLayout.CENTER_IN_PARENT); + mProgressBar = new ProgressBar(this); + mProgressBar.setIndeterminate(true); + mProgressBar.setLayoutParams(lParams); + progressLayout.addView(mProgressBar); + mWebView = new WebView(this); - setContentView(mWebView); + WebSettings settings = mWebView.getSettings(); + settings.setCacheMode(WebSettings.LOAD_NO_CACHE); + settings.setAppCacheEnabled(false); + setContentView(progressLayout); + mWebView.clearCache(true); + mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { + if (url.startsWith("https://termux.com")) { + // Inline help. + setContentView(progressLayout); + return false; + } + try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } catch (ActivityNotFoundException e) { - // TODO: Android TV does not have a system browser - but needs better method of getting back - // than navigating deep here. + // Android TV does not have a system browser. + setContentView(progressLayout); return false; } return true; } + + @Override + public void onPageFinished(WebView view, String url) { + setContentView(mWebView); + } }); - mWebView.loadUrl("file:///android_asset/help.html"); + mWebView.loadUrl("https://termux.com/help.html"); } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e0844216..f3f55662 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,6 @@ Termux - Termux help Termux user New session Normal - unnamed