Add snap desktop files support (dmenu_drun)

This commit is contained in:
q3aql 2022-07-29 16:37:33 +02:00
parent 6f0773d3bb
commit 2c85908953

View File

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