[SunRay-Users] xrandr modes forcing/updating

Bob Doolittle Robert.Doolittle at Sun.COM
Wed Feb 11 11:15:36 EET 2009


The Loeki wrote:
> Hi all,
>
> With the new SRSS one of the best changes was the introduction of the XRandR
> extension.
>
> But we noticed the available modes in XRandR don't get updated when you
> insert your card in another Sun Ray.
>
> Is there a way to insert custom modes or force the mode list to update upon
> reinsertion?
>   

No, not today. Perhaps in our next release.

In the meantime, what most people want is simply to have the desktop 
resize automatically upon hotdesking. That also may come in our next 
release.

For 4.1, I've attached a small script I've written which does this. It 
won't work for multihead but it works for typical cases.
To use it, simply launch a utaction in each session at startup which 
runs this script upon every session connect:
utaction -c utfit &

For Linux, you should replace the "nawk" instances with "gawk", and you 
may need to tweak PATH to add some directories for Linux.

If anybody feels like enhancing this please feed back your work to the list.
Useful additions I'd like to see but don't have time right now:
- platform independence (i.e. choose nawk vs gawk based on Solaris vs 
Linux and an all-inclusive $PATH)
- multihead

-Bob

-------------- next part --------------
#!/bin/ksh
#
# utfit - resize a desktop to fit the current monitor's preferred resolution
# Written by Bob Doolittle, Sun Microsystems, Inc.
# Feb 11, 2009
#

#exec 2>/tmp/utfit.out
#set -x
PATH=$PATH:/usr/openwin/bin:/usr/X11R6/bin

isCDE() {
	[ -z "$(xprop -root GNOME_SM_PROXY | grep -v 'no such atom on any window')" ]
}

# Get the original screen size the monitor/SRSS agreed was reasonable
DISPNUM=$(echo $DISPLAY | sed 's/:\([^.]*\).*/\1/')
DESIRED_SIZE=$(nawk -F '=' \
    '$1 == "CURRENT_RESOLUTION" { split($2,a,":"); print a[1] }' \
    /tmp/SUNWut/config/dispinfo/$DISPNUM)

# Get the size that the desktop is set to
DESKTOP_SIZE=$(xwininfo -root | nawk '/-geometry/{split($2,a,"[+-]"); print a[1]}')

# If they don't match, make the desktop resize to the monitor's capability
if ! isCDE && [ -n "$DESIRED_SIZE" -a "$DESKTOP_SIZE" != "$DESIRED_SIZE" ]
then
    xrandr -s "$DESIRED_SIZE"
    
# to work around a bug, send a HUP to gnome-panel in case it didn't
# handle the resize automatically as it should have
#    sleep 1; pkill -HUP gnome-panel
fi

exit 0


More information about the SunRay-Users mailing list