OLD_PATH=$PATH PATH=/usr/bin:/usr/X11R6/bin:$PATH if ! type -p uim-xim > /dev/null 2>&1 ; then echo "uim-xim is not available." return 1 fi export XMODIFIERS="@im=uim" export GTK_IM_MODULE=uim export QT_IM_SWITCHER=imsw-multi export QT_IM_MODULE=uim uim-xim & case "$WINDOWMANAGER" in *gnome*) # if applet is available, no need to start additional programs here if rpm -q uim-applet-gnome > /dev/null 2>&1 ; then PATH=$OLD_PATH # success: return 0 fi;; esac # start system-tray or stand-alone tool look_for_uim_toolbar () { local p for p in $*; do if type -p "$p" > /dev/null 2>&1; then toolbar="$p" return 0 fi done } toolbar="" look_for_uim_toolbar uim-toolbar-gtk3-systray uim-toolbar-gtk-systray if [ -z "$toolbar" ]; then # no systray found, let's start a stand-alone toolbar case "$WINDOWMANAGER" in *plasma*) look_for_uim_toolbar \ uim-toolbar-qt4 uim-toolbar-qt \ uim-toolbar-gtk3 uim-toolbar-gtk;; *) look_for_uim_toolbar \ uim-toolbar-gtk3 uim-toolbar-gtk \ uim-toolbar-qt4 uim-toolbar-qt;; esac fi test -n "$toolbar" && $toolbar & unset toolbar PATH=$OLD_PATH # success: return 0