├── .install.mana.sh
├── LICENSE
├── Makefile
├── README.md
├── bpkg.json
├── default.nix
├── drawercli.1
├── drawercli.sh
├── flake.nix
└── lib
└── launch.sh
/.install.mana.sh:
--------------------------------------------------------------------------------
1 | ## Installer for mana package manager
2 |
3 | PREFIX="/data/data/com.termux/files/usr"
4 |
5 | # pre-install
6 |
7 | check_dependency pick
8 | check_dependency fzf
9 | check_dependency sed
10 | check_dependency grep
11 | check_dependency coreutils
12 |
13 | if [ ! -f /sdcard/termuxlauncher/.apps-launcher ]; then
14 | # not found
15 | echo -e "Missing dependency lib \"termuxlauncher\/.apps-launcher\" !";
16 | echo -e "Could not continue the installation."
17 | exit 1;
18 | fi
19 |
20 | # creating config
21 | if [ -f ~/.drawercli_aliases ]; then
22 | source ~/.drawercli_aliases
23 | else
24 | echo -en "Creating config files.. "
25 |
26 | cat <<- "EOF" > $HOME/.drawercli_aliases
27 | alias apps='drawercli'
28 | alias app_favorites='drawercli -u'
29 | alias app_recomendations='drawercli -S'
30 | alias app_refesh='drawercli -r'
31 | alias app_wallpaper='drawercli -w'
32 | EOF
33 | source ~/.drawercli_aliases
34 | echo " Done!"; sleep 1; echo "You can find the configuration file at ~/.drawercli_aliases"
35 | fi
36 |
37 | # install to usr/bin
38 | mv ./drawercli $PREFIX/bin
39 | chmod +x $PREFIX/bin/drawercli;
40 |
41 | echo -e "Installation succes!";
42 | exit 0;
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 luisadha
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | TARGET = drawercli.sh
2 | # Installation directories
3 | PREFIX ?= /usr
4 | BINDIR = $(PREFIX)/bin
5 |
6 | # Rule to install the binary
7 | install:
8 | @echo "Installing $(TARGET) to $(BINDIR)"
9 | # Use the 'install' command to copy the binary to the target directory with executable permissions
10 | install -m 755 $(TARGET) $(BINDIR)
11 |
12 | # Rule to uninstall the binary
13 | uninstall:
14 | @echo "Removing $(TARGET) from $(BINDIR)"
15 | # Remove the binary from the target directory
16 | rm -f $(BINDIR)/$(TARGET)
17 |
18 | # Default rule
19 | all:
20 | @echo "Use 'make install' to install and 'make uninstall' to remove."
21 |
22 | # Phony targets to prevent conflicts with files named 'install', 'uninstall', or 'all'
23 | .PHONY: install uninstall all
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | [](https://img.shields.io/github/license/luisadha/drawercli.svg) 
6 | [](https://img.shields.io/badge/Maintained%3F-yes-green.svg) 
7 |
9 |
App Drawer for Termux
10 |
13 |
14 | Find drawercli on alrc-termux plugin
15 |
16 | ## Description
17 | A cli app for termux to open user android apps with Termuxlauncher backend as your main launcher, installation of termuxlauncher apps is necessary for the script to work. [Follow the installation instructions](https://github.com/amsitlab/termuxlauncher/releases)
18 |
19 | ## Features
20 |
21 | - Interactive by scrolling the screen to select apps and typing to find favorite apps (this parts has been improved on new update).
22 |
23 | - Updated app list in Termuxlauncher.
24 |
25 | - Display frequently opened apps.
26 |
27 | - Makes app suggestions to open with a specified number.
28 |
29 | - Calculate total user applications
30 |
31 | - Support touchscreen
32 |
33 | - Can be installed in ~/.shortcuts to run via Termux:widget
34 |
35 | - Can be installed on ztmexluis or luis-toolbox.sh
36 |
37 | > [!NOTE]
38 | > Without Termuxlauncher & Termux this tool won't work.
39 |
40 | ## Dependencies & Requirements
41 | #### A. Download and install these apk's
42 | [v1.2.4] Using termuxlauncher =< Android 11
43 | * Termuxlauncher apk's [Check this!](https://github.com/amsitlab/termuxlauncher/releases)
44 | * Termux:widget (optional) [Find on Play store](https://play.google.com/store/apps/details?id=com.termux.widget)
45 |
46 | [v1.2.7] Using [ListMyApps](https://github.com/u0a316/ListMyApps/releases/tag/v1.0)
47 | #### B. Other
48 | * Android minimum version 5.0 up to Android 13 Using ListMyApp
49 |
51 | #### C. Install packages
52 | * ```input``` keyevent (is in /system/bin make sure it is part of the $PATH variable) (**Optional**)
53 | * git, curl, fzf, coreutils, sed, grep and which.
54 | * termux-setup-storage
55 |
56 |
57 | ## Install with Bash Package Manager ([bpkg](https://bpkg.sh/bpkg/))
58 |
59 | ```sh
60 | bpkg install -g luisadha/drawercli
61 | ```
62 |
63 |
66 | * Install with Make
67 |
68 | ```make
69 | make install
70 | ```
71 |
72 | * Install with Nix-build
73 |
74 | ```nix
75 | nix-build
76 | ```
77 | ```nix
78 | nix-env -i ./result
79 | ```
80 |
81 | ## Uninstall
82 |
83 | - general (i.e.: termux)
84 |
85 | ```sh
86 | rm -f ${PREFIX}/bin/drawercli
87 | ```
88 | - nix-on-droid
89 |
90 | ```nix
91 | nix-env -e drawercli
92 | nix-env --rollback
93 | ```
94 |
95 | - gnumake
96 |
97 | ```make
98 | make uninstall
99 | ```
100 | ## Optional Config
101 | Try our custom configurations, Termux config is stored in ~/.termux/termux.properties
102 |
103 | ```json
104 | extra-keys-style = none
105 | extra-keys = [[{key: "drawercli \n", popup: KEYBOARD, display: drawercli}]]
106 | ```
107 | ## Usage
108 |
109 | ```sh
110 | drawercli -S 4 | -u
111 |
112 | Command-line-based app drawer to display a list of all user-installed apps on the device and many other features.
113 |
114 | drawercli requires the termuxlauncher to be installed and used at least once to use this tool.
115 |
116 | Available options:
117 |
118 | -S NUMBER To display app recommendations to open, recommendations will be displayed according to the given number.
119 | -c, --clear-history To clear the history of opened app activities.
120 | -r To refresh the list of apps, newly installed apps will be displayed after the refresh.
121 | -s, --skip Does nothing, literally opens Termux itself.
122 | -u To display the most frequently used apps.
123 | -w, --see-wallpaper To view the wallpaper or open the current-wallpaper app.
124 | -h, --help To display this help message.
125 | ```
126 | ## Tested
127 | | Platform | Status |
128 | | :---------------- | :------: |
129 | | Termux | ✅ |
130 | | Nix-on-droid | ✅ |
131 | | Acode Terminal Plugin | ❌ |
132 |
133 | ## Issue
134 | 1. Fix shebang on nix
135 |
136 | ```bash
137 | sed -i '1s|#!/data/data/com.termux.nix/files/usr/bin/bash|#!/data/data/com.termux.nix/files/home/.nix-profile/bin/bash|' $(command -v drawercli)
138 | ```
139 |
140 | 2. Issues related to nix-on-droid, Try clearing this duplicate package garbage fix
141 |
142 | ```bash
143 | nix-collect-garbage
144 | ```
145 |
146 | ## Author
147 |
148 | @luisadha
149 |
150 | ## Contributor
151 |
152 | @zaedstudioshpkentang
153 |
154 | ## 💰 Support my work by Donating
155 |
156 | [](https://www.buymeacoffee.com/luisadha)
157 | [](https://www.paypal.com/paypalme/luisadha01)
158 |
159 | ## Thanks
160 |
161 | - github.com/amsitlab/termuxlauncher
162 | - junegunn.github.io/fzf
163 | - github.com/bpkg/bpkg
164 |
--------------------------------------------------------------------------------
/bpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "drawercli",
3 | "version": "1.2.4",
4 | "description": "This cli app supports using termuxlauncher as your primary launcher for Android phones, interactively and easily install. That's simply the Termuxlauncher Add-on built with fzf🚀",
5 | "scripts": [ "drawercli.sh" ],
6 | "license": "MIT",
7 | "install": "bpkg run install",
8 | "dependencies": { "luisadha/launch": "v1.0.2" },
9 | "commands": {
10 | "install": "mkdir -p ${PREFIX:-/usr/local}/{bin,share/man/man1} && cp drawercli.sh ${PREFIX:-/usr/local}/bin/drawercli && cp drawercli.1 ${PREFIX:-/usr/local}/share/man/man1 && echo \"The installation was completed.\"",
11 | "lint": "shellcheck **/*.sh"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/default.nix:
--------------------------------------------------------------------------------
1 | { pkgs ? import {} }:
2 |
3 | pkgs.stdenv.mkDerivation {
4 | pname = "drawercli";
5 | version = "1.2.4";
6 |
7 | src = ./.;
8 |
9 | buildInputs = [ pkgs.bash ];
10 |
11 | buildPhase = ''
12 | mkdir -p $out/bin
13 | '';
14 |
15 | installPhase = ''
16 | mkdir -p $out/share/doc/drawercli
17 | cp -f ./LICENSE $out/share/doc/drawercli/LICENSE
18 | cp -f ./README.md $out/share/doc/drawercli/README.md
19 | cp -f ./drawercli.sh $out/bin/drawercli
20 | chmod +x $out/bin/drawercli
21 | '';
22 |
23 | meta = with pkgs.lib; {
24 | description = "This cli app supports using termuxlauncher as your primary launcher for Android phones, interactively and easily install. That's simply the Termuxlauncher Add-on built with fzf🚀
25 | ";
26 | license = licenses.mit;
27 | maintainers = with maintainers; [ luisadha ];
28 | };
29 | }
30 |
--------------------------------------------------------------------------------
/drawercli.1:
--------------------------------------------------------------------------------
1 | .\" Automatically generated by Pandoc 3.1.13
2 | .\"
3 | .TH "" "" "" "" ""
4 | Drawercli\-lightwieght
5 | Application drawer in the terminal.
6 | Requires the Termuxlauncher library or app and Termux installed on the
7 | device.
8 | Find drawercli in the alrc\-termux plugin.
9 | .SS Features
10 | .IP \[bu] 2
11 | Interactive by scrolling the screen to select apps and typing to find
12 | favorite apps (this parts has been improved on new update).
13 | .IP \[bu] 2
14 | Updated app list in Termuxlauncher.
15 | .IP \[bu] 2
16 | Display frequently opened apps.
17 | .IP \[bu] 2
18 | Makes app suggestions to open with a specified number.
19 | .IP \[bu] 2
20 | Calculate total user applications
21 | .IP \[bu] 2
22 | Support touchscreen
23 | .IP \[bu] 2
24 | Can be installed in \[ti]/.shortcuts to run via Termux:widget
25 | .IP \[bu] 2
26 | Can be installed on ztmexluis or luis\-toolbox.sh
27 | .PP
28 | Note: Without Termuxlauncher & Termux this tool won\[cq]t work
29 | .SS Prerequites/dependencies
30 | .IP \[bu] 2
31 | Termuxlauncher apk\[cq]s
32 | (https://github.com/amsitlab/termuxlauncher/releases)
33 | .IP \[bu] 2
34 | \[ti]pkg install termux\-api
35 | (https://wiki.termux.com/wiki/Termux:API)\[ti]
36 | .IP \[bu] 2
37 | \[ti]pkg install pick (https://github.com/mptre/pick)\[ti]
38 | .IP \[bu] 2
39 | pkg install fzf
40 | .IP \[bu] 2
41 | Input keyevent (is in /system/bin make sure it is part of the $PATH
42 | variable)
43 | .IP \[bu] 2
44 | pkg install coreutils
45 | .IP \[bu] 2
46 | pkg install sed
47 | .IP \[bu] 2
48 | pkg install grep
49 | .IP \[bu] 2
50 | Install apk\[cq]s Termux:widget (optional)
51 | .SS Install
52 | .IP
53 | .EX
54 | curl \-fSsl \[dq]https://raw.githubusercontent.com/luisadha/drawercli/main/drawercli.sh\[dq] \-o \[ti]/.local/bin/drawercli \f[B]&&\f[R] chmod +x \[ti]/.local/bin/drawercli
55 | .EE
56 | .SS Uninstall
57 | .IP
58 | .EX
59 | rm \-f \[ti]/.local/bin/drawercli
60 | .EE
61 | .SS Usage
62 | .IP
63 | .EX
64 | echo
65 | echo \[dq]Available options:\[dq]
66 | echo
67 | echo \-e \[dq]\-S NUMBER\[dq] \[dq]\[rs]t\[rs]t\[dq] \[dq]To display app recommendations to open, recommendations will be displayed according to the given number.\[dq]
68 | echo \-e \[dq]\-c, \-\-clear\-history\[dq] \[dq]\[rs]t\[dq] \[dq]To clear the history of opened app activities.\[dq]
69 | echo \-e \[dq]\-r\[dq] \[dq]\[rs]t\[rs]t\[rs]t\[dq] \[dq]To refresh the list of apps, newly installed apps will be displayed after the refresh.\[dq]
70 | echo \-e \[dq]\-s, \-\-skip\[dq] \[dq]\[rs]t\[rs]t\[dq] \[dq]Does nothing, literally opens Termux itself.\[dq]
71 | echo \-e \[dq]\-u\[dq] \[dq]\[rs]t\[rs]t\[rs]t\[dq] \[dq]To display the most frequently used apps.\[dq]
72 | echo \-e \[dq]\-w, \-\-see\-wallpaper\[dq] \[dq]\[rs]t\[dq] \[dq]To view the wallpaper or open the current\-wallpaper app.\[dq]
73 | echo \-e \[dq]\-h, \-\-help\[dq] \[dq]\[rs]t\[rs]t\[dq] \[dq]To display this help message.\[dq]
74 | .EE
75 | .SS Author
76 | \[at]luisadha
77 | .SS Contributor
78 | \[at]zaedstudioshpkentang
79 | .SS Thanks
80 | .IP \[bu] 2
81 | Creator of Termuxlauncher and termux for creating great apps
82 | .IP \[bu] 2
83 | mptre creator of pick
84 | .IP \[bu] 2
85 | fzf creator
86 |
--------------------------------------------------------------------------------
/drawercli.sh:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash
2 |
3 | # drawercli v1.2.7-launch.bash (android13 support)
4 | # App drawer on Android but it's CLI,
5 | # Copyright (c) 2023 Luis Adha
6 | # made with love & clean code priority
7 |
8 | enable_history=0
9 | fast_scroll_flags='--cycle' #not used yet # soon to version v1.2.2
10 | version="1.2.7-launch";
11 | name="drawercli";
12 | self="none";
13 | depend="termuxlauncher";
14 | hint="$name: Scroll to 'Termux' or type that to quit.\ ";
15 | info="$name: No such apps or interrupted by user." ;
16 | num=1;
17 | tmp_dir="$HOME/.tmp"
18 | history_path="$HOME/.drawercli_history";
19 | export PATH="$PATH:/system/bin";
20 | pathlib="source $(which launch)"
21 | launch="launch_App"
22 | main_activity="launch_Main"
23 | empty_activity="launch_ItSelf"
24 | suggest_activity() {
25 | local num=$@
26 | launch_Random "$num"
27 | }
28 |
29 | $pathlib ||
30 | echo "CANNOT EXECUTE "$0": library "launch" not found: needed by main executable"
31 |
32 | #source $HOME/storage/shared/termuxlauncher/.apps-launcher &>/dev/null || source "${EXTERNAL_STORAGE}/termuxlauncher/.apps-launcher" || source /sdcard/termuxlauncher/.apps-launcher
33 |
34 | # initialize termuxlauncher, this will read all user-installed apps on the device
35 | # initialize alias if any
36 | source ~/.drawercli_aliases 2>/dev/null
37 | mkdir -p $tmp_dir
38 | function waitingInterupt() {
39 | echo -e "$name: Process interrupted by the user (Ctrl + C)"
40 | exit 0
41 | }
42 | trap waitingInterupt SIGINT
43 | #function resetClipboard() {
44 | #termux-clipboard-set ""
45 | #}
46 | if [ "$SHELL_CMD__PACKAGE_NAME" == "com.termux.nix" ]; then
47 | self="nix"
48 | function hideSoftKeyboard {
49 | :
50 | }
51 | else
52 | self="termux"
53 | function hideSoftKeyboard() {
54 | hide_soft_keyboard || input keyevent 4 2>/dev/null;
55 | }
56 | fi
57 | : "function historyPrepare() {
58 | cat $HOME/.drawercli_history | xargs | xargs -n $num > $history_path
59 | }" # deprecrated function
60 | function Drawer {
61 | while true;
62 | do
63 | $main_activity "$1" >&2 > ~/.tmp/drawercli.out
64 | echo "$(cat ~/.tmp/drawercli.out)" >> $HOME/.drawercli_history
65 | if [ "$(cat ~/.tmp/drawercli.out)" == "termux" ]; then
66 | break
67 | elif [ "$(cat ~/.tmp/drawercli.out)" == "" ] ; then
68 | echo "$info"; break
69 | fi
70 | $launch "$(cat ~/.tmp/drawercli.out)"
71 | # trap waitingInterupt SIGINT
72 | # resetClipboard;
73 | hideSoftKeyboard;
74 | continue;
75 | done; }
76 | opt="$1"; if [ -z "$opt" ]; then
77 | hideSoftKeyboard; Drawer;
78 | elif [ "$opt" == "-s" ] || [ "$opt" == "--skip" ]; then # THIS OPTION SKIP
79 | $empty_activity
80 | exit 0;
81 | elif [ "$opt" == "-v" ] || [ "$opt" == "--version" ]; then
82 | echo -e "drawercli v${version} Copyright (c) 2023 - 2024 Luis Adha ";
83 | echo -e ""
84 | echo -e "You can find this repository at ";
85 | echo -e "Using library termuxlauncher visit ";
86 | exit 0;
87 | elif [ "$opt" == "-S" ]; then # THIS OPTION SUGGESTIONS
88 | hideSoftKeyboard; error='option requires an argument after -- S'; catch=$2; try=`if [ -z "$catch" ]; then echo "$name: $error" >&2; exit ${1:+1}; fi`
89 |
90 | shift
91 | suggest_activity "$1"
92 |
93 | exit ${1:+0}; # untuk menyembunyikan error dari command launch jika salah input
94 | elif [ "$opt" == "-u" ]; then # THIS OPTION MOST USAGE
95 | if [ ! -f $HOME/.drawercli_history ]; then
96 | echo "drawercli: No history most opened apps."
97 | exit ${1:+1};
98 | elif [ $(cat $HOME/.drawercli_history | wc -w) -eq 0 ]; then
99 | echo "drawercli: No history most opened apps. 2";
100 | exit ${1:+2};
101 | else
102 | cat $HOME/.drawercli_history \
103 | | uniq -c \
104 | | sort -r \
105 | | sed 's/[\t0-9]//g' \
106 | | xargs \
107 | | xargs -n $num \
108 | | head -n 1 \
109 | | fzf $fast_scroll_flags >&2 > ~/.tmp/drawercli.out
110 | $launch $(cat ~/.tmp/drawercli.out);
111 | #resetClipboard;
112 | exit ${1:+0};
113 | fi
114 | elif [ "$opt" == "-r" ]; then # THIS OPTION FOR REFRESH LIST APPS BY termuxlauncher
115 | $empty_activity
116 |
117 | exit ${1:+0};
118 | elif [ "$opt" == "-w" ] || [ "$opt" == "--see-wallpaper" ]; then
119 | $launch "Current wallpaper"
120 | exit ${1:+0};
121 | elif [ "$opt" == "-c" ] || [ "$opt" == "--clear-history" ]; then
122 | set +o noclobber
123 | echo '' > ${HOME}/.drawercli_history
124 | echo "drawercli: History was cleared!"
125 | exit ${1:+0};
126 | elif [ "$opt" == "-h" ] || [ "$opt" == "--help" ]; then
127 |
128 | echo "drawercli -S 4 | -u "
129 | echo
130 | echo " Command-line-based app drawer to display a list of all user-installed apps on the device and many other features."
131 | echo
132 | echo "drawercli requires the termuxlauncher to be installed and used at least once to use this tool."
133 | echo
134 | echo "Available options:"
135 | echo
136 | echo -e "-S NUMBER" "\t\t" "To display app recommendations to open, recommendations will be displayed according to the given number."
137 | echo -e "-c, --clear-history" "\t" "To clear the history of opened app activities."
138 | echo -e "-r" "\t\t\t" "To refresh the list of apps, newly installed apps will be displayed after the refresh."
139 | echo -e "-s, --skip" "\t\t" "Does nothing, literally opens Termux itself."
140 | echo -e "-u" "\t\t\t" "To display the most frequently used apps."
141 | echo -e "-w, --see-wallpaper" "\t" "To view the wallpaper or open the current-wallpaper app."
142 | echo -e "-h, --help" "\t\t" "To display this help message."
143 | echo
144 | exit ${1:+1};
145 | else echo "$(basename $0): options not recognized -$opt";
146 | exit ${1:+1}
147 | fi
148 |
--------------------------------------------------------------------------------
/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | description = "Flake for drawercli";
3 |
4 | outputs = { self, nixpkgs }: {
5 | packages.x86_64-linux = nixpkgs.lib.mkShell {
6 | buildInputs = [
7 | nixpkgs.stdenv
8 | ];
9 | shellHook = ''
10 | echo "drawercli ready to use!"
11 | '';
12 | };
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/lib/launch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #set -xv
3 | # Name: launch.sh
4 | # Version: v1.0
5 | # Type: Library/Module (SHELL)
6 | # Compatible: By General POSIX Shells)
7 | # Usage: For Drawercli Package
8 | # Detail shellcheck:
9 | : "
10 | ~/ shellcheck --shell=sh launch.sh
11 |
12 | In launch.bash line 43:
13 | online=true; #^----^ SC2034
14 | ^----^ SC2034 (warning): online appears unused. Verify use (or export if used externally).
15 |
16 | For more information:
17 | https://www.shellcheck.net/wiki/SC2034 -- online appears unused. Verify use...
18 | "
19 | # Author: Luis Adha
20 | # License: GNU GPLv3
21 |
22 | history_filename="drawercli_history";
23 | enable_history=0;
24 | export url="https://raw.githubusercontent.com/u0a316/ActivityResource/refs/heads/curl/app_activity.txt";
25 |
26 | launch_RequireInternetConnection() {
27 | ping -c 1 google.com > /dev/null 2>&1;
28 | return $?;
29 | #&& return 0 || :
30 | };
31 | launch_CheckConection() {
32 | if ! launch_RequireInternetConnection; then
33 | echo "Offline mode!";
34 | return 1;
35 | else
36 | echo "Online mode!";
37 | return 0;
38 | fi
39 | };
40 | launch_ItSelf() {
41 | : || am start --user 0 -n com.termux/com.termux.app.TermuxActivity > /dev/null 3>&1;
42 |
43 | };
44 | launch_CheckConection;
45 | if [ $? -eq 1 ]; then
46 | unset app
47 | app="$HOME/storage/shared/Documents/.listmyapps/app_activity.txt";
48 | online=false;
49 | launch_App() {
50 | if [ $# -eq 0 ] || [ -z "$1" ]; then
51 | return
52 | fi
53 | target_source="${app:-}";
54 | am start --user 0 -n "$(awk -F '|' -v name="$1" 'tolower($1) ~ tolower(name) {print $2; exit}' < "$target_source")";
55 | };
56 | launch_AppList() {
57 | target_source="${app:-}"
58 | awk -F '|' '{print $1}' < "$target_source"
59 | };
60 | else
61 | app="url"
62 | online=true; #^----^ SC2034
63 | launch_App() {
64 | if [ $# -eq 0 ] || [ -z "$1" ]; then
65 | return
66 | fi
67 | target_url="${url:-}"
68 | am start --user 0 -n "$(curl -sL "$target_url" | awk -F '|' -v name="$1" 'tolower($1) ~ tolower(name) {print $2; exit}')";
69 | };
70 | launch_AppList() {
71 | eval "target_url=\$$app";
72 | curl -sL "$target_url" | awk -F '|' '{print $1}';
73 | };
74 | launch_Source() {
75 | curl -L "$url";
76 | };
77 |
78 | fi
79 |
80 | launch_Random() {
81 | numerof="$1"
82 | launch_App "$(launch_AppList | sort --reverse --numeric-sort | shuf | head -n "$numerof" | fzf -0)";
83 | };
84 | launch_Main() {
85 | if [ $enable_history -eq 0 ]; then
86 | launch_App "$(launch_AppList | sort --reverse --numeric-sort | fzf | tee -a ~/.${history_filename})";
87 | else
88 | launch_App "$(launch_AppList | sort --reverse --numeric-sort | fzf )";
89 | fi
90 | };
91 |
92 | #set +xv
93 |
--------------------------------------------------------------------------------