#!/bin/bash
# Avoid trouble with maximize/minimize within KDE (bug #345669)
#  -> under KWin emacs does not maximize in the correct way if
#     GTK/GDK is used as toolkit.  After click on the maximize
#     button emacs shrinks to fit to the current font which
#     destroys the maximize state in KWin.
# Avoid trouble with "iconic" state information (bug #342385)
#  ->  under KWin emacs with GTK/GDK toolkit does not hold its
#      "iconic" state if a desktop state is saved before logout
#      and restored after login.
toolkit=gtk
KDE_FULL_SESSION=$(xprop -root KDE_FULL_SESSION 2>/dev/null)
case "$KDE_FULL_SESSION" in
*true*) toolkit=x11
esac
exec -a ${0} ${0}-${toolkit} ${1+"$@"}
