link to content
Essentials at NC State Home
skip header navigation and go to content Help | ResNet | Computing@NC State | For OIT Staff | Publications | Search NC State | Feedback | Site Map
your unity account
antivirus & security
email & messaging
connections & labs
your computer
software@nc state
files
web pages
education & training
publications
other resources
troubleshooting
ITD Sections

Making programs start at login

If you use the same applications every time you log in to your account from an X workstation, you may want to have one or all of them start automatically. You can even define where on the screen they will appear and how big their windows will initially be.

To have applications start at login, you must place their startup commands in the ".Xstartup" file that the system executes as it sets up your working environment.

Use your favorite text editor (such as NEdit) and place the program's command line command in your ".Xstartup" file. If you do not have a ".Xstartup" file in your home directory, create one.

For example, although the text editor NEdit can be started by using the Application menu from the mouse, its command line equivalent (which is nedit) is needed in this case. To start the NEdit program at login you'd place the following command in your ".Xstartup" file:

nedit &

Notice that the ampersand places the program in the background. If you forget the ampersand you won't be able to use your account until you kill the process. So, don't forget it!

All programs can be auto-started in this fashion, provided you have access to the program or use the add or attach commands to gain access. All you need to do is insert the startup command (usually some form of the name of the program) into the ".Xstartup" file, remembering the ampersand (&) of course.

For example, if you wanted to use the calendar program (which is in the cc-extras locker), you'd need to attach that locker before giving the command to start the program.

Your ".Xstartup" file might look like this

attach cc-extras
xcalendar &

Program window

Although you can now make a program start, it still starts at a default location on the screen and at a default window size. To make a program start at a specific location or at another size, use the -geometry option when starting a program.

The syntax for the option looks messy, but it's pretty simple:

program_command -geometry widthxheight_xoff_yoff

There are no spaces in widthxheight_xoff_yoff

Window width and height

The width and height of the program window are measured in pixels.

If you like using a really big NEdit window, try using

nedit -geometry 1000x450

where (730x362 are the default dimensions for NEdit).

Window coordinates

The xoff/yoff coordinates specify how far (the offset) in pixels from the edge of the program window to the edge of the monitor. The values must have a plus (+) or minus (-) value.

(+x) A positive x value specifies the distance by which the left edge of the window is offset from the left edge of the monitor.

(-x) A negative x value specifies the distance by which the right edge of the window is offset from the right edge of the monitor.

(+y) A positive y value specifies the distance by which the top edge of the window is offset from the top edge of the monitor.

(-y) A negative y value specifies the distance by which the bottom edge of the window is offset from the bottom edge of the monitor.

What all this means is that

+0+0 will place the window in the upper left.

+0-0 will place the window in the lower left.

-0-0 will place the window in the lower right.

-0+0 will place the window in the upper right.

For example, to start NEdit and make it appear in the upper left corner of your monitor, you'd place this command in your ".Xstartup" file:

nedit -geometry +0+0 &

As you can see, you can omit the width x height specification if you want the default size. Alternatively, you can include width x height and omit the screen coordinates if you just want to change the size of the program's window.

You can fully define a window by using both. For example

nedit -geometry 1000x100+0+0

puts a long skinny NEdit window in the upper left of the monitor.

 


Last modified June 15, 2005 by cawalker  

jump back to content/page ends, begin footer
jump to content
jump to content Go to page top Page Top | Site Map | OIT | Policy Disclaimer | Site Survey