add scripts
parent
4c62673bf6
commit
05f7e2109c
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/sh
|
||||||
|
#
|
||||||
|
# fuzzel_find_file.sh
|
||||||
|
#
|
||||||
|
# Search for file and open it. Requires fuzzel and find.
|
||||||
|
|
||||||
|
pattern=$(fuzzel --dmenu --prompt "$ find . -type f ") || exit
|
||||||
|
selection=$(find . -type f -iname "$pattern" | fuzzel --dmenu --prompt "$ open ")
|
||||||
|
|
||||||
|
if [ -n "$selection" ]; then
|
||||||
|
exec open "$selection"
|
||||||
|
fi
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/sh
|
||||||
|
#
|
||||||
|
# fuzzel_mount.sh
|
||||||
|
#
|
||||||
|
# Mount devices. Requires fuzzel and udisksctl.
|
||||||
|
|
||||||
|
LSBLK_PART_TYPE="part"
|
||||||
|
LSBLK_LIST=$(lsblk -Ppo name,type,mountpoint)
|
||||||
|
|
||||||
|
while read -r line; do
|
||||||
|
while read -r keyval; do
|
||||||
|
eval "$keyval"
|
||||||
|
done <<- EOF
|
||||||
|
$line
|
||||||
|
EOF
|
||||||
|
|
||||||
|
expr "$NAME" : "/dev/sda." && continue
|
||||||
|
[ "$TYPE" = "$LSBLK_PART_TYPE" ] || continue
|
||||||
|
|
||||||
|
if [ -n "$MOUNTPOINT" ]; then
|
||||||
|
option_list=$(printf %s%s\\n "$option_list" "udisksctl unmount -b $NAME")
|
||||||
|
else
|
||||||
|
option_list=$(printf %s%s\\n "$option_list" "udisksctl mount -b $NAME")
|
||||||
|
fi
|
||||||
|
|
||||||
|
done <<- EOF
|
||||||
|
$LSBLK_LIST
|
||||||
|
EOF
|
||||||
|
|
||||||
|
selection=$(printf %s "$option_list" | fuzzel --dmenu --prompt "$ ")
|
||||||
|
|
||||||
|
if [ -n "$selection" ]; then
|
||||||
|
# TODO: notification and error reporting
|
||||||
|
exec $selection
|
||||||
|
fi
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/sh
|
||||||
|
#
|
||||||
|
# fuzzel_open_file.sh DIR
|
||||||
|
#
|
||||||
|
# Open file or terminal in current directory. Requires fuzzel and
|
||||||
|
# xdg-open.
|
||||||
|
|
||||||
|
DIR=${1:-$HOME}
|
||||||
|
cd "$DIR" || exit 1
|
||||||
|
DIR="$(pwd)"
|
||||||
|
|
||||||
|
selection=$(ls --group-directories-first -a1v | fuzzel --dmenu --prompt "$ open $DIR/")
|
||||||
|
|
||||||
|
if [ -n "$selection" ]; then
|
||||||
|
if [ "$selection" = "." ]; then
|
||||||
|
exec $TERMINAL -D "$DIR"
|
||||||
|
elif [ -d "$DIR/$selection" ]; then
|
||||||
|
exec $0 "$DIR/$selection"
|
||||||
|
elif [ -f "$DIR/$selection" ]; then
|
||||||
|
exec open "$DIR/$selection"
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Reference in New Issue