Help:Autostart

From Openbox

(Difference between revisions)
Jump to: navigation, search
(Making your own autostart)
(Making your own autostart)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
 
[[Image:LoginOptions.png|right|thumb|Figure 1: The "Openbox" session type at log in]]
 
[[Image:LoginOptions.png|right|thumb|Figure 1: The "Openbox" session type at log in]]
When you log in with the "Openbox" session type, or launch Openbox with the <code>openbox-session</code> command, the autostart script will be executed to set up your environment and launch any applications you want to run at startup.
+
When you log in with the "Openbox" session type, or launch Openbox with the <code>openbox-session</code> command, the <code>environment</code> script will be executed to set up your environment, and the <code>autostart</code> script can launch any applications you want to run at startup.
  
 
''When you run the <code>openbox</code> command on its own, the autostart scripts will not run.  They are run by <code>openbox-session</code> or when you log in graphically with the "Openbox" session type.''
 
''When you run the <code>openbox</code> command on its own, the autostart scripts will not run.  They are run by <code>openbox-session</code> or when you log in graphically with the "Openbox" session type.''
Line 6: Line 6:
 
'''Note:''' Some distributions ship an "openbox" session type (for display managers) that simply calls the openbox binary.  You want to select the entry that mentions "session."
 
'''Note:''' Some distributions ship an "openbox" session type (for display managers) that simply calls the openbox binary.  You want to select the entry that mentions "session."
  
You can use this script to launch a panel, to set your desktop wallpaper, or anything else.
+
You can use the environment script to set up any custom environment variables you would like to use in your login session.
  
The autostart script is located at <code>~/.config/openbox/autostart.sh</code>. If that file does not exist, then the system-wide default script, located at <code>/etc/xdg/openbox/autostart.sh</code>, is run instead.
+
You can use the autostart script to launch a panel, to set your desktop wallpaper, or anything else.
 +
Once Openbox starts, the system-wide default script, located at <code>/etc/xdg/openbox/autostart</code>, will be run. Then the user script at <code>~/.config/openbox/autostart</code> is run afterward.
  
The default autostart file sets up a number of things for you:
+
== Setting up your environment ==
* It sets a plain color for the background so you don't have to see the ugly default X background
+
If you would like to set environment variables that will affect everything run in your current session (including Openbox), you can place them in <code>~/.config/openbox/environment</code>. Here's an example <code>~/.config/openbox/environment</code> file:
* It runs <code>gnome-settings-daemon</code> if you have GNOME installed, so that your GTK applications will look and work the way they have been set up through the GNOME configuration tools.
+
<code><pre>
* It runs <code>xfce-mcs-manager</code> otherwise so that GTK applications will inherit their settings from the XFCE configuration tools.
+
# Set up my own path
* It runs <code>kdeinit</code> if you have KDE installed, so that your KDE applications will have the background processes running that they need.
+
export PATH=$HOME/bin:$PATH
* It runs <code>xdg-autostart</code>, if you have PyXDG installed, to run any programs that have requested to be started with the X session. (It does not run GNOME or KDE specific applications unless asked to, see <code>xdg-autostart --help</code>.)  <code>xdg-autostart</code> is installed to <code>/usr/lib/openbox/</code> because it will be distributed as part of the PyXDG package in the future.
+
 
 +
# Change the language used from the system's default
 +
export LC_CTYPE=ja_JP.utf8
 +
 
 +
# SCIM for typing non-english characters
 +
export XMODIFIERS=@im=SCIM
 +
export GTK_IM_MODULE=scim
 +
export QT_IM_MODULE=scim
 +
</pre></code>
  
 
== Making your own autostart ==
 
== Making your own autostart ==
If you want to launch more programs at startup than those provided in the default autostart file, create the file <code>~/.config/openbox/autostart</code>. You can run the system-wide autostart through this file by using the command "<code>. $GLOBALAUTOSTART</code>". Here's an example <code>~/.config/openbox/autostart.sh</code> file:
+
The system can provide applications that run automatically on login (see <code>/usr/libexec/openbox-xdg-autostart --list</code>), but you may wish to run others.
 +
 
 +
