From 8ebf11f8bf70b2b991628c68574a805b790375d3 Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Fri, 5 Jun 2020 20:32:53 -0500 Subject: [PATCH] Add files script --- scripts/appscripts/sxmo_files.sh | 23 +++++++++++++++++++++++ scripts/core/sxmo_appmenu.sh | 1 + 2 files changed, 24 insertions(+) create mode 100755 scripts/appscripts/sxmo_files.sh diff --git a/scripts/appscripts/sxmo_files.sh b/scripts/appscripts/sxmo_files.sh new file mode 100755 index 0000000..0423443 --- /dev/null +++ b/scripts/appscripts/sxmo_files.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh +EDITOR=vis +cd /home/$USER/ + +handlefiles() { + echo "$1" | grep -iE ".(wav|webm|mp4|ogg|opus|m4a|flac|mov|avi)$" && st -e mpv "$@" && exit + echo "$1" | grep -iE ".(jpg|png|gif)$" && st -e sxiv "$@" && exit + st -e sh -ic "$EDITOR "$@"" && exit +} + +while true; do + CHOICES="$(echo -e 'Close Menu\n../\n*\n'"$(ls -1p)")" + DIR="$(basename "$(pwd)")" + PICKED="$( + echo "$CHOICES" | + dmenu -fn Terminus-18 -c -p "$DIR" -l 20 + )" + + echo "$PICKED" | grep "Close Menu" && exit 0 + [ -d "$PICKED" ] && cd "$PICKED" && continue + echo "$PICKED" | grep -E '^[*]$' && handlefiles * + [ -f "$PICKED" ] && handlefiles "$PICKED" +done diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 441b8e1..f2dec1b 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -35,6 +35,7 @@ programchoicesinit() { # Scripts menu echo $WMCLASS | grep -i "scripts" && CHOICES="$(echo " Web Search ^ 0 ^ sxmo_websearch.sh + Files ^ 0 ^ sxmo_files.sh Timer ^ 0 ^ sxmo_timer.sh Youtube ^ 0 ^ sxmo_youtube.sh video Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio