Add some more functions
This commit is contained in:
parent
e9f88bbb50
commit
f0b22fd14d
|
@ -36,6 +36,7 @@ DESCRIPTION_COLOR="${DESCRIPTION_COLOR:-#999888}"
|
||||||
DMENU_COMPAT="${DMENU_COMPAT:-false}"
|
DMENU_COMPAT="${DMENU_COMPAT:-false}"
|
||||||
AUTOREFRESH="${AUTOREFRESH:-true}"
|
AUTOREFRESH="${AUTOREFRESH:-true}"
|
||||||
MULTISELECT="${MULTISELECT:-true}"
|
MULTISELECT="${MULTISELECT:-true}"
|
||||||
|
PRINT_LOGS_STDERR="${PRINT_LOGS_STDERR:-true}"
|
||||||
|
|
||||||
DESKTOP_DIR="${DESKTOP_DIR:-${DESTDIR}${PREFIX}/share/applications ${HOME}/.local/share/applications}"
|
DESKTOP_DIR="${DESKTOP_DIR:-${DESTDIR}${PREFIX}/share/applications ${HOME}/.local/share/applications}"
|
||||||
ICON_DIR="${ICON_DIR:-${DESTDIR}${PREFIX}/share/icons/hicolor ${HOME}/.local/share/icons/hicolor ${DESTDIR}${PREFIX}/share/pixmaps}"
|
ICON_DIR="${ICON_DIR:-${DESTDIR}${PREFIX}/share/icons/hicolor ${HOME}/.local/share/icons/hicolor ${DESTDIR}${PREFIX}/share/pixmaps}"
|
||||||
|
@ -186,10 +187,12 @@ print_config() {
|
||||||
# This is the configuration file for the run launcher spmenu comes with.
|
# This is the configuration file for the run launcher spmenu comes with.
|
||||||
# It is not the configuration file for spmenu, see ~/.config/spmenu/spmenu.conf for that.
|
# It is not the configuration file for spmenu, see ~/.config/spmenu/spmenu.conf for that.
|
||||||
#
|
#
|
||||||
# spmenu_run also runs these functions:
|
# spmenu_run also runs these functions if found in the config file:
|
||||||
#
|
#
|
||||||
# 'run_pre_func' before spawning spmenu.
|
# 'run_pre_func' before spawning spmenu.
|
||||||
# 'run_post_func' after spawning spmenu, selected item passed as an argument.
|
# 'run_post_func' after spawning spmenu, selected item passed as an argument.
|
||||||
|
# 'run_single_char_func' while checking the value of a single character. The first character of the spmenu output is passed as an argument.
|
||||||
|
# 'run_output_func' while checking the value of the spmenu output. spmenu output is passed as an argument.
|
||||||
# 'desktop_pre_func' before spawning spmenu.
|
# 'desktop_pre_func' before spawning spmenu.
|
||||||
# 'desktop_post_func' after spawning spmenu, selected item passed as an argument.
|
# 'desktop_post_func' after spawning spmenu, selected item passed as an argument.
|
||||||
# 'desktop_pre_caching_func' before caching entries.
|
# 'desktop_pre_caching_func' before caching entries.
|
||||||
|
@ -261,6 +264,7 @@ IMAGE="true" # Display images (true/false)
|
||||||
DISPLAY_DESCRIPTION="true" # Display description (true/false)"
|
DISPLAY_DESCRIPTION="true" # Display description (true/false)"
|
||||||
DESCRIPTION_COLOR="#999888" # Description text color
|
DESCRIPTION_COLOR="#999888" # Description text color
|
||||||
LOGFILE="/tmp/spmenu_run.log" # Log file
|
LOGFILE="/tmp/spmenu_run.log" # Log file
|
||||||
|
PRINT_LOGS_STDERR="true" # Print information (such as logs) to stderr (true/false)
|
||||||
TITLEFILE="\${TITLEFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.title}" # File containing the different titles to display.
|
TITLEFILE="\${TITLEFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.title}" # File containing the different titles to display.
|
||||||
DESCFILE="\${DESCFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.desc}" # File containing the description to display
|
DESCFILE="\${DESCFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.desc}" # File containing the description to display
|
||||||
EXECFILE="\${EXECFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.exec}" # File containing the different executables to run.
|
EXECFILE="\${EXECFILE:-\${XDG_CACHE_HOME:-\$HOME/.cache}/.exec}" # File containing the different executables to run.
|
||||||
|
@ -286,6 +290,9 @@ parse() {
|
||||||
path | sed "s/\&/\&/g" | $RUNLAUNCHER "${rl_run[@]}" > /tmp/spmenu_out
|
path | sed "s/\&/\&/g" | $RUNLAUNCHER "${rl_run[@]}" > /tmp/spmenu_out
|
||||||
|
|
||||||
while read -r sout; do
|
while read -r sout; do
|
||||||
|
command -v run_single_char_func > /dev/null && run_single_char_func "${sout:0:1}"
|
||||||
|
command -v run_output_func > /dev/null && run_output_func "${sout}"
|
||||||
|
|
||||||
# parse
|
# parse
|
||||||
case "${sout:0:1}" in
|
case "${sout:0:1}" in
|
||||||
"#") EXEC="term" ;;
|
"#") EXEC="term" ;;
|
||||||
|
@ -519,7 +526,9 @@ print_desktop_list() {
|
||||||
# print data from entries
|
# print data from entries
|
||||||
if [ "$cfiles" = "false" ]; then
|
if [ "$cfiles" = "false" ]; then
|
||||||
command -v desktop_pre_caching_func > /dev/null && desktop_pre_caching_func
|
command -v desktop_pre_caching_func > /dev/null && desktop_pre_caching_func
|
||||||
printf "Writing cache files because none exist.\nTitle file: '%s'\nDescription file: '%s'\nIcon file: '%s'\nExec file: '%s'\nFile file: '%s'\nTerm file: '%s'\n" "$TITLEFILE" "$DESCFILE" "$ICONFILE" "$EXECFILE" "$FILEFILE" "$TERMFILE" >> "$LOGFILE" && tail -n 1 "$LOGFILE"
|
printf "Writing cache files because none exist.\nTitle file: '%s'\nDescription file: '%s'\nIcon file: '%s'\nExec file: '%s'\nFile file: '%s'\nTerm file: '%s'\n" "$TITLEFILE" "$DESCFILE" "$ICONFILE" "$EXECFILE" "$FILEFILE" "$TERMFILE" >> "$LOGFILE"
|
||||||
|
|
||||||
|
[ "$PRINT_LOGS_STDERR" = "true" ] && printf "spmenu_run: Updating .desktop entries.\n" >> /dev/stderr
|
||||||
|
|
||||||
icons="$(find "${icondir[@]}" -type f)"
|
icons="$(find "${icondir[@]}" -type f)"
|
||||||
[ -z "$entry" ] && entry="$(find "${desktopdir[@]}" -type f -name '*.desktop')"
|
[ -z "$entry" ] && entry="$(find "${desktopdir[@]}" -type f -name '*.desktop')"
|
||||||
|
|
Loading…
Reference in a new issue