Ubuntu 22.04 添加 AppImage 到应用程序

  • Ubuntu 22.04 添加 AppImage 到应用程序已关闭评论
  • 120 次浏览
  • A+
所属分类:linux技术
摘要

AppImage 逐渐成为 Linux 常用的一种软件包格式,本文将介绍如何将 AppImage 文件添加到 Ubuntu 的应用程序中。


前言

AppImage 逐渐成为 Linux 常用的一种软件包格式,本文将介绍如何将 AppImage 文件添加到 Ubuntu 的应用程序中。

如下图中的 CAJViewer :

Ubuntu 22.04 添加 AppImage 到应用程序

操作过程

设置相关权限

对要操作的 AppImage 右击 > 属性进行如下图的设置,必须勾选 允许执行文件

Ubuntu 22.04 添加 AppImage 到应用程序

创建 desktop 文件

在任意文件夹内启动终端,执行 gedit CAJViewer.desktop ,创建 .desktop 文件,并输入以下内容:

[Desktop Entry] Encoding=UTF-8 Type=Application #应用名称 Name=CAJViewer #图标路径 Icon=***/CAJViewer/Icon.png #启动是否开启终端 Terminal=false #AppImage文件路径 Exec=***/CAJViewer/CAJViewer.AppImage 

.desktop 文件置于桌面时可以作为类似 Windows 的快捷方式一样来启动软件

Ubuntu 22.04 添加 AppImage 到应用程序

当快捷方式像如上图所示一样时是无法启动软件的,右击 > 允许运行 后图标处没有红叉即可启动

Ubuntu 22.04 添加 AppImage 到应用程序

这样就可以从桌面启动了

添加至应用程序

使用 sudo cp CAJViewer.desktop /usr/share/applications 命令,将设置好的 .desktop 文件复制到 /usr/share/applications 文件夹中,就可以在应用程序里看到 CAJViewer 应用

为特定格式文件设置默认启动程序

首先查看要设置的文件所属格式,右击目标文件查看文件类型,如图所示,caj文件是 application/octet-stream 格式

Ubuntu 22.04 添加 AppImage 到应用程序

通过 sudo gedit /usr/share/applications/defaults.list 命令编辑 defaults.list 文件,在末尾添加一行

application/octet-stream=CAJViewer.desktop; 
  • 全局默认打开方式保存在 /etc/gnome/defaults.list
  • 用户默认打开方式保存在 ~/.local/share/applications/mimeapps.list

保存后再次点击caj文件就会通过 CAJViewer 运行

结语

其它的 AppImage 文件均可按照以上方法操作

参考

Ubuntu20.04使用CAJViewer for Linux(可双击打开.caj文件)

Ubuntu指定文件打开方式