diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-03-26 17:31:27 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-03-26 17:31:27 +1300 |
commit | 73e01c2fc02742ea8cf8bb9505880157c67f837e (patch) | |
tree | 7595e5859bd87d7470f6fdede87f203dbc1675b1 | |
parent | Merge branch 'release/v11.12.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-73e01c2fc02742ea8cf8bb9505880157c67f837e.tar.gz dotfiles-73e01c2fc02742ea8cf8bb9505880157c67f837e.zip |
Merge branch 'release/v11.13.0'v11.13.0
* release/v11.13.0:
Update LD_PRELOAD checks to change dynamically
Include prompt prefix when using Torsocks
Correct capitalisation for LibreWolf
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | X/xinitrc.d/browser.sh | 4 | ||||
-rw-r--r-- | bash/bashrc.d/prompt.bash | 24 | ||||
-rw-r--r-- | ksh/kshrc.d/prompt.ksh | 25 | ||||
-rw-r--r-- | zsh/zshrc.d/prompt.zsh | 25 |
5 files changed, 67 insertions, 15 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v11.12.0 -Fri, 11 Mar 2022 11:16:34 +0000 +tejr dotfiles v11.13.0 +Sat, 26 Mar 2022 04:31:22 +0000 diff --git a/X/xinitrc.d/browser.sh b/X/xinitrc.d/browser.sh index b6e1d57e..b88724bf 100644 --- a/X/xinitrc.d/browser.sh +++ b/X/xinitrc.d/browser.sh @@ -1,6 +1,6 @@ # Choose a GUI browser with some rough heuristics -# If Librewolf is available, start by assuming that +# If LibreWolf is available, start by assuming that if command -v librewolf >/dev/null 2>&1 ; then BROWSER=librewolf fi @@ -11,7 +11,7 @@ if ( exec >/dev/null 2>&1 # Don't switch if it's not there command -v dillo || exit - # Switch if Librewolf isn't there + # Switch if LibreWolf isn't there command -v librewolf || exit 0 # Switch if procfs says we have less than 2GB of RAM awk '$1=="MemTotal:"&&$2<2^20{m++}END{exit!m}' < /proc/meminfo diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index f9678f20..86691a9c 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -21,15 +21,18 @@ prompt() { fi PS1=$PS1'\w' - # Add sub-commands; VCS, job, and return status checks - PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' - # Add a helpful prefix if this shell appears to be exotic case ${SHELL##*/} in (bash) ;; (*) PS1=bash:$PS1 ;; esac + # Add sub-commands: + ## Preload libraries as prefix + PS1='$(prompt preload)'$PS1 + ## VCS, job, and return status checks as suffixes + PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' + # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -92,6 +95,21 @@ prompt() { fi ;; + # Analyze LD_PRELOAD to see if we should report anything loaded + preload) + printf '%s:' "$LD_PRELOAD" | + while read -d : -r ; do + case $REPLY in + (*/libip2unix.so) + printf '[IP2Unix]' + ;; + (*/libtorsocks.so) + printf '[Tor]' + ;; + esac + done + ;; + # Git prompt function git) diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh index 64e22e8e..efc5c4e3 100644 --- a/ksh/kshrc.d/prompt.ksh +++ b/ksh/kshrc.d/prompt.ksh @@ -18,10 +18,6 @@ function prompt { PS1=$PS1'${HOSTNAME%%.*}:' fi - # Add sub-commands; working directory with ~ abbreviation, VCS, job - # count, and previous command return value - PS1=$PS1'$(ret=$?;jobc=$(jobs -p|sed -n '\''$='\'');prompt pwd;prompt vcs;prompt job;prompt ret;:)' - # Add a helpful prefix if this shell appears to be exotic typeset ksh case $KSH_VERSION in @@ -34,6 +30,12 @@ function prompt { (*) PS1=$ksh:$PS1 ;; esac + # Add sub-commands: + ## Preload libraries as prefix + PS1='$(prompt preload)'$PS1 + ## VCS, job, and return status checks as suffixes + PS1=$PS1'$(ret=$?;jobc=$(jobs -p|sed -n '\''$='\'');prompt pwd;prompt vcs;prompt job;prompt ret;:)' + # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -206,6 +208,21 @@ function prompt { fi ;; + # Analyze LD_PRELOAD to see if we should report anything loaded + preload) + printf '%s:' "$LD_PRELOAD" | + while read -d : -r ; do + case $REPLY in + (*/libip2unix.so) + printf '[IP2Unix]' + ;; + (*/libtorsocks.so) + printf '[Tor]' + ;; + esac + done + ;; + # Abbreviated working directory pwd) case $PWD in diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh index 980d8669..317aba56 100644 --- a/zsh/zshrc.d/prompt.zsh +++ b/zsh/zshrc.d/prompt.zsh @@ -15,15 +15,18 @@ prompt() { fi PS1=$PS1'%~' - # Add sub-commands; VCS, job, and return status checks - PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' - # Add a helpful prefix if this shell appears to be exotic case ${SHELL##*/} in (zsh) ;; (*) PS1=zsh:$PS1 ;; esac + # Add sub-commands: + ## Preload libraries as prefix + PS1='$(prompt preload)'$PS1 + ## VCS, job, and return status checks as suffixes + PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' + # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -53,7 +56,21 @@ prompt() { fi ;; - # Git prompt function + # Analyze LD_PRELOAD to see if we should report anything loaded + preload) + printf '%s:' "$LD_PRELOAD" | + while read -d : -r ; do + case $REPLY in + (*/libip2unix.so) + printf '[IP2Unix]' + ;; + (*/libtorsocks.so) + printf '[Tor]' + ;; + esac + done + ;; + git) # Wrap as compound command; we don't want to see output from any of |