I'm facing a problem that really looks like yours : some gtk applications (e.g. meld) are slow to start over ssh, some others not (e.g. synaptic). I actually may be more precise on how slow it is :
$ echo "$TIMEFORMAT"
%R
$ time meld --version
meld 3.20.0
25.293
This is the exact same time as the other slow applications I've found (nemo, gedit).
Inspecting meld with strace, it appears that it is waiting for some event that never comes, and exists on a timeout that is exactly of 25s.
It is very likely that this problem is the same as the one that was reported here:
https://bbs.archlinux.org/viewtopic.php?id=230036
This is a dbus problem - kind of session environment that is not set over ssh. Unfortunately, I don't know how to fix this.
The only workaround I've found with meld is to launch one in background before I can use it the normal way.
Edit
Found it ! Launch dbus simply and export reported variables:
$ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2EzslkNeji,guid=c9dec1622d6575f468559f8b5d9ee0e0
DBUS_SESSION_BUS_PID=4745
Set the above and export, then:
$ time meld --version
meld 3.20.0
0.268
I'll put this in my startup script on remote and report here.
Follow-up
This is rather verbose and largely out of scope, but as I do like easy-to-try copy/paste
solutions in the posts I see, I may except that you too do. I've tested the following as a session script to feed ssh with (e.g. ssh -X my@dark-side ~/bin/session):
#!/bin/bash
LAUNCH=(
# xload
# thunderbird
dbus
konsole
)
Tmp=$(mktemp -d)
mkdir -p $Tmp
KILLS=()
WAITS=()
echo "info: starting session" >&2
app_dbus() { # # Launch dbus and remember to kill
# redirect error because of "create ~/.dbus/session-bus/"
# deal with failure by checking DBUS_SESSION_BUS_PID afterwards
dbus-launch > $Tmp/dbus.sh 2>/dev/null
. $Tmp/dbus.sh
if [ "$DBUS_SESSION_BUS_PID" ] &&
ps --no-header -o pid -p "$DBUS_SESSION_BUS_PID" \
> /dev/null 2>&1
then
export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
KILLS+=( $DBUS_SESSION_BUS_PID )
else
echo "warning: failed dbus" >&2
fi
}
app_konsole() { # # Launch konsole and remember to wait for
konsole &
WAITS+=( $! )
}
for APP in "${LAUNCH[@]}"
do
app_$APP
done
rm -r $Tmp # not needed anymore
wait "${WAITS[@]}"
echo "info: ending session" >&2
for ID in "${KILLS[@]}"
do
kill $ID
done