Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alchemy/viewer
  • Miezhiko/alchemy-next
  • JennaHuntsman/xdg-integration
  • logue/alchemy-next
  • FelixWolf/alchemy-viewer
  • XenHat/xdg-integration
6 results
Show changes
Commits on Source (34)
......@@ -1559,6 +1559,12 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt"
"${VIEWER_SHORT_VERSION}\n")
configure_file(llviewerbuildconfig.h.in llviewerbuildconfig.h @ONLY)
if (LINUX)
#Use cmake to generate a new copy of this file when filling channel info, append suffix so viewer_manifest.py will pick the new copy
configure_file(./linux_tools/refresh_desktop_app_entry.sh ./refresh_desktop_app_entry-cmake.sh @ONLY)
endif(LINUX)
LIST(APPEND viewer_HEADER_FILES ${CMAKE_CURRENT_BINARY_DIR}/llviewerbuildconfig.h)
if (WINDOWS)
......
......@@ -58,8 +58,7 @@ function homedir_install()
exit 0
fi
install_to_prefix "$HOME/.local/share/alchemy-install"
$HOME/.local/share/alchemy-install/etc/refresh_desktop_app_entry.sh
install_to_prefix "$XDG_DATA_HOME/alchemy-install" #$XDG_DATA_HOME is a synonym for $HOME/.local/share/ unless the user has specified otherwise (unlikely).
}
function root_install()
......@@ -77,7 +76,6 @@ function root_install()
install_to_prefix "$install_prefix"
mkdir -p /usr/local/share/applications
${install_prefix}/etc/refresh_desktop_app_entry.sh
}
function install_to_prefix()
......@@ -124,6 +122,8 @@ function install_to_prefix()
rm "$1/bin/llplugin/.user_does_not_want_chrome_sandboxing_and_accepts_the_risks" 2> /dev/null
pkexec "$1/etc/chrome_sandboxing_permissions_setup.sh" || die "Failed to set permissions on chrome-sandbox"
fi
sh "$1/etc/refresh_desktop_app_entry.sh" || echo "Failed to integrate into DE via XDG."
set_slurl_handler "$1"
}
function backup_previous_installation()
......@@ -134,6 +134,16 @@ function backup_previous_installation()
mv "$1" "$backup_dir" || die "Failed to create backup of existing installation!"
}
function set_slurl_handler()
{
local install_dir=$1
prompt "Would you like to set Alchemy as your default SLurl handler? [Y/N]: "
if [[ $? == 0 ]]; then
exit 0
fi
"$install_dir"/etc/register_secondlifeprotocol.sh #Successful association comes with a notification to the user.
}
if [ "$UID" == "0" ]; then
root_install
......
#!/bin/bash
VIEWERNAME="@VIEWER_CHANNEL_BASE@" #This should be the viewer's canonical base name, e.g. Second Life, Firestorm, Alchemy, etc. Handled by cmake.
CHANNELNAME="@VIEWER_CHANNEL_TYPE@ @VIEWER_PROJECT_CODENAME@" #Use cmake to autofill the channel type (alpha, beta, release), and any project codename.
CHANNELNOBREAK=$(echo $CHANNELNAME | tr " " "-") #Store a version of the channel name without any spaces to prevent breakage with some functions. Not filled by cmake to ensure consistency in it's output.
SCRIPTSRC="$(readlink -f "$0" || echo "$0")"
RUN_PATH="$(dirname "${SCRIPTSRC}" || echo .)"
install_prefix="${RUN_PATH}"/..
install_prefix=$(builtin cd "${RUN_PATH}/.." || exit; pwd) #This is a cleaner way of getting the absolute path for the install directory.
function print() {
log_prefix="${VIEWERNAME} ${CHANNELNAME} Desktop Integration:"
echo -e "${log_prefix} $*"
}
function install_desktop_entry()
{
local installation_prefix="${1}"
local desktop_entries_dir="${2}"
local desktop_entry="\
[Desktop Entry]\n\
Name=Alchemy\n\
Comment=Client for the On-line Virtual World, Second Life\n\
Exec=${installation_prefix}/alchemy\n\
Icon=${installation_prefix}/alchemy_icon.png\n\
Terminal=false\n\
Type=Application\n\
Categories=Game;Simulation;\n\
StartupNotify=true\n\
StartupWMClass=Alchemy\n\
X-Desktop-File-Install-Version=3.0"
echo " - Installing menu entries in ${desktop_entries_dir}"
mkdir -vp "${desktop_entries_dir}"
echo -e "${desktop_entry}" > "${desktop_entries_dir}/alchemy-viewer.desktop" || "Failed to install application menu!"
desktoppath="${installation_prefix}/${VIEWERNAME,,}-${CHANNELNAME}-viewer.desktop"
cat >"${desktoppath}" <<desktopfile || print "Warning: Could not write $desktoppath"s
[Desktop Entry]
Version=1.4
Name=${VIEWERNAME} ${CHANNELNAME}
GenericName=Second Life Viewer
Comment=Client for the Online Virtual World, Second Life
Exec=${installation_prefix}/${VIEWERNAME,,}
Icon=${VIEWERNAME}-${CHANNELNOBREAK}-Viewer
Terminal=false
Type=Application
Categories=Game;Simulation;
StartupNotify=true
StartupWMClass=${VIEWERNAME} ${CHANNELNAME}
PrefersNonDefaultGPU=true
Actions=DefaultGPU;AssociateMIME;
[Desktop Action DefaultGPU]
Exec=${installation_prefix}/${VIEWERNAME,,}
Name=Launch on default GPU
Comment=Launch the viewer using the system's integrated GPU, instead of the dedicated one. (if available)
PrefersNonDefaultGPU=false
[Desktop Action AssociateMIME]
Exec=${installation_prefix}/etc/register_secondlifeprotocol.sh
Name=Associate SLURLs
Comment=Set this viewer as the default handler for secondlife:// links.
desktopfile
#The above adds some options when the shortcut is right-clicked, to launch on the default (usually integrated) GPU, and to force MIME type association.
#The "PrefersNonDefaultGPU" line should automatically run the viewer on the most powerful GPU in the system, if it is not default. If it is, this is ignored.
# NOTE: DO NOT CHANGE THE "GenericName" FIELD - ONLY CHANGE THE "Name" FIELD. (This is to ensure that searching "Second Life" will show all the viewers installed in a user's system, regardless of their canonical name.)
print "Installing menu entries via XDG..."
xdg-icon-resource install --novendor --size 256 "${install_prefix}/${VIEWERNAME,,}_icon.png" "${VIEWERNAME}"-"${CHANNELNOBREAK}"-Viewer
#NOTE: Above command takes the path to the icon to install && The name of the icon to be used by XDG. This should always be in the format of "x-Viewer" to avoid potential naming conflicts, as per XDG spec.
xdg-desktop-menu install --novendor "${installation_prefix}"/"${VIEWERNAME,,}"-"${CHANNELNOBREAK}"-viewer.desktop
}
CHANNELNAME=$(echo "${CHANNELNAME}" | xargs) #Trim leading and / or tailing whitespace from CHANNELNAME
if [ "$UID" == "0" ]; then
# system-wide
install_desktop_entry "${install_prefix}" /usr/local/share/applications
......
......@@ -24,7 +24,7 @@ chmod +x "$desired_handler"
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)
localappdir="${HOME}/.local/share/applications"
newhandler="secondlifeprotocol_$(basename "$(dirname "${desired_handler}")").desktop"
newhandler="secondlifeprotocol_$(basename "${PWD%}").desktop"
handlerpath="${localappdir}/${newhandler}"
cat >"${handlerpath}" <<EOFnew || print "Warning: Did not register secondlife:// handler with xdg-mime: Could not write $newhandler"s
[Desktop Entry]
......@@ -49,7 +49,8 @@ EOFnew
#Clean up handlers from other viewers
if [ "${urlhandler}" != "${newhandler}" ]; then
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
print "SLURL Handler has not changed, leaving as-is."
fi
......@@ -75,3 +76,4 @@ else
fi
fi
fi
notify-send -t 5000 -i info "Second Life URL Handler" "SLURL association created"
......@@ -82,10 +82,12 @@ echo "Running from ${RUN_PATH}"
cd "${RUN_PATH}"
# Re-register the secondlife:// protocol handler every launch, for now.
./etc/register_secondlifeprotocol.sh
# NOTE: this should no longer be required with the new desktop shortcut, combined with XDG integration.
#./etc/register_secondlifeprotocol.sh
# Re-register the application with the desktop system every launch, for now.
./etc/refresh_desktop_app_entry.sh
# NOTE: this should no longer be required with XDG integration. App icon should be created at install time, not run time.
#./etc/refresh_desktop_app_entry.sh
## Before we mess with LD_LIBRARY_PATH, save the old one to restore for
## subprocesses that care.
......
......@@ -1068,7 +1068,7 @@ def construct(self):
with self.prefix(dst="etc"):
self.path("handle_secondlifeprotocol.sh")
self.path("register_secondlifeprotocol.sh")
self.path("refresh_desktop_app_entry.sh")
self.path("refresh_desktop_app_entry-cmake.sh","refresh_desktop_app_entry.sh") #XDG Integration: cmake output is set to a new file, so use -cmake suffix to copy post-cmake version.
self.path("chrome_sandboxing_permissions_setup.sh")
self.path("install.sh")
......