Skip to content

Instantly share code, notes, and snippets.

@TheLie0
Created August 25, 2019 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheLie0/c1f559c5753ebd892247a318967b3a33 to your computer and use it in GitHub Desktop.
Save TheLie0/c1f559c5753ebd892247a318967b3a33 to your computer and use it in GitHub Desktop.
diff ../dmenu_og/dmenu_run ./dmenu_run
2c2,24
< dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &
---
>
> # This script is meant to replace the standard dmenu_run.
> # It searches $path for executable scripts and puts them in a dmenu.
> # It is intended to be used as a hub for different submenus.
>
> path=~/.submenus
>
> # Gets submenu scripts
> get_menu() {
> stest -flx "$path" | dmenu "$@"
> }
>
> # Check if path exists and contains files
> if [ ! -d $path ]; then
> echo "The directory $path does not exist. Please create it to use subdirectories."
> exit 0
> fi
> if [ -z "$(stest -flx $path)" ]; then
> echo "There are no submenus in $path yet. Maybe copy over the original dmenu_run?"
> exit 0
> fi
>
> exec "$path/$(get_menu)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment