How to design your own personalized x session by editing the shell script

Source: Internet
Author: User
Keywords Session script run GNOME own
Tags create design desktop desktop environment desktop environments environment example file

This page will teach you how to design your own personalized x (graphics desktop) session by editing the shell script. Desktop environments like Gnome usually have their own session manager. These session managers allow you to set what additional programs will be loaded at startup by providing a graphical interface. However, knowing how to create an X-session script allows you to have greater flexibility in defining your desktop environment, whether you use Gnome, KDE, XFCE, Openbox, or any of the less-known window managers, like Blackbox or FVWM. Also, the ability to create X sessions allows you to run a graphical desktop, even if the graphics login manager, GDM, is damaged or not installed.

Anatomy of a simple x session script
&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;
The simplest x session script consists of two lines of commands, as shown in the following example:

#!/usr/bin/env Bash
EXEC gnome-session

The first line is like all Linux shell scripts; it specifies the shell to be used to run the script. For the example shown above, bash (Bourne recycle shell) is a specified shell. The second line specifies the application that drives the X session. Sometimes called the "magic process," because the X session ends when the program stops running. In the example shown above, "Gnome-session" is "magic process", which is used to run the GNOME desktop environment.

How to create an X session script

You don't have to have root permissions to create your own x session script. ⒈ #1 from the Application menu, select the attachment and click on the terminal to open a terminal. ⒈ #2 If you want to start editing your script, you are prompted characters to enter the following command:

Gedit ~/.XINITRC

Now you should have an empty text editor on your screen. All your actions will be saved to the. xinitrc file, hidden in your home directory. (Note: In Linux, all files that start with a point are hidden by the system.) 1. #3 specify the shell on the first line:

#!/usr/bin/env Bash

1. #4 Enter any commands you want to run before you start the desktop environment or the window manager. A command line, plus & at the end of each line of command. Adding "&" at the end of each line tells the Shell to let the command run in the background and immediately execute the next line of commands. If the command doesn't run in the background, your X session script will be stuck in the first line of the file, so you'll see an empty desktop. For example, if you want to display a terminal after login, write this line to a file:

Gnome-terminal &

1. #5 type exec at the end of the line, followed by the name of the window manager or desktop environment to use, as in the following example:

# To use GNOME, use this line of command
EXEC gnome-session
# to use KDE, use this line of command instead
EXEC Startkde
# Note If you have two lines of ' exec ', X will only run the first line and ignore the other. And all the lines that start with #
# will be annotated and ignored by the shell. This facilitates placing annotations in scripts or disabling commands that you do not want to run.

1. #6 When you are satisfied, save the file and exit the text editor. 1. #7 now let your x session script run. Type the following command at the terminal to achieve this:

chmod +x ~/.XINITRC

1. #8 Now you let the script run. You are ready to try running. To do so, save all the possible open documents and close all applications. Log out Gnome, press CTRL+ALT+F1 to access the character console and sign in. Once you have logged in, you must temporarily disable your graphics login. This requires you to type the following command:

SUDO/ETC/INIT.D/GDM stop

1. #9 Once you have done this, you are ready to test your X session script. Type the following command to achieve:

StartX

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.