some fixes, add to TODO

This commit is contained in:
speedie 2023-05-04 20:44:16 +02:00
parent 1126bf5680
commit 8e8c359d00
3 changed files with 13 additions and 7 deletions

View file

@ -337,6 +337,7 @@ xprompt</li>
to avoid adding more external dependencies unless its a common
dependency most people already have.</li>
</ul></li>
<li>X11: Move from Xlib to libXcb</li>
</ul>
<h3
id="unlikely-but-maybe-at-some-point-in-the-distant-future">Unlikely,

View file

@ -135,6 +135,7 @@ have LibreSSL compatibility.
- Probably use some minimal public domain library for this, I'd
like to avoid adding more external dependencies unless it's a
common dependency most people already have.
- X11: Move from Xlib to libXcb
### Unlikely, but maybe at some point in the distant future

View file

@ -32,6 +32,7 @@ USE_FULL_PATH="${USE_FULL_PATH:-false}"
HELP_COLOR="${HELP_COLOR:-#FFFF00}"
DESCRIPTION_COLOR="${DESCRIPTION_COLOR:-#999888}"
DMENU_COMPAT="${DMENU_COMPAT:-false}"
AUTOREFRESH="${AUTOREFRESH:-false}"
DESKTOP_DIR="${DESKTOP_DIR:-${DESTDIR}${PREFIX}/share/applications}"
ICON_DIR="${ICON_DIR:-${DESTDIR}${PREFIX}/share/icons/hicolor ${DESTDIR}${PREFIX}/share/pixmaps}"
@ -43,7 +44,7 @@ LOGFILE="${LOGFILE:-/tmp/spmenu_run.log}"
TITLEFILE="${TITLEFILE:-${XDG_CACHE_HOME:-$HOME/.cache}/.title}"
EXECFILE="${EXECFILE:-${XDG_CACHE_HOME:-$HOME/.cache}/.exec}"
ICONFILE="${ICONFILE:-${XDG_CACHE_HOME:-$HOME/.cache}/.icon}"
DESCFILE="${DESCFILE:-${XDG_CACHE_HOME:-$HOME/.cache}.desc}"
DESCFILE="${DESCFILE:-${XDG_CACHE_HOME:-$HOME/.cache}/.desc}"
FILEFILE="${FILEFILE:-${XDG_CACHE_HOME:-$HOME/.cache}/.file}"
# arrays containing entries
@ -247,6 +248,7 @@ DESKTOP_DIR="\${DESTDIR}\${PREFIX}/share/applications" # Directories for .deskto
ICON_DIR="\${DESTDIR}\${PREFIX}/share/icons/hicolor \${DESTDIR}\${PREFIX}/share/pixmaps" # Directories for icons defined in the entries
TEMPORARY_DIR="\$CONFDIR/spmenu/run/cache" # Directory used to store cached entries
CACHE="true" # Cache entries (true/false)
AUTOREFRESH="false" # Refresh (clear) cache if there are more entries available than cached. May cause cache to be cleared every time in some cases. (true/false)
IMAGE="true" # Display images (true/false)
DISPLAY_DESCRIPTION="true" # Display description (true/false)"
DESCRIPTION_COLOR="#999888" # Description text color
@ -474,7 +476,7 @@ EOF
print_desktop_list() {
# should we use cached files?
if [ -e "$TITLEFILE" ] && [ -e "$ICONFILE" ] && [ -e "$EXECFILE" ] && [ -e "$FILEFILE" ] && [ -e "$DESCFILE" ]; then
if [ -f "$TITLEFILE" ] && [ -f "$ICONFILE" ] && [ -f "$EXECFILE" ] && [ -f "$FILEFILE" ] && [ -f "$DESCFILE" ]; then
cfiles=true
else
cfiles=false
@ -488,12 +490,10 @@ print_desktop_list() {
it_exec=()
it_file=()
# write to log file
[ "$cfiles" = "false" ] && \
printf "Writing cache files because none exist.\nTitle file: '%s'\nDescription file: '%s'\nIcon file: '%s'\nExec file: '%s'\nFile file: '%s'\n" "$TITLEFILE" "$DESCFILE" "$ICONFILE" "$EXECFILE" "$FILEFILE" >> "$LOGFILE"
# print data from entries
if [ "$cfiles" = "false" ]; then
printf "Writing cache files because none exist.\nTitle file: '%s'\nDescription file: '%s'\nIcon file: '%s'\nExec file: '%s'\nFile file: '%s'\n" "$TITLEFILE" "$DESCFILE" "$ICONFILE" "$EXECFILE" "$FILEFILE" >> "$LOGFILE"
entry_c="$(find "${desktopdir[@]}" -type f | wc -l)"
cached_c="$(find "${tmpdir[@]}" -type f | wc -l)"
cached="$(find "${tmpdir[@]}" -type f)";
@ -631,7 +631,11 @@ cache_desktop() {
printf "Cached: %s\n" "$cached_c" >> "$LOGFILE"
printf "Entries: %s\n" "$entry_c" >> "$LOGFILE"
[ "$cached_c" = "$entry_c" ] || [ "$cached_c" -gt "$entry_c" ] && return # we don't need to cache anything, it's already done
if [ "$AUTOREFRESH" = "true" ]; then
if [ "$cached_c" = "$entry_c" ] || [ "$cached_c" -gt "$entry_c" ]; then
return
fi
fi
[ -f "$TITLEFILE" ] && rm -f "$TITLEFILE"
[ -f "$ICONFILE" ] && rm -f "$ICONFILE"