Feature description
Currently, Termux only sends android.intent.extra.TEXT to ~/bin/termux-url-opener as the parameter $1. I believe it would be convenient for some users if Termux also sended android.intent.extra.SUBJECT as the parameter $2.
Additional information
A dummy script to see how Termux send parameters
I confirmed this behavior by writing the following script.
cat /data/data/com.termux/files/home/bin/termux-url-opener
#!/data/data/com.termux/files/usr/bin/bash
url="$1"
echo >> /sdcard/Download/test.txt
date >> /sdcard/Download/test.txt
echo "1: $1" >> /sdcard/Download/test.txt
echo "2: $2" >> /sdcard/Download/test.txt
echo "3: $3" >> /sdcard/Download/test.txt
echo "4: $4" >> /sdcard/Download/test.txt
echo "@: $@" >> /sdcard/Download/test.txt
echo "*: $*" >> /sdcard/Download/test.txt
I opened a random URL (e.g. Demo Background Sample Video - Youtube) in my web browser. Then, I pressed the button "Share", then I selected Termux as a Share target. The script termux-url-opener was executed, so the file /sdcard/Download/test.txt changed to:
cat /sdcard/Download/test.txt
Tue Jun 9 18:39:45 -05 2026
1: https://youtube.com/watch?v=K4TOrB7at0Y
2:
3:
4:
@: https://youtube.com/watch?v=K4TOrB7at0Y
*: https://youtube.com/watch?v=K4TOrB7at0Y
The reason why I want to get android.text.intent.SUBJECT
I use the app Tasks.org to manage TODO tasks. When that app is installed, it is added as a "Share" target. When sharing a website through Firefox, the title of the website is added as the title of the TODO task and the URL is added as the description of the TODO task. I want to accomplish something similar in Termux: I want to make termux-url-opener append the URL and the title of the website to a file called read-later.txt. The screenshot below shows the window Tasks.org after pressing "Share" from Fitrfox and selecting "Tasks.org" in the "Share" menu.
Behavior when using "Share" from Firefox and Youtube
Since I'm not familiar with how Android apps send parameters under the hood through the "Share" button, I decided to look into that. I downloaded the app Intent Intercept. Then I visited a random website (e.g. Demo Background Sample Video - Youtube), I pressed the button "Share" from the apps Firefox and Youtube and then I seleced "Intent Intercept" in the menu opened after pressing "Share". The screenshots below show the app "Intent Intercept" after pressing "Share" in those apps. The code block contains the confent of the field "URI". Note that in the "URI", the title of the website is stored at android.intent.extra.SUBJECT, while the URL of the website is stored at android.intent.extra.TEXT.
From Firefox:
URI:
intent:#Intent;action=android.intent.action.SEND;type=text/plain;launchFlags=0x18080000;S.android.intent.extra.SUBJECT=Demo%20Background%20Sample%20Video%20-%20YouTube;S.android.intent.extra.TEXT=https%3A%2F%2Fm.youtube.com%2Fwatch%3Fv%3DK4TOrB7at0Y;end
Screenshot:
From Youtube
URI:
intent:#Intent;action=android.intent.action.SEND;type=text/plain;launchFlags=0x1b080000;launchHwFlags=0x400;S.android.intent.extra.SUBJECT=Demo%20Background%20Sample%20Video;S.android.intent.extra.TEXT=https%3A%2F%2Fyoutube.com%2Fwatch%3Fv%3DK4TOrB7at0Y%26si%3D5oAhlUNaMdtr6qnR;end
Screenshot:
As I mentioned, I'm not familiar with how Android apps share paramters through the "Share" button, but it seems that android.intent.extra.SUBJECT is commonly used for storing the title of a website or a video, so passing as $2 to ~/bin/termux-url-opener would be convenient for Termux users that use ~/bin/termux-url-opener.
Current workaround
I'm currently using curl to send a request, and then using a HTML parser to get the title of a website. I wish I didn't have to send that second request because it sometimes take 2-3 seconds to complete and those few seconds do have a significant impact in my daily routine.
$ cat /data/data/com.termux/files/home/bin/termux-url-opener
#!/data/data/com.termux/files/usr/bin/bash
url="$1"
url_encoded="$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$url'''))")"
title="$(curl --silent --location --header 'Accept-Language: en-US,en;q=0.9' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0' "$url" | pup 'head title text{}' | head -n 1)"
title_encoded="$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$title'''))")"
emacsclient --socket-name my-emacs-daemon "org-protocol://capture?template=my-template-1&url=$url_encoded&title=$title_encoded"
Feature description
Currently, Termux only sends
android.intent.extra.TEXTto~/bin/termux-url-openeras the parameter$1. I believe it would be convenient for some users if Termux also sendedandroid.intent.extra.SUBJECTas the parameter$2.Additional information
A dummy script to see how Termux send parameters
I confirmed this behavior by writing the following script.
I opened a random URL (e.g. Demo Background Sample Video - Youtube) in my web browser. Then, I pressed the button "Share", then I selected Termux as a Share target. The script termux-url-opener was executed, so the file
/sdcard/Download/test.txtchanged to:The reason why I want to get
android.text.intent.SUBJECTI use the app Tasks.org to manage TODO tasks. When that app is installed, it is added as a "Share" target. When sharing a website through Firefox, the title of the website is added as the title of the TODO task and the URL is added as the description of the TODO task. I want to accomplish something similar in Termux: I want to make termux-url-opener append the URL and the title of the website to a file called
read-later.txt. The screenshot below shows the window Tasks.org after pressing "Share" from Fitrfox and selecting "Tasks.org" in the "Share" menu.Behavior when using "Share" from Firefox and Youtube
Since I'm not familiar with how Android apps send parameters under the hood through the "Share" button, I decided to look into that. I downloaded the app Intent Intercept. Then I visited a random website (e.g. Demo Background Sample Video - Youtube), I pressed the button "Share" from the apps Firefox and Youtube and then I seleced "Intent Intercept" in the menu opened after pressing "Share". The screenshots below show the app "Intent Intercept" after pressing "Share" in those apps. The code block contains the confent of the field "URI". Note that in the "URI", the title of the website is stored at
android.intent.extra.SUBJECT, while the URL of the website is stored atandroid.intent.extra.TEXT.From Firefox:
URI:
Screenshot:
From Youtube
URI:
Screenshot:
As I mentioned, I'm not familiar with how Android apps share paramters through the "Share" button, but it seems that
android.intent.extra.SUBJECTis commonly used for storing the title of a website or a video, so passing as$2to~/bin/termux-url-openerwould be convenient for Termux users that use~/bin/termux-url-opener.Current workaround
I'm currently using
curlto send a request, and then using a HTML parser to get the title of a website. I wish I didn't have to send that second request because it sometimes take 2-3 seconds to complete and those few seconds do have a significant impact in my daily routine.