10
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
11
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
12
elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
13
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
19
command=`which kcmshell4 2>&1`
22
checkinstalled=`$command --list | grep -c kcm_fcitx`
23
if [ "x$checkinstalled" != "x0" ]; then
28
if [ $haskde = "1" ]; then
29
if [ x"$1" != x ]; then
30
exec $command kcm_fcitx --args $1
32
exec $command kcm_fcitx
41
command=`which fcitx-config-gtk 2>&1`
51
command=`which fcitx-config-gtk3 2>&1`
61
command=`which xdg-open`
63
if [ x"$1" != x ]; then
64
exec $command "$HOME/.config/fcitx/conf/$1.config"
9
# see https://bugs.freedesktop.org/show_bug.cgi?id=34164
12
if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
13
case "${XDG_CURRENT_DESKTOP}" in
28
if [ x"$DE" = x"" ]; then
30
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
31
elif xprop -root KDE_FULL_SESSION 2> /dev/null | grep ' = \"true\"$' > /dev/null 2>&1; then DE=kde;
32
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
33
elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
34
elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
35
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
36
elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
40
if [ x"$DE" = x"" ]; then
41
# fallback to checking $DESKTOP_SESSION
42
case "$DESKTOP_SESSION" in
49
xfce|xfce4|'Xfce Session')
55
if [ x"$DE" = x"" ]; then
56
# fallback to uname output for other platforms
57
case "$(uname 2>/dev/null)" in
64
if [ x"$DE" = x"gnome" ]; then
65
# gnome-default-applications-properties is only available in GNOME 2.x
66
# but not in GNOME 3.x
67
which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3"
72
if (kcmshell4 --list 2>/dev/null | grep ^kcm_fcitx &>/dev/null); then
73
if [ x"$1" != x ]; then
74
exec kcmshell4 kcm_fcitx --args "$1"
76
exec kcmshell4 kcm_fcitx
82
if which fcitx-config-gtk &>/dev/null; then
83
exec fcitx-config-gtk "$1"
88
if which fcitx-config-gtk3 &>/dev/null; then
89
exec fcitx-config-gtk3 "$1"
94
if command="$(which xdg-open 2>/dev/null)"; then
96
if [ x"$filename" != x ]; then
97
exec $command "$HOME/.config/fcitx/conf/$filename.config"
99
exec "$command" "$HOME/.config/fcitx/config"
105
cmd="$(which "$1")" || return 1
113
if [ x"$filename" != x ]; then
114
addonname=$(fcitx-remote -m $1 2>/dev/null)
115
if [ "$?" != "0" ]; then
117
elif [ x"$addonname" != x ]; then
122
if [ ! -f "$HOME/.config/fcitx/conf/$filename.config" ]; then
128
if command="$(_which_cmdline ${EDITOR} 2>/dev/null)" ||
129
command="$(_which_cmdline ${VISUAL} 2>/dev/null)"; then
131
if [ x"$filename" != x ]; then
132
exec $command "$HOME/.config/fcitx/conf/$filename.config"
66
134
exec $command "$HOME/.config/fcitx/config"
73
if [ ! -n "$DISPLAY" ]; then
74
[ -n "$EDITOR" ] && which $EDITOR > /dev/null 2>&1 && exec $EDITOR $HOME/.config/fcitx/config
75
[ -n "$VISUAL" ] && which $VISUAL > /dev/null 2>&1 && exec $VISUAL $HOME/.config/fcitx/config
76
echo 'Please run it under X, or set $EDITOR or $VISUAL'
139
if [ ! -n "$DISPLAY" ] && [ ! -n "$WAYLAND_DISPLAY" ]; then
141
echo 'Please run it under X, or set $EDITOR or $VISUAL' >&2
147
# even if we are not on KDE, we should still try kde, some wrongly
148
# configured kde desktop cannot be detected (usually missing xprop)
149
# and if kde one can work, so why not use it if gtk, gtk3 not work?
150
# xdg/editor is never a prefered solution
153
order="kde gtk3 gtk xdg editor"
156
order="gtk3 gtk kde xdg editor"
160
for cmd in $order; do
164
echo 'Cannot find a command to run.' >&2