How to create a binary package software shortcut icon on linux

First of all, let me describe my environment. I like to play around, so I installed 3 operating systems on my computer, namely ubuntu22.04, opensuse 15.5, and manjora. I usually use them interchangeably. These three systems use separate root partitions / and /root partitions respectively, but mount the same data partition /u01 (store data files and software, etc.)

These three operating systems are all installed with software that I usually use, such as libreoffice, typora, etc.

Before, it was necessary to install the deb version of the software on ubuntu, the rpm version of the software on opensuse, and the binary version of the software on manjaro.

Later, I found that many linux software have appimage version, which can run without installation. For example, navicat, and some software can run as long as it is decompressed, such as idea.

So, I started to abandon the rpm/deb version and download the appimage and binary compressed package instead, so as long as the .desktop file is created in /usr/share/applications according to the format, there will be a corresponding icon in the start menu, just open it Execution, very convenient.

In this way, there is no need to install deb/rpm/binary packages for the 3 systems separately. You only need to write the script, install the operating system, run the script, and create .desktop for the software respectively.

Most of the .desktop files are similar, with only two main items, one is the path of the program, and the other is the icon of the program. In order to have the same effect as the rpm/deb installation, I refer to the content of the .desktop file generated by the rpm/deb installation, and extract the original icon from the appimage. Write down the creation script below for your reference.

Divided into three parts, namely libreoffice, appimage software, binary compression package software.

libreoffice

The previous section describes the creation of shortcuts for libreoffice and other appimage software, and then the creation of shortcuts for some binary compression package software.

These binary packages support various distributions of linux, and they can be run after decompression. We create shortcuts by adding a shortcut icon to these software, so that they can be opened from the start menu without opening a terminal to use the command line opened.

The software needs to be decompressed to the path to the script first. Some icons are in the decompression directory, and some can be found on the Internet, and then edited with image editing software to 512x512 or 256x256 or 128x128.

Both ubuntu22.04/opensuse 15.5/manjaro passed the test

#windterm
cat > /usr/share/applications/windterm.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=2.5.0
Terminal=false
Type=Application
Name=WindTerm
Comment=ssh client
Exec=/u01/program/WindTerm/WindTerm
Icon=/u01/program/WindTerm/windterm.png
EOF

#typora
cat > /usr/share/applications/typora.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.6.6
Terminal=false
Type=Application
Name=Typora
Comment=Markdown Editor
Exec=/u01/program/Typora/Typora %U
Icon=/u01/baiduyun/Temporary/ico/typora.png
EOF

#ultraedit
[ `cat /proc/version|grep MANJARO|wc -l` = 1 ] && pacman -S --noconfirm libjpeg6-turbo
[ `cat /proc/version|grep Ubuntu|wc -l` = 1 ] && apt -y install libjpeg62
cat > /usr/share/applications/uex.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=21.00.0.0
Encoding=UTF-8
Name=UltraEdit
Comment=Professional Text/Hex/Programmers Editor
GenericName=Text Editor
Exec=/u01/program/uex/bin/uex %U
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/u01/program/uex/share/uex/ue.png
Categories=Application;Development;
MimeType=text/plain;
StartupNotify=true
X-AppInstall-Package=uex
EOF

#vscode
cat > /usr/share/applications/vscode.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.79.2
Terminal=false
Type=Application
Name=code
Comment=A Text Editor
Exec=/u01/program/VSCode/code %U
Icon=/u01/program/VSCode/resources/app/resources/linux/code.png
EOF

#sqldeveloper
cat > /usr/share/applications/sqldeveloper.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=23.1.0
Terminal=false
Type=Application
Name=SQL Developer
Comment=Database Client Tool
Exec=/u01/program/sqldeveloper/sqldeveloper.sh
Icon=/u01/baiduyun/Temporary/ico/sqldeveloper.png
EOF

#DockQuery
cat > /usr/share/applications/DockQuery.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.2.0
Terminal=false
Type=Application
Name=DockQuery
Comment=Database Client Tool
Exec=/u01/program/DockQuery/DockQuery
Icon=/u01/baiduyun/Temporary/ico/DockQuery.png
EOF

#datagrip
cat > /usr/share/applications/datagrip.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=2023.1.1
Terminal=false
Type=Application
Name=DataGrip
Comment=Database Client Tool
Exec=/u01/program/DataGrip/bin/datagrip.sh
Icon=/u01/program/DataGrip/bin/datagrip.svg
EOF

#idea
cat > /usr/share/applications/idea.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=2023.1
Terminal=false
Type=Application
Name=IntellJ IDEA
Comment=Java IDE
Exec=/u01/program/idea-IC/bin/idea.sh
Icon=/u01/program/idea-IC/bin/idea.png
EOF

#pycharm
cat > /usr/share/applications/pycharm.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=2023.1
Terminal=false
Type=Application
Name=PyCharm
Comment=Python IDE
Exec=/u01/program/pycharm-community/bin/pycharm.sh
Icon=/u01/program/pycharm-community/bin/pycharm.svg
EOF

Guess you like

Origin blog.csdn.net/weixin_44496870/article/details/131698169