[App Sharing] ACE-Bookworm容器安装的QGIS添加本地文件关联(AMD64构架)
Tofloor
poster avatar
Jetcser
deepin
2024-04-30 11:08
Author

1.软件环境:

操作系统:UOS v20 1060 AMD64专业版(理论上也适用于deepin v20与v23),ACE容器(Bookworm),QGIS Desktop 3.34.6 LTR

2.问题描述:

在ACE容器中安装的QGIS,由于mime类型、文件关联以及图标文件都存储在ACE容器中,主机是无法识别的,导致QGIS的文件关联无法在主机中生效。而目前的QGIS工程文件主要以qgz格式为主,本质是一个zip压缩包,设置默认打开程序之后,要么qgz工程会使用归档管理器打开,要么zip压缩包会在QGIS中打开,每次都要右键重新设置默认打开程序,比较不方便。

3.问题解决思路:

通过复制和设置ACE环境中的与QGIS有关的mime-type文件和图标文件,来修复本机的QGIS文件关联。

4.Bash脚本:

#! /bin/bash

# 设置ACE环境变量的路径
ACE_ENV=/opt/apps/cn.flamescion.bookworm-compatibility-mode//files/ace-env

# 复制QGIS的mime类型文件
sudo cp $ACE_ENV/usr/share/mime/packages/qgis.xml /usr/share/mime/packages/
# 复制QGIS的桌面应用文件
sudo cp $ACE_ENV/usr/share/applications/org.qgis.qgis.desktop /usr/share/applications
# 更新mime数据库
sudo update-mime-database /usr/share/mime
# 更新桌面数据库
sudo update-desktop-database /usr/share/applications

# 复制各种大小的png图标
SIZES=(8x8 16x16 24x24 32x32 36x36 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512)
for size in ${SIZES[@]}
do
    # 复制对应尺寸的图标
    sudo cp $ACE_ENV/usr/share/icons/hicolor/${size}/mimetypes/qgis*.png /usr/share/icons/hicolor/${size}/mimetypes/
done
# 复制svg图标
sudo cp $ACE_ENV/usr/share/icons/hicolor/scalable/mimetypes/qgis*.svg /usr/share/icons/hicolor/scalable/mimetypes/
# 更新图标缓存
sudo update-icon-caches /usr/share/icons/*

echo -e "\033[31m按任意键继续...\033[0m"
read -n 1

5.效果如下(注销重新登录之后生效):

image.png

Reply Favorite View the author
All Replies
神末shenmo
Moderator
Spark-App
2024-04-30 12:35
#1

现在的ACE还是不能透传mimetype吗?

应该可以了吧....还是我配置的不对?

现在已经可以自动配置透传了

图片.png

Reply View the author
神末shenmo
Moderator
Spark-App
2024-04-30 12:42
#2

啊我好像知道了

https://gitee.com/amber-ce/amber-ce-bookworm/commit/0fd58e7134bb4703207354e3d2b5b20ec12ceaab

这样是不是就可以了

Reply View the author
Jetcser
deepin
2024-04-30 12:51
#3
神末shenmo

啊我好像知道了

https://gitee.com/amber-ce/amber-ce-bookworm/commit/0fd58e7134bb4703207354e3d2b5b20ec12ceaab

这样是不是就可以了

应该就是少了容器到主机的 /usr/share/mime的链接,我是看了个ubuntu的例子来改的。

Reply View the author
神末shenmo
Moderator
Spark-App
2024-05-01 21:52
#4
Jetcser

应该就是少了容器到主机的 /usr/share/mime的链接,我是看了个ubuntu的例子来改的。

新版推送了

Reply View the author