Support for FlatPak desktop files (dmenu_drun)

This commit is contained in:
q3aql 2022-07-20 01:16:20 +02:00
parent be994eeada
commit 1b62ed5ce3

View File

@ -14,6 +14,7 @@ load_theme_file="${load_theme_path}/load_theme"
load_desktop_files="${HOME}/.dmenu/desktop" load_desktop_files="${HOME}/.dmenu/desktop"
desktop_files="/usr/share/applications" desktop_files="/usr/share/applications"
desktop_files_home="${HOME}/.local/share/applications" desktop_files_home="${HOME}/.local/share/applications"
desktop_files_flatpak="/var/lib/flatpak/exports/share/applications"
function load_theme() { function load_theme() {
if [ -f "${load_theme_file}" ] ; then if [ -f "${load_theme_file}" ] ; then
@ -38,6 +39,9 @@ function list_desktop_files() {
if [ -d "${desktop_files_home}" ] ; then if [ -d "${desktop_files_home}" ] ; then
ls -1 "${desktop_files_home}/" | grep ".desktop" ls -1 "${desktop_files_home}/" | grep ".desktop"
fi fi
if [ -d "${desktop_files_flatpak}" ] ; then
ls -1 "${desktop_files_flatpak}/" | grep ".desktop"
fi
} }
function list_desktop_icons() { function list_desktop_icons() {
@ -80,6 +84,12 @@ function create_list_files() {
echo "${desktop_files_home}/${current_file}" > "${load_desktop_files}/${name_show}" echo "${desktop_files_home}/${current_file}" > "${load_desktop_files}/${name_show}"
fi fi
fi fi
if [ -f "${desktop_files_flatpak}/${current_file}" ] ; then
name_show=$(cat "${desktop_files_flatpak}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g')
if [ ! -z "${name_show}" ] ; then
echo "${desktop_files_flatpak}/${current_file}" > "${load_desktop_files}/${name_show}"
fi
fi
done done
echo "1" > ${HOME}/.dmenu/read_list echo "1" > ${HOME}/.dmenu/read_list
fi fi