Files
2021-10-21 14:57:58 +08:00

24 lines
1.7 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 1.15 启动器创建“我的世界”启动项
在应用商店里安装软件后,就可以在启动器里找到该软件的一个启动项,启动软件变得非常方便。在启动项右键菜单上还提供了“发送到桌面”、“发送到任务栏”、“开机自动启动”等简捷功能。
而所谓的启动项,本质就是一个后缀为“.desktop”的文件可以在系统盘/usr/share/applications/里看到。
但是,在`/usr/share/applications/`里创建启动项并不是最佳的位置
最佳位置在主目录 `~/.local/share/applications` 里。
下面以创建Minecraft(我的世界)为例讲解。
首先用编辑器创建文件 `~/.local/share/applications/Minecraft.desktop `,添加以下内容:
```bash
[Desktop Entry]
Categories=Game;Comment=Minecraft
Exec=/home/<用户名>/Minecraft/Minecraft.sh
Icon=minecraftName=Minecraft
Name[zh_CN]=我的世界Terminal=false
Type=Application
X-Deepin-Vendor=user-custom
```
特别注意1所有的路径都必须是绝对路径而且不识别$HOME、~这些常见的bash变量。
特别注意2Icon虽然可以用绝对路径的图标但不能自适应大小。推荐把图标拷贝到`~/.loca/share/icons/hicolor/`的各个尺寸目录里文件名为minecraft。
Minecraft.sh就是我的世界的启动脚本内容如下
`#!/bin/bash`
`cd $HOME/Zz/Minecraft`
`java -jar HMCL.jar`HMCL启动器下载地址https://github.com/huanghongxun/HMCL
需要安装Java运行时`sudo apt install default-jre openjfx`