dot

packages and services management
Log | Files | Refs | README

commit 6da2b63057f4ed8f2f6aefb0d9c748effdb50ed0
parent 5889d5897c4983f2818cb168708d026e0bd29106
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 26 Oct 2018 22:05:19 +0200

bin: add menu and fix protocols handlers

Diffstat:
Abin/menu/menu-open | 30++++++++++++++++++++++++++++++
Dbin/menu/menu-xdg-open | 30------------------------------
Mbin/std/menu | 2+-
Mbin/std/shortcut | 1+
Ropen/protocol/sacc -> open/protocol/gopher | 0
Mopen/protocol/http | 0
Mopen/protocol/https | 0
7 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/bin/menu/menu-open b/bin/menu/menu-open @@ -0,0 +1,30 @@ +#!/bin/sh -e +# pick a file to open with open with iomenu with caching +# +# The cache is updated when a directory is selected. + +LC_COLLATE=C + +if test -f "$HOME/.cache/find" && test $# = 0 +then exec "$0" "$HOME" +elif test $# = 0 +then exec open "$(menu <$HOME/.cache/find)" +fi + +mkdir -p "$HOME/.cache" +{ + find "$1" '(' -name .git -o -name CVS ')' -prune -o \ + -type d -exec printf '%s/\n' '{}' + -o \ + -type f -exec printf '%s\n' '{}' + | tee "$HOME/.cache/$$" + grep -vF "$1" $HOME/.cache/find +} | sort -o "$HOME/.cache/find" + +s=$(menu <$HOME/.cache/$$) + +rm "$HOME/.cache/$$" + +case $s in +('') exit 1 ;; +(*/) exec "$0" "$(cd "$s" && pwd)" ;; +(*) exec open "$s" ;; +esac diff --git a/bin/menu/menu-xdg-open b/bin/menu/menu-xdg-open @@ -1,30 +0,0 @@ -#!/bin/sh -e -# pick a file to open with xdg-open with iomenu with caching -# -# The cache is updated when a directory is selected. - -LC_COLLATE=C - -if test -f "$HOME/.cache/find" && test $# = 0 -then exec "$0" "$HOME" -elif test $# = 0 -then exec xdg-open "$(iomenu <$HOME/.cache/find)" -fi - -mkdir -p "$HOME/.cache" -{ - find "$1" '(' -name .git -o -name CVS ')' -prune -o \ - -type d -exec printf '%s/\n' '{}' + -o \ - -type f -exec printf '%s\n' '{}' + | tee "$HOME/.cache/$$" - grep -vF "$1" $HOME/.cache/find -} | sort -o "$HOME/.cache/find" - -s=$(iomenu <$HOME/.cache/$$) - -rm "$HOME/.cache/$$" - -case $s in -('') exit 1 ;; -(*/) exec "$0" "$(cd "$s" && pwd)" ;; -(*) exec xdg-open "$s" ;; -esac diff --git a/bin/std/menu b/bin/std/menu @@ -1,3 +1,3 @@ #!/bin/sh -e -test "$DISPLAY" && exec dmenu -l 40 || exec iomenu +test "$DISPLAY" && exec dmenu -fn terminus -nf '#fff' -nb '#222' -sf '#222' -sb '#fff' -l 40 || exec iomenu diff --git a/bin/std/shortcut b/bin/std/shortcut @@ -4,4 +4,5 @@ case "$1" in (u) exec menu-uri ;; (s) exec menu-session ;; (m) exec menu-mblaze ;; +(o) exec menu-open ;; esac diff --git a/open/protocol/sacc b/open/protocol/gopher diff --git a/open/protocol/http b/open/protocol/http diff --git a/open/protocol/https b/open/protocol/https