首页 > 解决方案 > 如何从桌面文件中获取 Exec 字段

问题描述

如何从 .desktop 文件中提取 Exec 字段。吉奥能帮帮我吗?

#!/usr/bin/python2

import os
from gi.repository import Gio

launcher = Gio.DesktopAppInfo.new_from_filename('/usr/share/applications/chromium.desktop')
# how get Exec field from desktop file
# cat /usr/share/applications/chromium.desktop | grep ^Exec

#retval = launcher.launch_uris()

我完全是新手..

标签: pythonlinuxpython-2.7gtkgio

解决方案


打印launcher.get_commandline()


推荐阅读