Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launcher mode support? #206

Open
thewisenerd opened this issue Dec 4, 2016 · 11 comments
Open

launcher mode support? #206

thewisenerd opened this issue Dec 4, 2016 · 11 comments

Comments

@thewisenerd
Copy link

is it possible to have termux as a "launcher" screen?

this angle has been looked at by TUI-ConsoleLauncher ( https://github.com/Andre1299/TUI-ConsoleLauncher ), and I'd think that it would be nice to have an "optional" launcher mode.

a couple of user scripts using the Termux:API add-on and auto complete (volup + T) will make a good launcher.

as for the "launching" apps part, can be either done as a addon extension to Termux:API or cough su am start com.package/.Activity cough some userscripts.

@xelxebar
Copy link

xelxebar commented Sep 5, 2017

As a T-UI user myself, I've been mulling over this idea for a while.

Turning Termux into a launcher, it turns out, is just a matter of adding a line to the manifest:

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index aacc244..35cc0d4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -84,6 +84,7 @@
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.IOT_LAUNCHER"/>
+                <category android:name="android.intent.category.HOME"/>
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
         </activity-alias>

So the actual work would be the "activity launching" stuff. Evidently, we can launch activities without root by passing the --user 0 flag to am start: e.g.

$ am start -n org.fdroid.fdroid/.FDroid --user 0

This works pretty well, and In theory we should be able to filter through the list of activities with

$ pm list packages

However, I'm only able to successfully do that via adb. From Termux, it's failing with android.os.DeadObjectException for some reason.

Anyway, we could probably make all this usable with a shell script or two and some bash completion functions.

@thewisenerd
Copy link
Author

@xelxebar hi, and thanks for trying this out

pm list packages is crashing because of a selinux denial.

09-10 06:09:12.956  5209  5209 I main    : type=1400 audit(0.0:78): avc: denied { read write } for path="/dev/pts/0" dev="devpts" ino=3 scontext=u:r:system_server:s0 tcontext=u:object_r:untrusted_app_devpts:s0:c512,c768 tclass=chr_file permissive=1

i set my selinux to permissive and it works 😄

need to figure out a way to fix this 🤞

@thewisenerd
Copy link
Author

@xelxebar i modified termux to handle a "apps-cache" intent[0] which lists all apps into $HOME/.apps which looks something like this;

FM Radio|com.android.fmradio/.FmMainActivity|com.android.fmradio|true
Camera|org.cyanogenmod.snap/com.android.camera.CameraLauncher|org.cyanogenmod.snap|true
Telegram|org.telegram.messenger/org.telegram.ui.LaunchActivity|org.telegram.messenger|false

coupled with a bash script[1], i can now launch apps :)

[0] thewisenerd@b877a81
[1] https://github.com/thewisenerd/dotfiles/blob/droid/bin/zx

@xelxebar
Copy link

@thewisenerd This is an excellent solution :) Thanks!

@ebflhippie
Copy link

ebflhippie commented Feb 14, 2018

I am trying to create a run prompt for my device using termux, termux widget and or possibly automate... I am relitively new to "programming/scripting..", and still trying to get a feel for it all. I was wondering if the first file is a modified version of termux apk or a patch? Any resources i could read to helpme impliment it? or any further explaination on how these programs work. I do understand using the am command and can launch apps from termux... its just the rest, you know the hard stuff i need to figure out or just decipher from whats already been done thank you.

@amsitlab
Copy link

Without hacking termux apps , just calling termux activity
https://github.com/amsitlab/termuxlauncher

@Lavoista
Copy link

Lavoista commented Nov 13, 2018

Hi there @amsitlab , i just tried this, it works OK, thank you!

testedOn:

OS: Android 8.0.0 aarch64
Host: HUAWEI RNE-L03
Kernel: 4.4.23+
Uptime: secs
Packages: 448 (dpkg), 1 (pkg)
Shell: bash 4.4.23
Terminal: /dev/pts/1
CPU: (8) @ 1.709GHz
Memory: 2247MiB / 3788MiB

@me-nkr
Copy link

me-nkr commented Aug 15, 2020

@thewisenerd This is an excellent solution :) Thanks!

@xelxebar i modified termux to handle a "apps-cache" intent[0] which lists all apps into $HOME/.apps which looks something like this;

FM Radio|com.android.fmradio/.FmMainActivity|com.android.fmradio|true
Camera|org.cyanogenmod.snap/com.android.camera.CameraLauncher|org.cyanogenmod.snap|true
Telegram|org.telegram.messenger/org.telegram.ui.LaunchActivity|org.telegram.messenger|false

coupled with a bash script[1], i can now launch apps :)

[0] thewisenerd@b877a81
[1] https://github.com/thewisenerd/dotfiles/blob/droid/bin/zx

Hi man l am looking for a way to launch an app with termux and I'm a beginner. I think your script mentioned in this can help me with that. But I'm confused. So could you please tell me how to use it ? Thanks in advance

@Etzio-TUI

This comment has been minimized.

@Decapitater

This comment has been minimized.

@twaik
Copy link
Member

twaik commented Dec 23, 2023

Technically it is possible to add activity-alias to TermuxActivity like it is done in HomeActivity alias for IoT devices. But normally disabled (to not appear as launcher out-of-the-box) with a possibility to enable/disable it from Termux settings (like it is done for FileShareReceiverActivity and FileViewReceiverActivity). In this case we will not break current behaviour.

@termux termux deleted a comment from herp1337 Dec 23, 2023
@termux termux deleted a comment from herp1337 Dec 23, 2023
@termux termux deleted a comment from herp1337 Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants