Skip to content

Commit

Permalink
Applet CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
umutsevdi committed Aug 27, 2022
1 parent 55f1e29 commit 27318f6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions applet_cli.sh → applet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

# Set to default path if applet path is not defined
[ "$ROFI_APPLETS_PATH" = "" ] && ROFI_APPLETS_PATH=$HOME/.dotfiles/applets/
options=`ls -d $ROFI_APPLETS_PATH/*/ | sed "s#$ROFI_APPLETS_PATH##g" | tr "/" " "`
[ "$options" = "" ] && echo "error: No applet were found at $ROFI_APPLETS_PATH directory.\nEither move applets to the $ROFI_APPLETS_PATH or define \$ROFI_APPLETS_PATH at .bashrc" 1>&2
options=`ls -d ${ROFI_APPLETS_PATH}/applets/*/ | sed "s#${ROFI_APPLETS_PATH}/applets##g" | tr "/" " "`
[ "$options" = "" ] && echo -e "error: No applet were found at $ROFI_APPLETS_PATH directory.
Either move applets to the $ROFI_APPLETS_PATH or define \$ROFI_APPLETS_PATH at .bashrc" 1>&2


Help()
Expand All @@ -22,14 +23,16 @@ Help()
echo "│ -h/--help Prints this menu. │"
echo "│ -r/--run \$app Runs selected applet │"
echo "└────────────────────────────────────────────┘"
echo " Applets:"
[ "$options" = "" ] && echo "error: No applet were found at $ROFI_APPLETS_PATH directory.\nEither move applets to the $ROFI_APPLETS_PATH or define \$ROFI_APPLETS_PATH at .bashrc" 1>&2 || " `echo $options`"
echo
echo " Available Applets:"
[ "$options" = "" ] && echo -e " error: No applet were found at $ROFI_APPLETS_PATH directory.
Either move applets to the $ROFI_APPLETS_PATH or define \$ROFI_APPLETS_PATH at .bashrc" 1>&2 \
|| echo "- `echo $options | sed 's/ /\n- /g'`"
echo
}

Run()
{
sh $ROFI_APPLETS_PATH/$app/launch.sh 2>/dev/null
sh ${ROFI_APPLETS_PATH}/applets/$app/launch.sh 2>/dev/null
}

if [[ "$#" -eq 0 ]]; then
Expand Down

0 comments on commit 27318f6

Please sign in to comment.