Warning
This plugin requires the acodex-server NodeJS package to be installed and running on Termux.
AcodeX is a powerful and AI integrated terminal plugin with 90k++ downloads for Acode that enhances your coding productivity by adding in-app Termux terminal integration. With AcodeX, you can execute terminal commands directly from within the Acode app, eliminating the need to switch between apps for coding and terminal access. AcodeX has almost every terminal feature and also it is more feature rich when it comes to rendering things compared termux etc (Thanks to xtermjs)
Note
When starting a new terminal, be sure to adjust the terminal panel according to your screen. You can drag it to your desired position, and it will automatically adjust the columns and rows according to your screen size.
- Features
- Prerequisites
- Installation
- For Existing Users: Enabling GUI Features
- How to Use
- Running GUI Apps
- Selection Context Menu
- Keybindings
- Using AI
- Api Docs
- Custom Fonts
- Support Project
- License
- First backup your settings before updating
- fixed some bugs related to disposing of terminal reported by Users
- Added font ligatures support (you can disable it from settings)
- fix: ctrl - k issue when terminal is minimised or opened
- now ctrl-k can also be used as shortcut to maximise terminal if it is open and minimised
- new settings to on/off haptic(vibration) on Selection start
- some minor fixes and few typos adjustments
For previous change logs/updates, visit: Change Log
- full page mode for AcodeX similar to other terminal plugins
- fix bugs related to touch selection and gui viewer
- ssh based Terminal support
- config(dotfiles) for acodex to customise everything from the config file
- suggest more π
-
User-Friendly Terminal: Seamlessly integrated terminal within Acode. Open it with
Ctrl+K
or search"Open Terminal"
in the command palette. -
AI Assistance: Unsure about a command? Just ask, and AI will write it for you.
-
Boost Productivity: Execute commands directly in Acode without switching apps, saving valuable time.
-
Customizable Terminal Panel: Move, resize, minimize, or maximize the terminal panel to fit your workflow.
-
Intuitive Interface: Designed for developers of all skill levels with an easy-to-use interface.
-
Personalization: Tailor the terminalβs appearance and behavior to your preferences.
-
Efficient Session Management: Manage multiple sessions smoothly while minimizing resource usage.
-
Persistent Sessions: Terminal sessions stay active even when Acode is closed. Resume where you left off when reopened.
-
Easy Directory Navigation: Change directories with a single click for hassle-free navigation.
-
Beautiful Themes: Choose from 10+ stunning themes to personalize your coding environment.
-
Transparency Options: Adjust panel transparency for a sleek, customized look.(it will take resources)
-
Nerd Fonts Support: Preloaded with Nerd Fonts and options to add your own custom fonts.
-
Keyboard Shortcuts: Use shortcuts to perform tasks efficiently without relying on the mouse.
-
Extensible: Highly pluggable for other plugins to integrate and extend functionality.
-
Search Functionality: Quickly search within the terminal for easy access to commands.
-
Mouse/Touch Selection: Supports selection within the terminal using mouse or touch.
-
GUI App Support: Run GUI apps via VNC (for learning and experimentation).
-
Image Rendering: Supports rendering images in the terminal (enable in settings).
-
Font Ligatures: Supports font ligatures in supported font family
To use AcodeX, you need to have the Termux app installed on your Android device. However, you don't need to switch between apps to use the terminal, as AcodeX offers a convenient way to access the terminal directly within the Acode app with the help of Termux.
-
Install the Plugin in Acode
Open the Acode App and navigate to:
Acode > Settings > Plugins > AcodeX
, then install the plugin. -
Install the Server in Termux
To install everything required, including prompts for GUI-related tools like TigerVNC and Websockify (if needed), run the following command in Termux:curl -sL https://raw.githubusercontent.com/bajrangCoder/acode-plugin-acodex/main/installServer.sh | bash
Alternatively, you can manually install the required packages:
pkg update && pkg upgrade -y pkg install python nodejs -y npm i -g acodex-server pkg install x11-repo pkg install tigervnc -y curl -L https://raw.githubusercontent.com/bajrangCoder/websockify_rs/main/install.sh | bash
The key steps are:
- Install
python
andnodejs
. - Install the
acodex-server
package globally using npm. - If you plan to run GUI apps, also install
tigervnc
andwebsockify_rs
.
- Install
Important
After installing TigerVNC, make sure to set a password by running the vncserver
command the first time.
-
Termux Specific Step
Before installing on Termux, run this command to bypass a Termux-specific issue:cd $HOME && mkdir -p .gyp && echo "{'variables': {'android_ndk_path': ''}}" > .gyp/include.gypi
Tip
After successfully installing acodex-server
, you can uninstall Python if it's no longer needed.
If you're an existing user and want to start using the new GUI features, follow these steps to install the required packages:
-
Install TigerVNC and Websockify
Run the following commands in Termux to install the necessary packages:pkg install x11-repo pkg install tigervnc -y curl -L https://raw.githubusercontent.com/bajrangCoder/websockify_rs/main/install.sh | bash
-
Setup VNC Server
After installation, run thevncserver
command for the first time to set up a password:vncserver
This will prompt you to create a password for your VNC server.
-
Start Using GUI Features
Once youβve set up the VNC server, AcodeX will handle everything for you automatically, enabling the use of GUI apps seamlessly. but you will need to enable this feature from AcodeX settings.(after enabling you will get an image like icon on AcodeX header for viewing the gui)
Tutorial link: https://youtu.be/sXlIhrbpjyw
- Start the server in Termux using:
acodeX-server
. - To use AcodeX, press
Ctrl+K
or search for"Open Terminal"
in the command palette (pressCtrl+Shift+P
to open the command palette). - Enter the port number, and the terminal will start.
- Plus
+
icon to create new session - Use the minus icon button to hide the terminal while coding and the terminal button or
Ctrl-Shift-T
to show it. - You can also drag the terminal panel around by clicking and dragging through the terminal header area.
- The
β
button is for closing the terminal. - The folder icon button on the terminal header is for navigating to opened files (in the editor) directory.
To run GUI apps within AcodeX, follow the steps below:
-
Install the Required Packages
Ensure that you have installed the necessary packages by following the instructions in the Installation or Existing Users Setup sections. -
Enable GUI Viewer Settings
- Navigate to
Acode > Settings > Plugins > AcodeX
. - Tap the βοΈ icon at the top-right corner of the AcodeX header to access the plugin settings.
- Enable the GUI Viewer option from the settings.
- Navigate to
-
Open AcodeX Terminal
- Open the AcodeX terminal using the
Ctrl+K
shortcut, or search for "Open Terminal" in the command palette.
- Open the AcodeX terminal using the
-
Launch the GUI Viewer
- In the terminal header, you'll see a small image-like icon.
- Click the icon. The first time you do this, it will set up the necessary configurations and prompt you for the VNC password.
- Enter your VNC password, which will be saved securely in the local storage for future sessions.
-
Using the GUI Viewer
After setup, the GUI Viewer page will open. On this page, youβll find multiple interactive elements such as:-
Display Variable Button:
This button copies theDISPLAY
environment variable needed for running GUI apps.Before launching a GUI app, always click the Display Button to set up the display environment in the terminal. If you skip this step, the GUI app will fail with a "No display variable" error.
-
Keyboard Icon:
A keyboard icon is available to activate your mobile keyboard for typing within GUI applications.
-
-
Run Your GUI App
- In the AcodeX terminal, click the Display button, which will copy and execute the
export DISPLAY
command. - Start your GUI app in the terminal, and it will open in the integrated viewer.
- In the AcodeX terminal, click the Display button, which will copy and execute the
Tip
Always verify that the export DISPLAY
command was executed successfully before launching your GUI application.
Note
the display env variable command needs to run once in a terminal session
On small screens, the context menu can clutter the interface. Additionally, since the AcodeX panel is adjustable, the menu can behave unpredictably. We believe in prioritizing keyboard shortcuts over UI buttons for efficiency.
However, you can still perform all tasks using the following key shortcuts:
- Select All: Ctrl + A
- Copy: Ctrl + Shift + C
- Paste: Ctrl + Shift + V
AcodeX provides some additional Keybindings for easy usability of terminal features.
Note
These keybindings will only work if you will use these inside terminal only. except the * marked one
Following are the supported Keybindings :
- Ctrl+N : opens a new terminal session
- Ctrl+W : close opened terminal session
- Ctrl+Shift+V : paste something from clipboard inside your terminal
- Ctrl+Shift+C : copy selected text from terminal
- Ctrl+Left Arrow : open previous session corresponding to current one like if current one is session 2 then it will open session 1(if exists)
- Ctrl+Right Arrow : open next session corresponding to current one like if current one is session 2 then it will open session 2(if exists)
- Ctrl+1 : opens session 1
- Ctrl+2 : opens session 2 if exists
- Ctrl+3 : opens session 3 if exists
- Ctrl+4 : opens session 4 if exists
- Ctrl+5 : opens session 5 if exists
- Ctrl+Shift+I : clear the terminal
- Ctrl+Shift+T : Maximise the terminal *
- Ctrl+a : select all
To leverage the power of artificial intelligence within AcodeX Terminal
Plugin, follow these steps:
-
Obtain API Key: Before using the AI capabilities, you need to acquire an API key for the respective model you wish to utilize. Visit the website of your chosen model and obtain the API key. Once obtained, navigate to the AcodeX settings and input the API key. Additionally, you can select your preferred model from the list of currently supported models, which include:
- Deepseek : Get API key π
- Chatgpt : Get API key π
- Gemini-Pro(default) : Get API key π
-
Accessing AI in the Terminal:
- To access the AI functionality within the terminal, simply type
#
. This action will prompt a popup window to appear. - Within the popup window, you can input your prompt or query.
- Upon entering your prompt, click the button provided to prompt the AI to generate a command based on your input.
- The generated command will be written into the terminal. From there, you have the option to execute the command as is or modify it according to your requirements.
- To access the AI functionality within the terminal, simply type
Warning
Avoid prompts that may lead the AI to provide descriptive or explanatory responses instead of actionable commands.
Note
Use AI wisely, as there may be token limits associated with your API key. Be mindful of your usage to avoid exceeding token limits and potential interruptions in service.
We value your feedback! Please provide any suggestions or feedback to help us improve the AI integration and suggest additional AI models for future enhancements.
Stay tuned for more AI integrations and improvements coming soon π!
The acodex
plugin provides a set of api to interact with the AcodeX terminal.
Executes a command in the AcodeX terminal.
- Parameters:
cmd
(string): The command to be executed.withEnter
(boolean, optional): Whether to append an Enter keypress. Defaults totrue
.
Returns a boolean indicating whether the AcodeX terminal is currently minimized or not.
Returns a boolean indicating whether the AcodeX terminal is currently opened or not.
Maximizes the AcodeX terminal if it is opened and minimized.
openTerminal(termContainerHeight: number = 270, port: number = this.settings.port) => Promise<SessionAPI>
Opens the AcodeX terminal.
-
Parameters:
termContainerHeight
(number, optional): Height of the terminal container. Defaults to270
.port
(number, optional): Port number for the terminal server. Defaults to the value fromthis.settings.port
.
-
Returns:
- A
Promise
resolving to aSessionAPI
object.
- A
Creates a new terminal session.
- Returns:
- A
Promise
resolving to aSessionAPI
object.
- A
Changes the active terminal session.
-
Parameters:
sessionName
(string): Name of the session to switch to.
-
Returns:
- A
Promise
resolving to aSessionAPI
object.
- A
Closes the AcodeX terminal if it is opened.
Converts an Acode URI to a format readable by the terminal.
-
Parameters:
path
(string): Acode URI path.
-
Returns:
- A string representing the converted path.
Adds a new theme to the AcodeX terminal.
- Parameters:
themeName
(string): Name of the theme.colorSchema
(object): Color schema object for the theme.
Applies a theme to the AcodeX terminal.
- Parameters:
themeName
(string): Name of the theme to apply.
The SessionAPI
object provides methods for interacting with the terminal session.
Registers a callback function to be called when a message is received form server.
- Parameters:
callback
((data: string | Uint8Array) => void): Callback function to handle incoming messages.
Writes/Executes a command to the terminal.
- Parameters:
cmd
(string): The command to write.withEnter
(boolean, optional): Whether to append an Enter keypress. Defaults totrue
.
const acodex = acode.require("acodex");
acodex.execute("ls"); // execute the ls command in terminal
const isMinimized = acodex.isMinimized();
const isOpened = acodex.isTerminalOpened();
acodex.maximiseTerminal();
const session = await acodex.openTerminal();
session.onmessage(data => console.log(data));
session.write("ls");
const sessionSocket = await acodex.createSession();
sessionSocket.onmessage(data => console.log(data));
sessionSocket.write("ls");
const changeSessionSocket = await acodex.changeSession("AcodeX2");
changeSessionSocket.onmessage(data => console.log(data));
changeSessionSocket.write("ls");
acodex.closeTerminal();
const termReadablePath = acodex.convertAcodeUriToTermReadable("file://storage/emulated/0/myTheme/acode/file/path");
acodex.addTheme("myTheme", { background: "#fff", text: "#000" }); // you can find more colors in themes.js
acodex.applyTheme("myTheme");
Custom fonts are provided to load any other external fonts
To load a custom font:
- Download the font files(Note: Download nerd font file in case if you are loading for termux theme).
- Create a
css
file anywhere in the internal storage. - Write CSS code to load font files using relative URLs in the CSS, for example:
@font-face {
font-family: "MesloLGS NF Regular";
src: url("./MesloLGS NF Regular.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
- Open AcodeX Settings page and find the option
"Custom Font StyleSheet"
. - Select your CSS file created in step 3.
- Enter the font name in the Font Family option.
- Restart the terminal.
AcodeX is made possible by the use of:
- @bajrangCoder - AcodeX is created by Raunak Raj
We welcome your suggestions for enhancing AcodeX. If you have an idea for a new feature or improvement, please consider opening a feature request on our GitHub Issues page. Be sure to provide detailed information about the feature you'd like to see, along with any use cases or scenarios that could benefit from it.
If you encounter any issues or unexpected behavior while using AcodeX, please help us by reporting the problem. To report a bug, visit our GitHub Issues page and create a new issue. Please include the following information in your bug report:
- A clear and concise description of the issue.
- Steps to reproduce the problem.
- Information about your environment, including your operating system and AcodeX version.
- Screenshots or error messages, if applicable.
Your contributions are highly appreciated and welcome! You can contribute to the AcodeX Plugin in various ways:
-
Fork the Repository: Start by forking the AcodeX Plugin repository
-
Create an Issue: If you plan to add new features or fix a bug, it's a good practice to create an issue first. Describe the problem or feature you want to work on. This allows for discussion and collaboration with the maintainers.
-
Make Changes: After forking the repo, create a new branch, and start working on your changes.
-
Open a Pull Request: Once your changes are ready, open a pull request (PR) on the original repository. Reference the issue you created if relevant.
-
Code Review: Your PR will be reviewed by the maintainers, and feedback may be provided. Be prepared to make adjustments if needed.
-
Merge: Once your PR is approved, it will be merged into the main branch. Congratulations, your contribution is now part of AcodeX Plugin!
- Fork it and Clone the repo
git clone https://github.com/bajrangCoder/acode-plugin-acodex.git
- navigate to acodex directory and install the dependency
pnpm install
- For building the plugin zip
pnpm build
Warning
You will need acodex-server NodeJS package to be installed and running on Termux to test the plugin.
You can also support the development of AcodeX Plugin by making a financial contribution. Donations help in maintenance and further development. Also you can mention your GitHub handle when making contribution
If you find AcodeX Plugin useful, consider giving it a star on GitHub. It's a simple way to show your appreciation and help others discover the project. and You can review AcodeX on https://acode.app
Your contributions, whether through code, financial support, or a simple star, make AcodeX Plugin better for the entire community. Thank you for your support!
β€οΈβ€οΈ Thanks for using AcodeX β€οΈβ€οΈ