/usr/bin/fcitx-configtool is in fcitx-bin 1:4.2.9.1-6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | #!/bin/sh
#--------------------------------------
# fcitx-config
#
export TEXTDOMAIN=fcitx
if which kdialog > /dev/null 2>&1; then
message() {
kdialog --msgbox "$1"
}
error() {
kdialog --error "$1"
}
elif which zenity > /dev/null 2>&1; then
message() {
zenity --info --text="$1"
}
error() {
zenity --error --text="$1"
}
else
message() {
echo "$1"
}
error() {
echo "$1" >&2
}
fi
if type gettext > /dev/null 2>&1; then
_() {
gettext "$@"
}
else
_() {
echo "$@"
}
fi
# from xdg-open
detectDE() {
# see https://bugs.freedesktop.org/show_bug.cgi?id=34164
unset GREP_OPTIONS
if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
case "${XDG_CURRENT_DESKTOP}" in
GNOME)
DE=gnome;
;;
KDE)
DE=kde;
;;
LXDE)
DE=lxde;
;;
XFCE)
DE=xfce
esac
fi
if [ x"$DE" = x"" ]; then
# classic fallbacks
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
elif xprop -root KDE_FULL_SESSION 2> /dev/null | grep ' = \"true\"$' > /dev/null 2>&1; then DE=kde;
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
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;
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
fi
fi
if [ x"$DE" = x"" ]; then
# fallback to checking $DESKTOP_SESSION
case "$DESKTOP_SESSION" in
gnome)
DE=gnome;
;;
LXDE|Lubuntu)
DE=lxde;
;;
xfce|xfce4|'Xfce Session')
DE=xfce;
;;
esac
fi
if [ x"$DE" = x"" ]; then
# fallback to uname output for other platforms
case "$(uname 2>/dev/null)" in
Darwin)
DE=darwin;
;;
esac
fi
if [ x"$DE" = x"gnome" ]; then
# gnome-default-applications-properties is only available in GNOME 2.x
# but not in GNOME 3.x
which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3"
fi
}
run_kde() {
if xprop -root KDE_SESSION_VERSION 2>&1 | grep -q "= 5"; then
if (kcmshell5 --list 2>/dev/null | grep ^kcm_fcitx > /dev/null 2>&1); then
if [ x"$1" != x ]; then
exec kcmshell5 kcm_fcitx --args "$1"
else
exec kcmshell5 kcm_fcitx
fi
fi
fi
# not harm to also check kde4 version on kf5
if (kcmshell4 --list 2>/dev/null | grep ^kcm_fcitx > /dev/null 2>&1); then
if [ x"$1" != x ]; then
exec kcmshell4 kcm_fcitx --args "$1"
else
exec kcmshell4 kcm_fcitx
fi
fi
}
run_gtk() {
if which fcitx-config-gtk > /dev/null 2>&1; then
exec fcitx-config-gtk "$1"
fi
}
run_gtk3() {
if which fcitx-config-gtk3 > /dev/null 2>&1; then
exec fcitx-config-gtk3 "$1"
fi
}
run_xdg() {
case "$DE" in
kde)
message "$(_ "You're currently running KDE, but KCModule for fcitx couldn't be found, the package name of this KCModule is usually kcm-fcitx or kde-config-fcitx. Now it will open config file with default text editor.")"
;;
*)
message "$(_ "You're currently running Fcitx with GUI, but fcitx-configtool couldn't be found, the package name is usually fcitx-config-gtk, fcitx-config-gtk3 or fcitx-configtool. Now it will open config file with default text editor.")"
;;
esac
if command="$(which xdg-open 2>/dev/null)"; then
detect_im_addon $1
if [ x"$filename" != x ]; then
exec $command "$HOME/.config/fcitx/conf/$filename.config"
else
exec "$command" "$HOME/.config/fcitx/config"
fi
fi
}
_which_cmdline() {
cmd="$(which "$1")" || return 1
shift
echo "$cmd $*"
}
detect_im_addon() {
filename=$1
addonname=
if [ x"$filename" != x ]; then
addonname=$(fcitx-remote -m $1 2>/dev/null)
if [ "$?" != "0" ]; then
filename=
elif [ x"$addonname" != x ]; then
filename=$addonname
fi
fi
if [ ! -f "$HOME/.config/fcitx/conf/$filename.config" ]; then
filename=
fi
}
run_editor() {
if command="$(_which_cmdline ${EDITOR} 2>/dev/null)" ||
command="$(_which_cmdline ${VISUAL} 2>/dev/null)"; then
detect_im_addon $1
if [ x"$filename" != x ]; then
exec $command "$HOME/.config/fcitx/conf/$filename.config"
else
exec $command "$HOME/.config/fcitx/config"
fi
fi
}
if [ ! -n "$DISPLAY" ] && [ ! -n "$WAYLAND_DISPLAY" ]; then
run_editor "$1"
echo 'Please run it under X, or set $EDITOR or $VISUAL' >&2
exit 0
fi
detectDE
# even if we are not on KDE, we should still try kde, some wrongly
# configured kde desktop cannot be detected (usually missing xprop)
# and if kde one can work, so why not use it if gtk, gtk3 not work?
# xdg/editor is never a prefered solution
case "$DE" in
kde)
order="kde gtk3 gtk xdg editor"
;;
*)
order="gtk3 gtk kde xdg editor"
;;
esac
for cmd in $order; do
run_${cmd} "$1"
done
echo 'Cannot find a command to run.' >&2
|