62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
|
#!/bin/sh
|
||
|
# speedwm-applist
|
||
|
# list extra applications
|
||
|
|
||
|
# rl
|
||
|
case "$RUNLAUNCHER" in
|
||
|
"") RUNLAUNCHER=dmenu ;;
|
||
|
esac
|
||
|
|
||
|
# assume we have grid as default
|
||
|
HAVE_GRID="true"
|
||
|
|
||
|
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
|
||
|
. $HOME/.config/speedwm-de/global/config
|
||
|
echo "Loaded configuration!"
|
||
|
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
|
||
|
|
||
|
# grid number is one
|
||
|
if [ "$HAVE_GRID" = "true" ]; then
|
||
|
GRIDNUM="1"
|
||
|
fi
|
||
|
|
||
|
# grid argument
|
||
|
if [ "$HAVE_GRID" = "true" ]; then
|
||
|
GRIDARG="-g"
|
||
|
fi
|
||
|
|
||
|
# create applist
|
||
|
MK_APPLIST() {
|
||
|
if [ -e "$HOME/.local/share/speedwm/applist" ]; then
|
||
|
USER_CMD="$(printf "$(cat $HOME/.local/share/speedwm/applist)\n------\nAdd command\n" | $RUNLAUNCHER -l 20 $GRIDARG $GRIDNUM)"
|
||
|
else
|
||
|
mkdir -p $HOME/.local/share/speedwm
|
||
|
echo "No commands added." > $HOME/.local/share/speedwm/applist
|
||
|
$0 && exit 0
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# add command
|
||
|
ADD_CMD() {
|
||
|
grep -q "No commands added" $HOME/.local/share/speedwm/applist && rm -f $HOME/.local/share/speedwm/applist
|
||
|
USER_I_ARG="$(printf "" | $RUNLAUNCHER -l 0 -p 'Enter a command: ' $GRIDARG $GRIDNUM)"
|
||
|
printf "$USER_I_ARG\n" >> $HOME/.local/share/speedwm/applist
|
||
|
$0 && exit 0
|
||
|
}
|
||
|
|
||
|
MK_APPLIST
|
||
|
|
||
|
# check user cmd
|
||
|
if [ "$USER_CMD" = "" ]; then
|
||
|
exit 0
|
||
|
else
|
||
|
if [ "$USER_CMD" = "Add command" ]; then
|
||
|
ADD_CMD
|
||
|
else
|
||
|
$USER_CMD
|
||
|
fi
|
||
|
fi
|