Add the snap path to XDG_DATA_DIRS instead of reading all of profile

This commit is contained in:
Anthony Rose 2020-11-21 17:37:58 +00:00
parent 5280e2998e
commit ca4b8ade07

View file

@ -1,9 +1,5 @@
#!/bin/sh
if [ "$ZSH_VERSION" ]; then
emulate sh -c 'source /etc/profile'
fi
PATH="/usr/sbin:/sbin:/usr/bin:/bin"
for dir in $HOME/bin \
$HOME/.cargo/bin \
@ -224,6 +220,14 @@ alias prunx="podman run --security-opt label=disable -v /tmp/.X11-unix/:/tmp/.X1
alias drun="sudo docker run --rm -it"
alias drunx="sudo docker run -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=\"unix\$DISPLAY\""
# Desktop files (used by desktop environments within both X11 and Wayland) are
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for
# snappy applications' desktop files.
snap_xdg_path="/var/lib/snapd/desktop"
if [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}}" ] && [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}:*}" ]; then
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${snap_xdg_path}"
fi
mkcd () {
if [ $# -ne 1 ]; then
echo "mkcd: incorrect arguments (one directory required)." >&2