Hi,

a small shell script for whoever might find it useful:

The script fetches a window's properties and appends a winprop
template at the end of the local kludges file.
It then launches an editor for the kludges file so that the
attributes can be modified.

It runs on Solaris here. You might want to edit the "editor" and
"kludges" variables at the top ...

Cheers,

Felix.
#!/bin/sh

## Config options: graphical editor and path of kludges file
#
editor=dtpad
#editor="xterm -e vi"

kludges=$HOME/.ion2/default-session--0/kludges.lua

#
##

tmp=/tmp/`basename $0`.$$
ktmp=$tmp.kludges

abort ()
{
    rm -f $tmp* 
    exit 1
}

trap abort 2


cp $kludges $ktmp

if [ ! -w $kludges ]; then
    abort
fi


xprop > $tmp || abort

class=`grep WM_CLASS $tmp | awk '{print $4}' | sed -e 's/[,"]//g'`
instance=`grep WM_CLASS $tmp | awk '{print $3}' | sed -e 's/[,"]//g'`
role=`grep WM_ROLE $tmp | awk '{print $3}'`
name=`grep WM_NAME $tmp | awk '{print $3}' | sed -e 's/[,"]//g'`

(
echo "winprop{"
if [ "$class" != "" ]; then
    echo "    class = \"$class\","
fi
if [ "$instance" != "" ]; then
    echo "    instance = \"$instance\","
fi
if [ "$role" != "" ]; then
    echo "    role = \"$role\","
fi
if [ "$name" != "" ]; then
    echo "    name = \"$name\","
fi
echo "    transient_mode = \"normal\",  -- current off"
echo "--    target = \"XXX\"",
echo "--    max_size = w,h,"
echo "--    aspect = w,h,"
echo "    switchto = true,"
echo "    transparent = false,"
echo "    acrobatic = false,"
echo "    ignore_resizeinc = false,"
echo "    fullscreen = false,"
echo "    ignore_cfgrq = false,"
echo "    transients_at_top = false"
echo "}"
) >> $ktmp || abort

$editor $ktmp || abort

diff $ktmp $kludges > /dev/null
if [ $? -ne 0 ]; then
    cp $kludges $kludges.wpbak
    cp $ktmp $kludges
fi

rm -f $tmp*

Reply via email to