个人工具

UbuntuHelp:AddingProgramToSessionStartup/zh

来自Ubuntu中文

傻傻啲讨论 | 贡献2009年10月3日 (六) 19:36的版本

跳转至: 导航, 搜索

有两个方法使Ubuntu在开机时自动加载程序:

  1. 当你登出的时候保存会话,在你再次登录的时候应用程序会自动加载。
  2. 设置Ubuntu,使到在你登录的时候运行指定的应用程序。

会话首选项对话框

每一次你登录到Ubuntu,都是在创建一个“会话”。要定制你的会话,你必须修改会话的设置。按照如下步骤来做:

  • 系统 > 首选项 > 会话

Ubuntu打开一个允许你设定会话设置的对话框。在Ubuntu 8.04有三个标签:“会话选项”,“当前会话”和“会话启动程序”。

AddingProgramToSessionStartup?action=AttachFile&do=get&target=sessions.png

会话启动程序

这个标签允许你指定在你创建会话时运行的任意程序。一个例子就是网络管理器(nm-applet)——一个让用户更容易连接无线的程序。

添加程序

点击“添加”按钮来添加一个程序,并且在弹出的对话框中输入运行那个程序所需要的命令。如果程序是“evolution”邮件客户端,那么命令行就是evolution,如果有参数,也可以加紧命令行。(往下看).

AddingProgramToSessionStartup?action=AttachFile&do=get&target=ADD.png

<
>

如何找到合适的自启动命令

以Evolution邮件客户端为例。想象你想每次开机自动运行Evolution,而不是点击Evolution在面板的图标。你可以在会话自启动程序标签中添加合适的命令。找到屏幕上端面板上的“Evolution”的图标。右击它并选择“属性”。这回弹出“启动器属性的对话框”。注意命令栏中的命令。点击那行命令来把光标移至命令栏中,然后使用方向键向右移,来查看整个命令。

AddingProgramToSessionStartup?action=AttachFile&do=get&target=properties.png

在这个案例中,命令是: evolution --component=mail 现在我们把这一行作为命令加进“添加开机程序”对话框中。可以选择任意名字添加进名字一栏。 步骤总结:

  • 系统 > 首选项 > 会话
  • 选择“会话启动程序”标签
  • 点击“添加”
  • 输入称呼程序的名字(任意名字都行)
  • 在“命令栏”中,输入命令
  • 点击“确定”(你应该看到你的新命令)
  • 点击“关闭”

重启或登出与登录来测试。

If the application you want to add does not have an icon in the menu bar

First, locate the application in the menu structure -- do not select it to run, right mouse click to get the context menu and select "Add this launcher to panel." This will place an icon for the application on the panel at the top of the desktop. Now you can follow the steps above to find and copy the appropriate command. If you wish to remove the icon from your panel after you have done this, simply right click and select "Remove from panel."

To stop an application from running at startup

If you no longer want the application to start up when you logon:

  • Go to System > Preferences > Sessions
  • Select the "Startup Programs" tab
  • Select the application you want to remove
  • Click Remove
  • Click Close

OR

  • Un-check the box next to the name of the application

Session Options

AddingProgramToSessionStartup?action=AttachFile&do=get&target=options.png

This tab allows you to tell the system to remember what applications are running at logout, and start those applications at the beginning of your next login. This is accomplished by checking the box Automatically remember running applications when logging out. Similarly, clicking the floppy disk icon, tells the system to remember the applications that are currently running (if pidgin where running, for example), and to start those applications at the beginning of your next section.

Current Session

This tab shows the processes that are currently running.

Modifying program run options

Now you may wish to modify the way an application works at startup. This is possible through command line options, there are parts to the command line:

evolution --component=mail

The first part "evolution" is the command that is running. The second part "--component=mail" is called an option. You can modify the way evolution starts up by changing this option. The real trick is to find out what the command line supports. You might try Google to search for these options. You can test these out on a command line:

  • Applications > Accessories > Terminal

And try out variations first. Once you have it right then you can change the settings in startup. Good luck...

Moving applications to a workspace on startup and other advanced options

Using the way described above, all the applications start in one workspace, maximized and so on. If you wished for example to start an application in workspace 2 minimized, you would have to do it manually - unless you install devilspie - detailed howto can be found on the forums: [1]

Comments

This is a very handy way to start gdesklet, Firestarter (firewall) or other applications automatically. Some applications will actually add themselves to your Startup Programs tab after you configure them for the first time.