python - 如何从桌面文件中获取 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()
我完全是新手..
解决方案
打印launcher.get_commandline()
推荐阅读
- celery - CeleryExecutor:气流指标“executor.queued_tasks”是否报告 celery 代理中的任务数?
- events - 触发事件时获取 ID 属性(elm v0.19.1)
- python - 将公钥传递给 rsa 解码器的问题 TypeError: ** 或 pow() 不支持的操作数类型:'str' 和 'int'
- python - 如何根据同一行中另一列中的值转发填充列值
- python - 如何通过单击href函数将值传递给新模板?
- django - Django Extra Views - 如果更新时满足条件,则删除“InlineFormset”
- mysql - MySQL - 加入多个选择语句
- c++ - 如何替换此示例代码片段中已弃用的 handler_type_t 或 boost::asio::handler_type ?
- .net - 尝试在 CICD 中部署 .NET 应用程序
- java - 如何将 2 个不同 JTextField 中的 2 个元素添加到一个 JList