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

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

问题描述

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

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.

推荐答案

您需要为您的应用程序创建一个桌面入口文件(请参阅 here) 并将其放在用户的 $HOME/.config/autostart 目录中.

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

当窗口管理器启动时,该目录中的任何桌面入口文件都将被执行(参见 此处).

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天全站免登陆