在启动时运行Qt应用程序 [英] Running a Qt application at startup

查看:96
本文介绍了在启动时运行Qt应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个Qt应用程序,该应用程序将在Linux上运行.它应该在启动时运行.

I wrote a Qt application that is going to run on Linux. It supposed to run at startup.

它应该可以在每个Linux系统上运行-Suse,RedHat等.

It's supposed to run on every Linux- Suse, RedHat etc.

我应该编写什么脚本并将其放在哪里?

What script should I write and Where to put it?

我根本不知道如何编写脚本,因此,如果您附上示例,我将不胜感激.

I don't know how to write scripts at all, so I would appreciate it if you will attach an example.

推荐答案

您需要为应用程序创建一个桌面条目文件(请参见

You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory.

启动Window Manager时,该目录中的任何桌面条目文件都会执行(请参见此处).

Any desktop entry file in that dir will get executed when a Window Manager starts up (see here).

为此,通常需要手动创建桌面条目文件(就是这样,而不是通过C ++代码/脚本),然后只需通过C ++代码安装在该目录中即可.

To do this, usually you'll need to create your desktop entry file by hand (that's it, not via C++ code/script) and to just install in that directory via C++ code.

这篇关于在启动时运行Qt应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