To run commands for your user account only, create and edit a file called <code>~/.config/openbox/autostart</code>. Place any commands you want to run on startup in the file, each ending with a <code>&</code> character.
 +
 
 +
Here's an example <code>~/.config/openbox/autostart</code> file:
 
<code><pre>
 
<code><pre>
# Run the system-wide support stuff
+
# Programs that will run after Openbox has started
. $GLOBALAUTOSTART
+
  
# Programs to launch at startup
+
# Set the wallpaper
 
hsetroot ~/wallpaper.png &
 
hsetroot ~/wallpaper.png &
 +
 +
# Run a Composite manager
 
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &
 
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &
  
 
# SCIM support (for typing non-english characters)
 
# SCIM support (for typing non-english characters)
export LC_CTYPE=ja_JP.utf8
 
export XMODIFIERS=@im=SCIM
 
export GTK_IM_MODULE=scim
 
export QT_IM_MODULE=scim
 
 
scim -d &
 
scim -d &
  
# Programs that will run after Openbox has started
+
# A panel for good times
(sleep 2 && fbpanel) &
+
fbpanel &
 
</pre></code>
 
</pre></code>
  
Make sure that you end any commands with "&" so that they are run in the background, or any programs after it (including Openbox!) will not run until it finishes.
+
To run commands for all users system-wide, place them in a similar file in <code>/etc/xdg/openbox/autostart</code>.
 +
 
 +
Make sure that you end any commands with "&" so that they are run in the background, or any programs after it will not run.
  
You do ''not'' need to run Openbox at the end of this script.  This script is run just before Openbox is launched by <code>openbox-session</code>.
+
You do ''not'' need to run Openbox at the end of this script.  This script is run just after Openbox has finished setting up, and is launched by <code>openbox-session</code>.

Latest revision as of 16:00, 3 August 2011

(thumbnail)
Figure 1: The "Openbox" session type at log in

When you log in with the "Openbox" session type, or launch Openbox with the openbox-session command, the environment script will be executed to set up your environment, and the autostart script can launch any applications you want to run at startup.

When you run the openbox command on its own, the autostart scripts will not run. They are run by openbox-session or when you log in graphically with the "Openbox" session type.

Note: Some distributions ship an "openbox" session type (for display managers) that simply calls the openbox binary. You want to select the entry that mentions "session."

You can use the environment script to set up any custom environment variables you would like to use in your login session.

You can use the autostart script to launch a panel, to set your desktop wallpaper, or anything else. Once Openbox starts, the system-wide default script, located at /etc/xdg/openbox/autostart, will be run. Then the user script at ~/.config/openbox/autostart is run afterward.

[edit] Setting up your environment

If you would like to set environment variables that will affect everything run in your current session (including Openbox), you can place them in ~/.config/openbox/environment. Here's an example ~/.config/openbox/environment file:

# Set up my own path
export PATH=$HOME/bin:$PATH

# Change the language used from the system's default
export LC_CTYPE=ja_JP.utf8

# SCIM for typing non-english characters
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim

[edit] Making your own autostart

The system can provide applications that run automatically on login (see /usr/libexec/openbox-xdg-autostart --list), but you may wish to run others.

To run commands for your user account only, create and edit a file called ~/.config/openbox/autostart. Place any commands you want to run on startup in the file, each ending with a & character.

Here's an example ~/.config/openbox/autostart file:

# Programs that will run after Openbox has started

# Set the wallpaper
hsetroot ~/wallpaper.png &

# Run a Composite manager
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &

# SCIM support (for typing non-english characters)
scim -d &

# A panel for good times
fbpanel &

To run commands for all users system-wide, place them in a similar file in /etc/xdg/openbox/autostart.

Make sure that you end any commands with "&" so that they are run in the background, or any programs after it will not run.

You do not need to run Openbox at the end of this script. This script is run just after Openbox has finished setting up, and is launched by openbox-session.

Personal tools