Different Xresources for different screens.

Different Xresources for different screens.

Post by Super-Us » Sat, 26 Jul 1997 04:00:00



    Hello,
I know that when OpenWindows (X11R5) processes the Xresources file it
defines some preprocessor variables like COLOR. Does it also define
variables that allow different Xresources settings for different size
screens? Can OpenWindows be modified (perhaps in the
/usr/openwin/lib/xdm scripts?) do allow for different Xresources to be
processed for different size screens?

Thanks.

      - Henrik

 
 
 

Different Xresources for different screens.

Post by Kevin Woo » Sat, 26 Jul 1997 04:00:00


// I know that when OpenWindows (X11R5) processes the Xresources file it
// defines some preprocessor variables like COLOR. Does it also define
// variables that allow different Xresources settings for different size
// screens? Can OpenWindows be modified (perhaps in the
// /usr/openwin/lib/xdm scripts?) do allow for different Xresources to be
// processed for different size screens?

I wanted to do something similar a while back and wrote the following for
my ~/.xinitrc:

    x_y=`xwininfo -root | sed -n '
    /Width/{
        :again
        s/.*:[ ]*//
        p
    }
    /Height/b again'`

    x_y=`echo "$x_y" | sed -e 'N;s/\n/ /1'`

    [ "$x_y" = "1152 900" ] &&
        ${HOME}/.openwin-init.1152
    [ "$x_y" = "1280 1024" ] &&
        ${HOME}/.openwin-init.1280
    [ "$x_y" = "1600 1200" ] &&
        ${HOME}/.openwin-init.1600

Using something like the above, you could run xrdb instead of openwin-init
to load a certain resources file based on resolution, e.g.:

    [ "$x_y" = "1280 1024" ] &&
        xrdb -load -quiet ${HOME}/.Xresources.1280

//       - Henrik

Kevin

 
 
 

Different Xresources for different screens.

Post by Hugh McInty » Sun, 27 Jul 1997 04:00:00


|> // I know that when OpenWindows (X11R5) processes the Xresources file it
|> // defines some preprocessor variables like COLOR. Does it also define
|> // variables that allow different Xresources settings for different size
|> // screens? Can OpenWindows be modified (perhaps in the
|> // /usr/openwin/lib/xdm scripts?) do allow for different Xresources to be
|> // processed for different size screens?
|> I wanted to do something similar a while back and wrote the following for
|> my ~/.xinitrc:
|>
|> [/bin/sh-based script to load different resource files deleted]

There is an easier way than all of this.  Given that .Xdefaults gets
processed through cpp, you can use something like this in .Xdefaults:

        #if WIDTH <= 1152

        ! Small-screen resources go here

        #else
        #if WIDTH <= 1600

        ! medium size resources go here

        #else

        ! large screen resources go here

        #endif
        #endif

If you look at the CDE resource files under /usr/dt/config you will find
they do this already for the font definitions.

To find the full list of preprocessor symbols defined, type "xrdb -symbols".

Hugh.

--

|  SRAM Design, Sun Microelectronics, Sun Microsystems, Inc.      |
|  Speaking for myself, not for Sun Microsystems.                 |