aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xbin/fzf-am7
-rwxr-xr-xbin/highlight4
-rw-r--r--bin/list-all-system-activities.java14
-rwxr-xr-xbin/termux-file-editor8
-rwxr-xr-xbin/termux-install.sh90
l---------bin/termux-url-opener1
-rw-r--r--colors.properties21
-rw-r--r--font.ttfbin0 -> 2390900 bytes
l---------shell1
-rwxr-xr-xshortcuts/pc-connect9
-rwxr-xr-xshortcuts/pc-disconnect7
-rwxr-xr-xshortcuts/sync-tab5
-rwxr-xr-xshortcuts/toggle-vault6
-rw-r--r--termux.properties146
15 files changed, 322 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..67590df
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Termux
+This repostiory containse some scripts and configuration files usually placed in ~/.termux directory.
+The repository is meant to be used along with [voidrice](https://git.vikas.rocks/voidrice) which has general purpose configuration for unix based systems.
diff --git a/bin/fzf-am b/bin/fzf-am
new file mode 100755
index 0000000..1971dcd
--- /dev/null
+++ b/bin/fzf-am
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+PACKAGE="$(sudo pm list packages | fzf | cut -d: -f2)"
+
+sudo dumpsys package |
+ grep -Eo $(printf "^[[:space:]]+[0-9a-f]+[[:space:]]+%s/[^[:space:]]+" "${PACKAGE}") |
+ grep -oE "[^[:space:]]+$" | fzf
diff --git a/bin/highlight b/bin/highlight
new file mode 100755
index 0000000..34e772b
--- /dev/null
+++ b/bin/highlight
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+shift $(( $# - 1 ))
+bat --style=plain --color=always "$@"
diff --git a/bin/list-all-system-activities.java b/bin/list-all-system-activities.java
new file mode 100644
index 0000000..14f31e5
--- /dev/null
+++ b/bin/list-all-system-activities.java
@@ -0,0 +1,14 @@
+class Main {
+ public static void main(String args[]) {
+ List<PackageInfo> pInfos = getPackageManager().getInstalledPackages(PackageManager.GET_ACTIVITIES);
+ for (PackageInfo pInfo : pInfos) {
+ ActivityInfo[] aInfos = pInfo.activities;
+ if (aInfos != null) {
+ for (ActivityInfo activityInfo : aInfos) {
+ Log.i("ACT", activityInfo.name);
+ // do whatever else you like...
+ }
+ }
+ }
+ }
+}
diff --git a/bin/termux-file-editor b/bin/termux-file-editor
new file mode 100755
index 0000000..3edb40e
--- /dev/null
+++ b/bin/termux-file-editor
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ~/.profile
+
+fsend "$@"
+
+printf "Press Enter to continue..."
+read -r ans
diff --git a/bin/termux-install.sh b/bin/termux-install.sh
new file mode 100755
index 0000000..8251dbb
--- /dev/null
+++ b/bin/termux-install.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+set -e
+cd ~ || exit
+
+err() { printf "termux-installer: %s\n" "$@" >&2; exit 1; }
+msg() { printf "$1" "$2"; }
+
+file_not_link() {
+ msg "\n:: %s: file exists but is not a symbolic link\n" "$1"
+ msg ":: Rename and continue? [Y/n] "
+ read -r ans
+ case "$ans" in y|Y|'') mv -v "$1" "$1.bak" ;; esac
+}
+
+cleardir() {
+ [ -L "$1" ] && {
+ msg "\n:: %s is a symbolic link to %s\n" "$1" "$(readlink "$1")"
+ msg ":: Skip it? [Y/n] " "$1"
+ read -r ans
+ case "$ans" in y|Y|'') return 1 ;; esac
+ }
+ [ -f "$1" ] && file_not_link "$1"
+ [ ! -d "$1" ] && return
+ msg "\n:: %s: direcotry already exists\n" "$1"
+ msg ":: Delete it? [Y/n] "
+ read -r ans
+ case "$ans" in
+ y|Y|'') rm -rf "$1" ;;
+ *) return 1 ;;
+ esac
+}
+
+echo "\n:: We need to create a link to your sdcard"
+cleardir ~/storage && {
+ msg ":: Path to your sdcard: "
+ read -r sdcard
+
+ [ -d "$sdcard" ] || err "$sdcard: No such directory"
+ echo "\n:: Contents of directory $sdcard :-"
+ ls "$sdcard/"
+ msg "\n:: Press Enter to continue..."
+ read -r ans
+ ln -sfv "$sdcard" ~/storage
+}
+
+makelink() {
+ [ -L "$2" ] && {
+ link_source="$(readlink "$2")"
+ [ "$1" = "$link_source" ] && return
+ echo "\n:: Link already exists but has an unexpected source"
+ msg ":: %s -> %s\n" "$link_source" "$2"
+ msg ":: Override? [Y/n] "
+ read -r ans
+ case "$ans" in
+ y|Y|'') ;;
+ *) return ;;
+ esac
+ }
+ [ -e "$2" ] && file_not_link "$2"
+ ln -sfv "$1" "$2"
+}
+
+makelink /sdcard ~/sdcard
+makelink /sdcard/Documents ~/Documents
+makelink /sdcard/Download/ ~/Downloads
+makelink /sdcard/Pictures/ ~/Pictures
+makelink ~/storage/Music ~/Music
+makelink ~/storage/Movies ~/Movies
+makelink ~/storage/GDrive ~/GDrive
+
+PKGS="openssh zsh tmux fzf python rsync"
+# termux-change-repo
+
+for pkg in $PKGS; do
+ dpkg-query -W "$pkg" 2>&1 >/dev/null && continue
+ msg "\n:: Installing %s...\n" "$pkg"
+ pkg install -y "$pkg"
+done
+
+cleardir ~/.termux && {
+ git clone git@github.com:csstudent41/termux-config
+ mv -v termux-config .termux
+ termux-reload-settings
+}
+
+cleardir ~/voidrice && {
+ git clone git@github.com:csstudent41/voidrice
+ rsync -Pru ~/voidrice/ ~/
+}
diff --git a/bin/termux-url-opener b/bin/termux-url-opener
new file mode 120000
index 0000000..d6607c2
--- /dev/null
+++ b/bin/termux-url-opener
@@ -0,0 +1 @@
+termux-file-editor \ No newline at end of file
diff --git a/colors.properties b/colors.properties
new file mode 100644
index 0000000..9f1f4cf
--- /dev/null
+++ b/colors.properties
@@ -0,0 +1,21 @@
+# https://github.com/Mayccoll/Gogh/blob/master/themes/argonaut.sh
+background=#0e1019
+foreground=#fffaf4
+cursor=#fffaf4
+
+color0=#232323
+color1=#ff000f
+color2=#8ce10b
+color3=#ffb900
+color4=#008df8
+color5=#6d43a6
+color6=#00d8eb
+color7=#ffffff
+color8=#444444
+color9=#ff2740
+color10=#abe15b
+color11=#ffd242
+color12=#0092ff
+color13=#9a5feb
+color14=#67fff0
+color15=#ffffff
diff --git a/font.ttf b/font.ttf
new file mode 100644
index 0000000..e7d8304
--- /dev/null
+++ b/font.ttf
Binary files differ
diff --git a/shell b/shell
new file mode 120000
index 0000000..6a9e552
--- /dev/null
+++ b/shell
@@ -0,0 +1 @@
+/data/data/com.termux/files/usr/bin/zsh \ No newline at end of file
diff --git a/shortcuts/pc-connect b/shortcuts/pc-connect
new file mode 100755
index 0000000..0c5fe12
--- /dev/null
+++ b/shortcuts/pc-connect
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+termux-wake-lock
+su -c setprop service.adb.tcp.port 43896
+su -c start adbd
+
+for prog in sshd syncthing; do
+ pidof -q "$prog" || "$prog" &
+done >/dev/null 2>&1
diff --git a/shortcuts/pc-disconnect b/shortcuts/pc-disconnect
new file mode 100755
index 0000000..4f5ed19
--- /dev/null
+++ b/shortcuts/pc-disconnect
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+pkill syncthing
+pkill sshd
+
+su -c stop adbd
+termux-wake-unlock
diff --git a/shortcuts/sync-tab b/shortcuts/sync-tab
new file mode 100755
index 0000000..6ded2de
--- /dev/null
+++ b/shortcuts/sync-tab
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. ~/.profile
+
+synctab
diff --git a/shortcuts/toggle-vault b/shortcuts/toggle-vault
new file mode 100755
index 0000000..36393ef
--- /dev/null
+++ b/shortcuts/toggle-vault
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+state="Not Implemented"
+echo "$state"
+termux-toast "Toggle Vault is $state"
+sleep 1
diff --git a/termux.properties b/termux.properties
new file mode 100644
index 0000000..55ea744
--- /dev/null
+++ b/termux.properties
@@ -0,0 +1,146 @@
+### After making changes and saving you need to run `termux-reload-settings`
+### to update the terminal. All information here can also be found on the
+### wiki: https://wiki.termux.com/wiki/Terminal_Settings
+
+###############
+# General
+###############
+
+### Allow external applications to execute arbitrary commands within Termux.
+### This potentially could be a security issue, so option is disabled by
+### default. Uncomment to enable.
+allow-external-apps = true
+
+### Default working directory that will be used when launching the app.
+# default-working-directory = /data/data/com.termux/files/home
+
+### Uncomment to disable toasts shown on terminal session change.
+# disable-terminal-session-change-toast = true
+
+### Uncomment to not show soft keyboard on application start.
+# hide-soft-keyboard-on-startup = true
+
+### Uncomment to let keyboard toggle button to enable or disable software
+### keyboard instead of showing/hiding it.
+# soft-keyboard-toggle-behaviour = enable/disable
+
+### Adjust terminal scrollback buffer. Max is 50000. May have negative
+### impact on performance.
+# terminal-transcript-rows = 2000
+
+### Uncomment to use volume keys for adjusting volume and not for the
+### extra keys functionality.
+# volume-keys = volume
+
+###############
+# Fullscreen mode
+###############
+
+### Uncomment to let Termux start in full screen mode.
+fullscreen = true
+
+### Uncomment to attempt workaround layout issues when running in
+### full screen mode.
+# use-fullscreen-workaround = true
+
+###############
+# Cursor
+###############
+
+### Cursor blink rate. Values 0, 100 - 2000.
+# terminal-cursor-blink-rate = 0
+
+### Cursor style: block, bar, underline.
+# terminal-cursor-style = block
+
+###############
+# Extra keys
+###############
+
+### Settings for choosing which set of symbols to use for illustrating keys.
+### Choose between default, arrows-only, arrows-all, all and none
+extra-keys-style = all
+
+### Force capitalize all text in extra keys row button labels.
+# extra-keys-text-all-caps = true
+
+### Default extra-key configuration
+# extra-keys = [[ESC, TAB, CTRL, ALT, {key: '-', popup: '|'}, DOWN, UP]]
+extra-keys = [['`', '~/', ':', {key: '-', popup: '|'}, ALT, KEYBOARD]]
+
+### Two rows with more keys
+# extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'], \
+# ['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]
+
+### Configuration with additional popup keys (swipe up from an extra key)
+# extra-keys = [[ \
+# {key: ESC, popup: {macro: "CTRL f d", display: "tmux exit"}}, \
+# {key: CTRL, popup: {macro: "CTRL f BKSP", display: "tmux ←"}}, \
+# {key: ALT, popup: {macro: "CTRL f TAB", display: "tmux →"}}, \
+# {key: TAB, popup: {macro: "ALT a", display: A-a}}, \
+# {key: LEFT, popup: HOME}, \
+# {key: DOWN, popup: PGDN}, \
+# {key: UP, popup: PGUP}, \
+# {key: RIGHT, popup: END}, \
+# {macro: "ALT j", display: A-j, popup: {macro: "ALT g", display: A-g}}, \
+# {key: KEYBOARD, popup: {macro: "CTRL d", display: exit}} \
+# ]]
+
+###############
+# Colors/themes
+###############
+
+### Force black colors for drawer and dialogs
+use-black-ui = true
+
+###############
+# HW keyboard shortcuts
+###############
+
+### Disable hardware keyboard shortcuts.
+# disable-hardware-keyboard-shortcuts = true
+
+### Open a new terminal with ctrl + t (volume down + t)
+shortcut.create-session = ctrl + 3
+
+### Go one session down with (for example) ctrl + 2
+shortcut.next-session = ctrl + 2
+
+### Go one session up with (for example) ctrl + 1
+shortcut.previous-session = ctrl + 1
+
+### Rename a session with (for example) ctrl + n
+shortcut.rename-session = ctrl + 4
+
+###############
+# Bell key
+###############
+
+### Vibrate device (default).
+# bell-character = vibrate
+
+### Beep with a sound.
+# bell-character = beep
+
+### Ignore bell character.
+# bell-character = ignore
+
+###############
+# Back key
+###############
+
+### Send the Escape key.
+# back-key=escape
+
+### Hide keyboard or leave app (default).
+# back-key=back
+
+###############
+# Keyboard issue workarounds
+###############
+
+### Letters might not appear until enter is pressed on Samsung devices
+# enforce-char-based-input = true
+
+### ctrl+space (for marking text in emacs) does not work on some devices
+# ctrl-space-workaround = true