Skip to content
Snippets Groups Projects
Commit aba08d75 authored by JennaHuntsman's avatar JennaHuntsman
Browse files

Change register_secondlifeprotocol.sh to fix bug and use XDG to install desktop file

parent 8d929f5b
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ chmod +x "$desired_handler" ...@@ -24,7 +24,7 @@ chmod +x "$desired_handler"
if command -v xdg-mime query default x-scheme-handler/secondlife >/dev/null 2>&1; then if command -v xdg-mime query default x-scheme-handler/secondlife >/dev/null 2>&1; then
urlhandler=$(xdg-mime query default x-scheme-handler/secondlife) urlhandler=$(xdg-mime query default x-scheme-handler/secondlife)
localappdir="${HOME}/.local/share/applications" localappdir="${HOME}/.local/share/applications"
newhandler="secondlifeprotocol_$(basename "$(dirname "${desired_handler}")").desktop" newhandler="secondlifeprotocol_$(basename "${PWD%}").desktop"
handlerpath="${localappdir}/${newhandler}" handlerpath="${localappdir}/${newhandler}"
cat >"${handlerpath}" <<EOFnew || print "Warning: Did not register secondlife:// handler with xdg-mime: Could not write $newhandler"s cat >"${handlerpath}" <<EOFnew || print "Warning: Did not register secondlife:// handler with xdg-mime: Could not write $newhandler"s
[Desktop Entry] [Desktop Entry]
...@@ -49,7 +49,8 @@ EOFnew ...@@ -49,7 +49,8 @@ EOFnew
#Clean up handlers from other viewers #Clean up handlers from other viewers
if [ "${urlhandler}" != "${newhandler}" ]; then if [ "${urlhandler}" != "${newhandler}" ]; then
print "Current SLURL Handler: ${urlhandler} - Setting ${newhandler} as the new default..." print "Current SLURL Handler: ${urlhandler} - Setting ${newhandler} as the new default..."
mv "${localappdir}"/"${urlhandler}" "${localappdir}"/"${urlhandler}".bak #mv "${localappdir}"/"${urlhandler}" "${localappdir}"/"${urlhandler}".bak #Old method, now replaced with XDG.
xdg-desktop-menu install --novendor "${localappdir}"/"$urlhandler"
else else
print "SLURL Handler has not changed, leaving as-is." print "SLURL Handler has not changed, leaving as-is."
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment