sped up wv significantly
This commit is contained in:
parent
04e37d98fb
commit
7bc2aeb23d
@ -6,29 +6,31 @@ shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )"
|
|||||||
document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/*"
|
document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/*"
|
||||||
#force launch dmenu via cmd
|
#force launch dmenu via cmd
|
||||||
if [ "$1" = "launchdmenu" ]; then
|
if [ "$1" = "launchdmenu" ]; then
|
||||||
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}'| dmenu -l 10 -p 'open what file?')"
|
file="$( find $document_dirs -type f | sed "s|$HOME|~|"| dmenu -l 10 -p 'open what file?')"
|
||||||
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
||||||
elif [ ! "$shell" = "/bin/sh" ]; then
|
elif [ ! "$shell" = "/bin/sh" ]; then
|
||||||
currentdir="$(pwd)"
|
currentdir="$(pwd)"
|
||||||
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}' | fzf -e --query="$*")"
|
file="$( find $document_dirs -type f | sed "s|$HOME|~|" | fzf -e --query="$*")"
|
||||||
|
path="$(printf '%s%s' "$HOME" "${file//\~/}")"
|
||||||
[ -z "$file" ] && exit
|
[ -z "$file" ] && exit
|
||||||
cd "$( dirname "$file" )" || exit
|
cd "$( dirname "$path" )" || exit
|
||||||
if rifle -l "$file" | head -n1 | grep -q 'EDITOR';then
|
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then
|
||||||
rifle "$file"
|
rifle "$path"
|
||||||
else
|
else
|
||||||
rifle "$file" & disown
|
rifle "$path" & disown
|
||||||
fi
|
fi
|
||||||
cd "$currentdir" || exit
|
cd "$currentdir" || exit
|
||||||
exit
|
exit
|
||||||
#launch dmenu as it's probably in dmenu_run
|
#launch dmenu as it's probably in dmenu_run
|
||||||
else
|
else
|
||||||
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}'| dmenu -l 10 -p 'open what file?' -it "$*" )"
|
file="$( find $document_dirs -type f | sed "s|$HOME|~|" | dmenu -l 10 -p 'open what file?' -it "$*" )"
|
||||||
fi
|
fi
|
||||||
#process selection if it's from dmenu
|
#process selection if it's from dmenu
|
||||||
[ -z "$file" ] && exit
|
[ -z "$file" ] && exit
|
||||||
cd "$( dirname "$file" )" || exit
|
path="$(printf '%s%s' "$HOME" "${file//\~/}")"
|
||||||
if rifle -l "$file" | head -n1 | grep -q 'EDITOR';then
|
cd "$( dirname "$path" )" || exit
|
||||||
st rifle "$file"
|
if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then
|
||||||
|
st rifle "$path"
|
||||||
else
|
else
|
||||||
rifle "$file"
|
rifle "$path"
|
||||||
fi
|
fi
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
alldata="/tmp/allfiles$$"
|
|
||||||
videos="/tmp/videos$$"
|
videos="/tmp/videos$$"
|
||||||
du -a ~/vids/* --time | awk '!($1="")' | sort -bgr | awk '!($1="")' | awk '!($1="")' | sed 's/^ //' > $alldata
|
du -a ~/vids/* --time | awk '!($1="")' | sort -bgr -k1 | awk '!($1="")' | awk '!($1="")' | sed 's/^ //' | grep -v "$(find ~/vids/* -type d | sed 's/$/\$/; s/\[/\\[/g; s/\]/\\]/g')" | sed "s|$HOME|\~|" > $videos
|
||||||
touch $videos
|
path="$(dmenu -i -l 30 -p "Choose a video to watch:" <"$videos" | sed "s|\~|$HOME|")"
|
||||||
while read -r line; do
|
[ -n "$path" ] && rifle "$path"
|
||||||
[ -f "$line" ] && echo "$line" >> $videos
|
|
||||||
done <$alldata
|
|
||||||
dmenu -i -l 30 -p "Choose a video to watch:" <"$videos" | sed 's/^/\"/' | sed 's/$/\"/' | xargs -r rifle
|
|
||||||
rm "$alldata"
|
|
||||||
rm "$videos"
|
rm "$videos"
|
||||||
|
Loading…
Reference in New Issue
Block a user