├── Screenshot.png ├── README.md ├── LICENSE └── termuxer.zsh-theme /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patrick330602/termuxer/HEAD/Screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # termuxer 2 | 3 | ![screenshot](Screenshot.png) 4 | 5 | **termuxer** is a simple yet fancy Oh-My-Zsh theme inspired by agnoster and linuxer theme. It features: 6 | 7 | - Current Line of Command 8 | - Current Device Display 9 | - Current Directory status 10 | - Last Returned Error Code 11 | 12 | ## Installation 13 | 14 | **`curl` and Termux API should be installed** 15 | 16 | type the following in the terminal: 17 | 18 | `curl -fsSL https://raw.githubusercontent.com/patrick330602/termuxer/master/termuxer.zsh-theme >> ~/.oh-my-zsh/custom/themes/termuxer.zsh-theme` 19 | 20 | ## License 21 | 22 | The Project is under MIT. 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Patrick J. Wu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /termuxer.zsh-theme: -------------------------------------------------------------------------------- 1 | # vim:ft=zsh ts=2 sw=2 sts=2 2 | # 3 | # Termix 4 | # A simple and fancy theme based on agnoster's Theme(https://gist.github.com/3712874) 5 | # 6 | # # README 7 | # 8 | # In order for this theme to render correctly, you will need a 9 | # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). 10 | # Make sure you have a recent version: the code points that Powerline 11 | # uses changed in 2012, and older versions will display incorrectly, 12 | # in confusing ways 13 | 14 | ### Segment drawing 15 | # A few utility functions to make it easy and re-usable to draw segmented prompts 16 | 17 | CURRENT_BG='NONE' 18 | # Special Powerline characters 19 | 20 | () { 21 | local LC_ALL="" LC_CTYPE="en_US.UTF-8" 22 | # NOTE: This segment separator character is correct. In 2012, Powerline changed 23 | # the code points they use for their special characters. This is the new code point. 24 | # If this is not working for you, you probably have an old version of the 25 | # Powerline-patched fonts installed. Download and install the new version. 26 | # Do not submit PRs to change this unless you have reviewed the Powerline code point 27 | # history and have new information. 28 | # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of 29 | # what font the user is viewing this source code in. Do not replace the 30 | # escape sequence with a single literal character. 31 | # Do not change this! Do not make it '\u2b80'; that is the old, wrong code point. 32 | SEGMENT_SEPARATOR=$'\ue0b0' 33 | } 34 | 35 | # Begin a segment 36 | # Takes two arguments, background and foreground. Both can be omitted, 37 | # rendering default background/foreground. 38 | prompt_segment() { 39 | local bg fg 40 | [[ -n $1 ]] && bg="%K{$1}" || bg="%k" 41 | [[ -n $2 ]] && fg="%F{$2}" || fg="%f" 42 | if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then 43 | echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " 44 | else 45 | echo -n "%{$bg%}%{$fg%} " 46 | fi 47 | CURRENT_BG=$1 48 | [[ -n $3 ]] && echo -n $3 49 | } 50 | 51 | # End the prompt, closing any open segments 52 | prompt_end() { 53 | if [[ -n $CURRENT_BG ]]; then 54 | echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" 55 | else 56 | echo -n "%{%k%}" 57 | fi 58 | echo -n "%{%f%}" 59 | CURRENT_BG='' 60 | } 61 | 62 | ### Prompt components 63 | # Each component will draw itself, and hide itself if no information needs to be shown 64 | 65 | # Context: Device/Android Version 66 | prompt_context() { 67 | prompt_segment white black "%*" 68 | prompt_segment green white "%h" 69 | prompt_segment cyan white "`getprop ro.product.model`" 70 | } 71 | 72 | # Dir: current working directory 73 | prompt_dir() { 74 | prompt_segment magenta white "%1d" 75 | #echo -n $PWD | sed -e "s|^$HOME|~|" -e 's|\(\.\{0,1\}[^/]\)[^/]*/|\1/|g' 76 | } 77 | 78 | # Virtualenv: current working virtualenv 79 | prompt_virtualenv() { 80 | local virtualenv_path="$VIRTUAL_ENV" 81 | if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then 82 | prompt_segment blue white "(`basename $virtualenv_path`)" 83 | fi 84 | } 85 | 86 | # Status: 87 | # - was there an error 88 | # - am I root 89 | # - are there background jobs? 90 | prompt_status() { 91 | local symbols 92 | symbols=() 93 | [[ $UID -eq 0 ]] && symbols+="⚡" 94 | [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="⚙" 95 | symbols+="❖ %?" 96 | prompt_segment white black "$symbols" 97 | } 98 | 99 | ## Main prompt 100 | build_prompt() { 101 | prompt_context 102 | prompt_virtualenv 103 | prompt_dir 104 | prompt_end 105 | } 106 | 107 | build_prompt_s() { 108 | RETVAL=$? 109 | prompt_status 110 | prompt_end 111 | } 112 | 113 | PROMPT='%{%f%b%k%}$(build_prompt) 114 | $(build_prompt_s)' 115 | --------------------------------------------------------------------------------