在Linux上启动时以编程方式运行? [英] Programmatically run at startup on Linux?

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

问题描述

如何在用户登录时以编程方式在Linux上设置可执行文件以运行?

How do I programmatically set an executable on Linux to run when the user logs in?

基本上,相当于 HKCU\ Windows中的软件\Microsoft\Windows\CurrentVersion\Run 注册表项。

Basically, the equivalent of the HKCU\Software\Microsoft\Windows\CurrentVersion\Run registry key in Windows.

推荐答案

对于Linux上的gnome,将引用您的应用程序的.desktop文件放在〜/ config / autostart /中,
的格式非常简单:

For gnome on Linux, place a .desktop file referring to your application in ~/config/autostart/, the format is fairly simple:

[Desktop Entry]
Type=Application
Exec=foo
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=foo

,您必须为此文件设置exec位( chmod + x)

and you will have to set the exec bit for this file (chmod +x)

如果您使用Linux操作系统,则无论如何都应创建其中之一并将其放置在菜单中。

If you are shipping on Linux, you should create one of these anyway and place it in the menus.

对于Linux上的KDE,您应在〜/ .kde / Autostart /

For KDE on Linux you should create a symbolic link to your program's executable in the folder ~/.kde/Autostart/

这篇关于在Linux上启动时以编程方式运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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