home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomeLinux in a NutshellSearch this book

17.11. Starting Windows on Different Desktops and Pages

There's an obvious, low-tech way to start applications on different desktops and on different pages within a desktop: switch the view to the desktop and page you want (using the Pager, keyboard shortcuts, or whatever method you like), open a terminal emulator window (e.g., using the Root menu), then run any program you like. Voila. The application window opens on the current desktop and page.

But there are two automated ways to accomplish this same thing. In the first method, you specify in your .fvwm2rc file that certain programs will appear on certain desktops and/or pages automatically when you run them. You do this using fvwm2's Style variable, which takes two relevant options: StartsOnPage and StartsOnDesk.

Here comes a confusing part. StartsOnPage takes up to three numeric arguments. If there is only one argument, it corresponds to the number of the desk on which to open the application. If there are three arguments, the second and third additionally identify the page, using an X,Y coordinate scheme. We'll come back to this in a moment. (Two arguments alone are interpreted as the X,Y coordinates of the page.)

And what about the closely associated StartsOnDesk variable? A little more confusion here. StartsOnDesk takes only one argument: the desk number. But since you can set this with StartsOnPage, along with the more specific page address, in practice there is no need to use StartsOnDesk at all. The only real reason to use StartsOnDesk is if you want your .fvwm2rc file definitions to be as obvious as possible.

Now back to desktop and page addressing. Let's consider the addressing scheme of a single two-by-two-page desktop. Just as the first desk is addressed as number 0, the first page on a desk is 0,0. The next page to the right is 1,0. The third page clockwise (the lower-right quadrant) is 1,1. And the fourth page clockwise (the lower-left quadrant) is 0,1.

Supposing there are at least two desktops of four pages each, the following definition says that when you run an xterm called "bigxterm" it will be opened in the lower-left quadrant (0,1) of the second desktop (number 1):

Style "bigxterm"     StartsOnPage 1 0 1

Once you make this update to your .fvwm2rc file and restart the window manager, running the command:

xterm -name bigxterm &

will open the window where you want it.

You also have the option of accomplishing the same thing using X resource syntax on the command line. This strategy may even be a little more practical than putting the definitions in your .fvwm2rc file because you won't have to define many different instances of the various programs (e.g., bigxterm, littlexterm, mailwindow, or whatever). The -xrm option (recognized by many X clients) lets you specify an X resource variable on the command line:

xterm -xrm '*Page: 1 0 1' &

You can even put a series of such lines in your X session startup file in order to open applications wherever you want them on your desktop(s) when you log in.

While it looks as if these two methods of opening windows on different desktops/pages (the Style variable with StartsOnPage or StartsOnDesk and the -xrm command-line option) produce identical results, there is actually a subtle difference in behavior. When you use Style with StartsOnPage (or StartsOnDesk) and you specify only the desktop number, the window is opened on the first page (0,0) of that desk. If you give the same information on the command line (using -xrm), the destination page of the new window is related to the page you're on when you run the command. The new window appears on the analogous page of the desktop you specify.

You have still one more alternative if you're interested in opening a window on a different page within the current desktop. Run a window with the -geometry option and supply large enough coordinates to place it on a particular page in the desktop. If you use a desktop three pages square, the following line places a window in the middle page (of the nine-page grid):

xterm -geometry +1200+1200 &

Keep in mind, however, that display-specific characteristics play a big part in gauging these distances, and they are not easy to guess.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.











??????????????@Mail.ru