From cd8cf45d0c8907a565968530377b0abf4d6fd1f2 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Thu, 29 Mar 2018 13:53:07 +0200 Subject: [PATCH 1/2] Add missing stage packages and copy ibus socket files to enable ibus for GTK3 applications out-of-the-box. --- gtk/launcher-specific | 7 +++++-- snapcraft.yaml | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk/launcher-specific b/gtk/launcher-specific index a753e4a..1002b97 100644 --- a/gtk/launcher-specific +++ b/gtk/launcher-specific @@ -12,8 +12,6 @@ else fi # ibus and fcitx integration -# with those definitions fcitx works unconfined out of the box, ibus requires -# user config to be copied though, https://launchpad.net/bugs/1580463 GTK_IM_MODULE_DIR=$XDG_CACHE_HOME/immodules export GTK_IM_MODULE_FILE=$GTK_IM_MODULE_DIR/immodules.cache if [ $needs_update = true ]; then @@ -27,4 +25,9 @@ if [ $needs_update = true ]; then $RUNTIME/usr/lib/$ARCH/libgtk2.0-0/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE fi fi +# copy socket files for ibus to look them up +# (see comments #3 and #6 on https://launchpad.net/bugs/1580463) +IBUS_SOCKET_PATH=$XDG_CONFIG_HOME/ibus/bus +mkdir -p $IBUS_SOCKET_PATH +cp $REALHOME/.config/ibus/bus/* $IBUS_SOCKET_PATH/ diff --git a/snapcraft.yaml b/snapcraft.yaml index 59b2a29..780621e 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -99,6 +99,8 @@ parts: - libappindicator3-1 - locales-all - xdg-user-dirs + - ibus-gtk3 + - libibus-1.0-5 qt4: source: . source-subdir: qt From 5a0be4e8d55bcb8110faf11c21d1b3c8ed00bef9 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Thu, 29 Mar 2018 15:52:59 +0200 Subject: [PATCH 2/2] Create a symlink to the socket path instead of copying the socket files, in case the bus address changes in a session. --- gtk/launcher-specific | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gtk/launcher-specific b/gtk/launcher-specific index 1002b97..7b8c8f1 100644 --- a/gtk/launcher-specific +++ b/gtk/launcher-specific @@ -25,9 +25,10 @@ if [ $needs_update = true ]; then $RUNTIME/usr/lib/$ARCH/libgtk2.0-0/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE fi fi -# copy socket files for ibus to look them up +# create symbolic link to ibus socket path for ibus to look up its socket files # (see comments #3 and #6 on https://launchpad.net/bugs/1580463) -IBUS_SOCKET_PATH=$XDG_CONFIG_HOME/ibus/bus -mkdir -p $IBUS_SOCKET_PATH -cp $REALHOME/.config/ibus/bus/* $IBUS_SOCKET_PATH/ +IBUS_CONFIG_PATH=$XDG_CONFIG_HOME/ibus +mkdir -p $IBUS_CONFIG_PATH +[ -d $IBUS_CONFIG_PATH/bus ] && rm -rf $IBUS_CONFIG_PATH/bus +ln -sfn $REALHOME/.config/ibus/bus $IBUS_CONFIG_PATH