[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]] ====4.2 How to store window size/placement==== This example shows how we can save settings for window size and placement for next startup. Be also aware that this solution makes it possible to let user rescale gui smaller than the default size. Normally you define the size of, for example, a , and the user can only resize the gui larger, but when using , you don't need to define and for the tree widget. %%(language-ref) save_geometry (){ XWININFO=`xwininfo -stats -name SizeMe` HEIGHT=`echo "$XWININFO" | grep 'Height:' | awk '{print $2}'` WIDTH=`echo "$XWININFO" | grep 'Width:' | awk '{print $2}'` X1=`echo "$XWININFO" | grep 'Absolute upper-left X' | awk '{print $4}'` Y1=`echo "$XWININFO" | grep 'Absolute upper-left Y' | awk '{print $4}'` X2=`echo "$XWININFO" | grep 'Relative upper-left X' | awk '{print $4}'` Y2=`echo "$XWININFO" | grep 'Relative upper-left Y' | awk '{print $4}'` X=$(($X1-$X2)) Y=$(($Y1-$Y2)) echo "export HEIGHT=$HEIGHT" > /tmp/geometry echo "export WIDTH=$WIDTH" >> /tmp/geometry echo "export X=$X" >> /tmp/geometry echo "export Y=$Y" >> /tmp/geometry chmod 700 /tmp/geometry } export -f save_geometry [ -f /tmp/geometry ] && . /tmp/geometry export DIALOG=" save_geometry " gtkdialog --program=DIALOG --geometry +"$X"+"$Y" %% Another approach for size/placement is to make a call of your app from the cli. %%(language-ref) RIGHT=14; DOWN=36; WIDTH=80; HEIGHT=80 # define variables with defaults GUI=' ' gtkdialog -p GUI -G ${1-${WIDTH}x${HEIGHT}+${RIGHT}+${DOWN}} %% ===@@**#%[[gtkdialogDocTips4.1|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips5|Next ❱❱❱]]#%**@@=== ---- ==Categories== CategoryGtkdialog