mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-02-20 03:29:03 +00:00
setup.txt: Rewrite XDG/FreeDesktop menu code
The way we've been manipulating the user's LXDE session menu is kind of not supposed to be done, and certainly it's not the right way to do it. So what I've done is make sure the correct tool for doing it system-wide is installed. It turns out we can actually do it by hand, but because we're not using a standard category, this method works according to all of the applicable standards.
This commit is contained in:
parent
82697c0945
commit
eddaf0d72d
@ -4,9 +4,6 @@
|
||||
version="1.9.0"
|
||||
adtProVersion="2.0.1"
|
||||
|
||||
# Jessie+, this NEEDS to be /usr/share
|
||||
xdgApplicationDir="/usr/share/applications"
|
||||
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2CLOUD_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2CLOUD_SCRIPT_URL" ;;
|
||||
@ -376,6 +373,13 @@ else
|
||||
echo "A2CLOUD: avahi-daemon (mDNS) is already installed."
|
||||
fi
|
||||
|
||||
### A2CLOUD: Install xdg-utils (FreeDesktop menus/icon tools)
|
||||
if ! hash xdg-desktop-menu; then
|
||||
echo "A2CLOUD: Installing xdg-utils..."
|
||||
sudo apt-get -y install xdg-utils
|
||||
sudo apt-get clean
|
||||
fi
|
||||
|
||||
if [[ $installADTPro ]]; then
|
||||
|
||||
### ADTPro: Make sure we have enough free space
|
||||
@ -1163,7 +1167,7 @@ if [[ $installArchiveTools ]]; then
|
||||
fi
|
||||
|
||||
|
||||
if hash X 2>/dev/null; then
|
||||
if hash xdg-install-menu 2>/dev/null; then
|
||||
### A2CLOUD: Add XDG desktop files
|
||||
|
||||
[[ -d /etc/xdg/lxsession/LXDE-pi ]] && lxde="lxde-pi" || lxde="lxde"
|
||||
@ -1171,27 +1175,36 @@ if hash X 2>/dev/null; then
|
||||
|
||||
# remove auto-open Terminal window from pre-1.8.0
|
||||
echo "A2CLOUD: removing auto-open LXDE terminal window (if present)..."
|
||||
sudo rm /etc/xdg/autostart/lxterminal.desktop 2>/dev/null
|
||||
sudo rm -f /etc/xdg/autostart/lxterminal.desktop 2>/dev/null
|
||||
|
||||
# create "AppleII" category
|
||||
mkdir -p ~/.config/menus
|
||||
if [[ ! -f ~/.config/menus/${lxde}-applications.menu ]]; then
|
||||
mkdir -p ~/.config/menus
|
||||
echo -e "<!DOCTYPE Menu PUBLIC \"-//freedesktop//DTD Menu 1.0//EN\" \"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd\">\n<Menu>\n <Name>A2CLOUD menu extension</Name>\n <MergeFile type=\"parent\">/etc/xdg/menus/${lxde}-applications.menu</MergeFile>\n <Menu>\n <Name>Apple II</Name>\n <Directory>lxde-appleii.directory</Directory>\n <Include>\n <And><Category>AppleII</Category></And>\n </Include>\n </Menu>\n</Menu>\n" >~/.config/menus/${lxde}-applications.menu
|
||||
else
|
||||
grep -q AppleII ~/.config/menus/${lxde}-applications.menu || echo "A2CLOUD: LXDE child category file exists, not creating Apple II category."
|
||||
fi
|
||||
# create "Apple II" menu entry
|
||||
sudo mkdir -p /usr/local/share/desktop-directories
|
||||
echo -e "[Desktop Entry]\nName=Apple II\nComment=Programs and utilities related to the Apple II\nIcon=/usr/local/linapple/icon.bmp\nType=Directory\n" | sudo tee /usr/local/share/desktop-directories/lxde-appleii.directory >/dev/null
|
||||
# create menu and desktop shortcuts
|
||||
sudo mkdir -p "$xdgApplicationDir"
|
||||
# create user desktop items folder
|
||||
mkdir -p ~/Desktop
|
||||
# remove manual futzing with menus from pre-1.9.0
|
||||
sudo rm -f /usr/local/share/desktop-directories/lxde-appleii.directory ~/Desktop/gsport.desktop /usr/local/share/applications/gsport.desktop /usr/local/share/applications/linapple.desktop /usr/local/share/applications/adtproserver.desktop
|
||||
|
||||
# create "Apple II" directory entry
|
||||
cd /tmp/a2cloud-install
|
||||
cat >rasppleii-appleii.directory << EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Directory
|
||||
Name=Apple II
|
||||
Comment=Programs and utilities related to the Apple II
|
||||
Icon=/usr/local/linapple/icon.bmp
|
||||
EOF
|
||||
# GSport:
|
||||
GSPORT_PATH="$(command -v gsport)"
|
||||
if [ "$GSPORT_PATH" != "" ]; then
|
||||
echo -e "[Desktop Entry]\nName=GSport\nComment=Apple IIgs Emulator\nExec=lxterminal -e $GSPORT_PATH\nIcon=/usr/local/share/gsport32.ico\nTerminal=false\nType=Application\nCategories=AppleII\n" | sudo tee "$xdgApplicationDir/gsport.desktop" >~/Desktop/gsport.desktop
|
||||
cat >rasppleii-gsport.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=GSport
|
||||
Comment=Apple IIgs Emulator
|
||||
Exec=x-terminal-emulator -e "$GSPORT_PATH"
|
||||
Icon=/usr/local/share/gsport32.ico
|
||||
Terminal=false
|
||||
Type=Application
|
||||
EOF
|
||||
sudo xdg-desktop-menu install --mode system ./rasppleii-appleii.directory ./rasppleii-gsport.desktop
|
||||
xdg-desktop-icon install ./rasppleii-gsport.desktop
|
||||
fi
|
||||
if [[ ! -f /usr/local/share/gsport32.ico ]]; then
|
||||
sudo wget -qO /usr/local/share/gsport32.ico "${binaryURL}gsport32.ico"
|
||||
@ -1199,16 +1212,36 @@ if hash X 2>/dev/null; then
|
||||
# LinApple:
|
||||
LINAPPLE_PATH="$(command -v linapple)"
|
||||
if [ "LINAPPLE_PATH" != "" ]; then
|
||||
echo -e "[Desktop Entry]\nName=LinApple\nComment=Apple IIe Emulator\nExec=lxterminal -e $LINAPPLE_PATH\nIcon=/usr/local/linapple/icon.bmp\nTerminal=false\nType=Application\nCategories=AppleII\n" | sudo tee "$xdgApplicationDir/linapple.desktop" >~/Desktop/linapple.desktop
|
||||
cat >rasppleii-linapple.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=LinApple
|
||||
Comment=Apple IIe Emulator
|
||||
Exec=x-terminal-emulator -e "$LINAPPLE_PATH"
|
||||
Icon=/usr/local/linapple/icon.bmp
|
||||
Terminal=false
|
||||
Type=Application
|
||||
EOF
|
||||
sudo xdg-desktop-menu install --mode system ./rasppleii-appleii.directory ./rasppleii-linapple.desktop
|
||||
fi
|
||||
# ADTPro Server:
|
||||
ADTPRO_PATH="$(command -v adtpro.sh)"
|
||||
if [ "ADTPRO_PATH" != "" ]; then
|
||||
echo -e "[Desktop Entry]\nName=ADTPro Server\nComment=Floppy Transfer Utility\nExec=$ADTPRO_PATH\nIcon=/usr/local/adtpro/lib/ADTPro.ico\nTerminal=false\nType=Application\nCategories=AppleII\n" | sudo tee "$xdgApplicationDir/adtproserver.desktop" >~/Desktop/adtproserver.desktop
|
||||
cat >rasppleii-adtpro.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=ADTPro Server
|
||||
Comment=Floppy Transfer Utility
|
||||
Exec=$ADTPRO_PATH
|
||||
Icon=/usr/local/adtpro/lib/ADTPro.ico
|
||||
Terminal=false
|
||||
Type=Application
|
||||
EOF
|
||||
sudo xdg-desktop-menu --mode install ./rasppleii-appleii.directory ./rasppleii-adtpro.desktop
|
||||
fi
|
||||
# LXTerminal:
|
||||
if [[ ! $(grep lxterminal.desktop /etc/xdg/lxpanel/profile/LXDE-pi/panels/panel 2>/dev/null) && ! -f ~/Desktop/lxterminal.desktop ]]; then
|
||||
cp /usr/share/applications/lxterminal.desktop ~/Desktop/lxterminal.desktop
|
||||
xdg-desktop-icon install --novendor /usr/share/applications/lxterminal.desktop
|
||||
fi
|
||||
# prevent PolicyKit error on GUI startup
|
||||
sudo sed -i 's/^NotShowIn=GNOME;KDE;\?$/NotShowIn=GNOME;KDE;LXDE/' /etc/xdg/autostart/lxpolkit.desktop 2>/dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user