#!/bin/sh # speedwm-pdfopen # list of pdfs for the user to open in dmenu. cd $1 case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu ;; esac HAVE_GRID="true" if [ -e "$HOME/.config/speedwm-de/global/config" ]; then . $HOME/.config/speedwm-de/global/config else mkdir -p $HOME/.config/speedwm-de/global printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config fi if [ "$HAVE_GRID" = "true" ]; then GRIDNUM="1" fi if [ "$HAVE_GRID" = "true" ]; then GRIDARG="-g" fi SELPDF=$(ls -Ap1 *.pdf | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 50 -p "What PDF do you want to open?") case "$SELPDF" in "") exit 0 ;; esac $2 "$1/$SELPDF"