Skip to content

Instantly share code, notes, and snippets.

@agateau
Last active December 20, 2015 17:59
Show Gist options
  • Save agateau/6172458 to your computer and use it in GitHub Desktop.
Save agateau/6172458 to your computer and use it in GitHub Desktop.
dmenu_open, short script to browse folders and open documents
#!/bin/sh
set -e
DMENU_ARGS=" -b -nb #444 -nf #eee -sb #666"
if [ $# = 1 ] ; then
dir="$1"
else
dir=$HOME
fi
sel=$( ( echo ".." ; ls "$dir" | sort ) | dmenu $DMENU_ARGS)
if [ -d "$dir/$sel" ] ; then
exec $0 "$dir/$sel"
else
xdg-open "$dir/$sel"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment