Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1188770
  • 博文数量: 253
  • 博客积分: 5892
  • 博客等级: 大校
  • 技术积分: 1942
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-24 14:20
文章分类

全部博文(253)

文章存档

2012年(98)

2011年(155)

分类: LINUX

2012-01-09 13:36:19

2007-10-20 9:01
Contents
  • 1 Introduction
  • 2 GNOME
  • 3 KDE
  • 4 Xfce4
  • 5 Fluxbox
  • 6 IceWM
  • 7 FVWM
  • 8 Enlightenment DR16
  • 9 Enlightenment DR17
  • 10 Notes
Introduction简介

This HOWTO explains how to get programs to launch when you login into your WM (Window Manager) and/or DE (Desktop Environment).

这个 HOWTO 介绍了怎样在你登录进你的Window Manager(窗口管理器)或DE(桌面环境)时如何自动启动程序。

NOTE: New users should note that ~ equals user's home directory. Also note that these instructions should work on these Window Managers on most Distributions in addition to Gentoo.

注意:新手要注意~表示用户的home目录,且以下的介绍应该能在大多数窗口管理器还有Gentoo号上有效。

GNOME

Programs that you wish to autostart on GNOME startup can be selected by using the Control Center. To do this, open the Control Center and then navigate to Sessions followed by Startup Programs. Click Add and either type the path, or use Browse to select your desired program[s]. If multiple programs are selected, they can be launched in a desired order.

你想自启动的程序可以通过在控制面板上选择。打开 控制面板 的 Startup Programs 里的Sessions 项,单击 Add 并敲入路径或浏览选择你要自启动的程序。如果选择了多个程序,它们可以按顺序启动。

If the GUI is not available or desireable, then one can instead modify ~/.gnome2/session-manual. Syntax is as follows:

如果没在 GUI 下或者不是在GNOME的GUI下,那么可以编辑 ~/.gnome2/session-manual。语法如下:


File: ~/.gnome2/session-manual
[Default]
num_clients=1
0,RestartClientHint=3
0,Priority=50
0,RestartCommand=gdesklets
0,Program=gdesklets
KDE

Programs that you wish to autostart on KDE startup need to be placed into ~/.kde/Autostart.

KDE的自启动的程序需要放在 ~/.kde/Autostart 目录下。

Below is an example of autostarting GAIM written in bash.

下面是一个用bash脚本写的自动启动GAIM的例子。

cd ~/.kde/Autostart
nano -w gaim (example script below)
File: Example script
#!/bin/bash
/usr/bin/gaim
chmod +x gaim

Below is an alternative for the same example, this time using a soft link.

下面是同样例子的另一种实现方法。这次用一个软链接。

cd ~/.kde/Autostart
ln -s /usr/bin/gaim gaim

You can also put files here. For example, you can drag a shortcut from the K Menu.

你也可以把.desktop文件放在这目录下。譬如,你可以从 K Menu 中拖一个快捷方式到目录下。


Alternative KDE Explanation 自启动KDE程序的另一种解释

To Autostart a program in KDE you simply need to put a symbolic link to the executable file in the Autostart directory. In most cases this is located at:

要在KDE里自动启动程序你只要简单地把一个指向可执行文件的符号链接放到 Autostart 目录。多数情况下这个目录在

/home/username/.kde/Autostart/

If wanted to have xbindkeys start automatically when KDE started then I would locate the the executable file for xbindkeys. In my installization it is located at:

譬如想在 KDE 启动时自动启动 xbindkeys,此应用程序可执行文件在我的系统中在

/usr/bin/xbindkeys

All you have to do is place a symbolic link in the Autostart directory:

你只要在 Autostart 目录种放一个符号链接:

ln -s /usr/bin/xbindkeys /home/username/.kde/Autostart/xbindlink

This command creates a link named "xbindlink" in the Autostart directory that links to the executable located in the /usr/bin/ directory.

这个命令在 Autostart 目录中创建一个叫"xbindlink"的链接,链接到 /usr/bin 目录中的可执行文件。

Restart KDE and you should be in business.

重启KDE即可达到目的。

I hope this helps.

希望有帮助。

Xfce4

Programs that you wish to autostart on Xfce4 startup can be selected by using the xfce4-autostart-editor tool available in Xfce4 menu > Settings > Xfce 4 Autostarted Applications.

If the GUI is not desirable, you can put .desktop files in the ~/.config/autostart/ directory. If this directory does not exist, simply create it.

Note: In the Xfce versions prior to 4.4 the programs had to be located in ~/Desktop/Autostart.

Below is an example of autostarting GAIM written in bash.

cd ~/Desktop/Autostart #since version 4.4 ~/.config/autostart
nano -w gaim (example script below)
File: Example script
#!/bin/bash
/usr/bin/gaim
chmod +x gaim

For a simpler approach, a link will work as well:

cd ~/Desktop/Autostart #since version 4.4 ~/.config/autostart
ln -s `which gaim`
Fluxbox

Programs that you wish to autostart on Fluxbox startup need to be placed into ~/.fluxbox/startup and fluxbox needs to be started with startfluxbox

To start Fluxbox locally or globally with startx, ensure that your ~/.xinitrc (for local) or /etc/X11/xinit/xinitrc (for global) file contains the line:


File: ~/.xinitrc or /etc/X11/xinit/xinitrc

startfluxbox


If you want to add something to the startup list, make sure it has an "&" at the end of the command line.

Below is an example of line you need to add to autostart GAIM.

cd ~/.fluxbox
nano -w startup
File: ~/.fluxbox/startup file

Before the line

exec /usr/bin/fluxbox

add

/usr/bin/gaim &
IceWM

IceWM is very similar to Fluxbox in that you have a script that is executed when IceWM starts up, simply add all the commands you'd like executed to ~/.icewm/startup. Note that since this is executed as a script all programs should either detach themselves or be backgrounded.

Unlike Fluxbox however this script does not need to start up IceWM itself. The file should be a well-formed script, eg:


File: ~/.icewm/startup
#! /bin/bash

audacious &
gkrellm2 &
psi &
xscreensaver -no-splash &

And of course, it should be marked as executable:

$ chmod a+x ~/.icewm/startup
FVWM

Programs that you wish to autostart on startup need to be placed into ~/.fvwm/.fvwm2rc

Below is an example of line you need to add to autostart GAIM.

cd ~/.fvwm
nano -w .fvwm2rc

After the line, if non-existing, add it.

File:
AddToFunc InitFunction

add

+ I Exec exec /usr/bin/gaim
Enlightenment DR16
  1. Start the application you wish to autostart (e.g. gkrellm2).
  2. Alt + right click anywhere in the application's window.
  3. Select "Remember..." from the context menu. A menu called "Remembered Application Attributes" will appear.
  4. At the bottom of this window, check the "Restart application on login" checkbox.
  5. Click "Apply" then "OK".

Since e16.8 you can use/create ~/.e16/{Start Stop Init} folders. All you need to do is:

  1. create the folder(s)
  2. enable user session scripts in e16 menu -> Session Settings
  3. create a link/script in one of the folders

thats it

Enlightenment DR17

Note: Recent versions of e17 don't use eap files anymore but ordinary .desktop-files. Just substitute .eap with .desktop and forget the part about creating eap-files.

Code: example file for gnome-settings-daemon

[Desktop Entry]
Encoding=UTF-8
Name=Gnome-Settings Daemon
Exec=/usr/libexec/gnome-settings-daemon
StartupNotify=false
Type=Application

Programs that you wish to autostart on startup should have their corresponding .eap file listed in ~/.e/e/applications/startup/.order

Below is an example of making GAIM autostart:

Code: Add existing .eap file to startup list

echo "gaim.eap" >> ~/.e/e/applications/startup/.order

This, obviously, relies on the application you wish to autostart having a .eap file to begin with! (There's a full list at ~/.e/e/applications/all) If that isn't the case, you can create one (here we're going to execute a simple script to start the daemon):

Code: Create new .eap file

cd ~/.e/e/applications/all
e_util_eapp_edit beagled.eap

This will launch a dialog: we need to set the App Name to 'beagled' and the Executable should point to our script (in my case its ~/bin/beagled.sh: obviously you should set appropriately).

Finally, we need to add out new .eap to the startup list:

Code: Add new .eap file to startup list

echo "beagled.eap" >> ~/.e/e/applications/startup/.order

阅读(2870) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~