dot

packages and services management
Log | Files | Refs | README

commit d727cf75f97cf7c219679f6b6716e2f4dc4042c0
parent 4c10924b32c824f898e4115ea5c2e7ba4742cd65
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed,  7 Mar 2018 15:14:20 +0100

recursive xdg-open

Diffstat:
M.bashrc | 1-
M.profile | 1+
Mbin/io | 12++++++------
Mbin/xdg-open | 12++++++++++--
4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -1,5 +1,4 @@ . ./.profile -export TERM=screen PS1='\[\033[31;1m\]$([ $? -gt 0 ] && printf "x\\n ")\033[m\] \[\033]0;$PWD\a\]\h\$ ' diff --git a/.profile b/.profile @@ -50,6 +50,7 @@ export SSH_AUTH_SOCK="/tmp/ssh-agent" export SVDIR="$HOME/var/runit" +export TERM="screen" export PS1='$([ $? -gt 0 ] && printf "\\033[31;1mx\\033[m\\n\\r")'"$( [ "$(whoami)" = "root" ] && s='#' || s='$' printf '\033]0;$PWD\a\n%s%s ' "$(uname -n)" "$s")" diff --git a/bin/io b/bin/io @@ -7,10 +7,12 @@ export LC_COLLATE='C' cache="$HOME/.cache/find" mkdir -p "$cache" -case "$PWD" in ("$HOME"/*) - dir=$(printf %s "${PWD##$HOME/}" | sed 's|/.*||') - find "$HOME/$dir" '(' -name .git -o -name CVS ')' -prune -o -print | - sort > "$cache/$dir" +case "$PWD" in +("$HOME"/*) + dir="$(printf %s "${PWD##$HOME/}" | sed 's:/.*::')" + find "$HOME/$dir" \( -name .git -o -name CVS \) -prune -o -print | + sort > "$cache/$dir" + ;; esac exec xdg-open "$(find "$HOME" -maxdepth 1 -mindepth 1 | @@ -21,5 +23,3 @@ exec xdg-open "$(find "$HOME" -maxdepth 1 -mindepth 1 | cat - "$HOME/etc/uri" | iomenu -# | cut -f 2-)" - - diff --git a/bin/xdg-open b/bin/xdg-open @@ -2,6 +2,9 @@ # override the xdg-open utility +[ -e "$1" ] && set -- "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" +printf '\033]0;%s\a' "${1%/.}" + # [scheme://][user[:pass]@]host[:port][/path] IFS=' ' read scheme user pass host port path << EOF $(awk -v URI="$1" ' @@ -271,7 +274,12 @@ case "$1" in exec ar vx "$1" ;; (*) - [ -d "$1" ] && exec io grep "$1" - [ -f "$1" ] && exec $EDITOR "$1" + if [ -d "$1" ] + then + exec "$0" "$(find "$1" | iomenu)" + elif [ -f "$1" ] + then + exec $EDITOR "$1" + fi ;; esac