Overcome the ibus daemon autostart after installing Zoom

After installing the Zoom app I found it quite annoying to have that small applet in the systray bar just after each restart, And even more annoying I haven’t been able to find a clear method to stop the autoloading of the related daemon as I would do for whatever else SystemD daemon.

What’s IBus

As a Linux user, I do like to have a certain control over what my machine is running so the main question is if we need not to have IBus loading at each restart placing its icon in the bar and loading its services in memory.

IBus stands for Intelligent Input Bus, and quoting the Wikipedia page:

…is an input method (IM) framework for multilingual input in Unix-like operating systems. The name “Bus” comes from its bus-like architecture.

So now we know that it is built on top of D-Bus and allows to switch among different keyboard layouts to insert different characters.

Unwanted installation

In a desktop environment like KDE, this kind of service is not required, but those in the need to install an application like Zoom experienced its presence as a dependency.

Unfortunately, once installed, the only way to shut this application down is manually exiting it using the menu in the systray icon, a solution that results pretty boring after a while.

As a plus some applications, like Yakuake or Telegram Desktop, stop to work correctly and must be restarted.

Investigating the files in the package there is a /etc/xdg/autostart/ibus-autostart.desktop file that seems to be responsible for the autostart.

The bad news is that brutally renaming it doesn’t do the trick!

Problem analysis

Reading the file list there is another interesting item: /usr/bin/ibus-autostart, a quick look at the file command reveals that’s a shell script,

$ file /usr/bin/ibus-autostart 
/usr/bin/ibus-autostart: POSIX shell script, ASCII text executable

Opening it, I noticed a section that might come in help:

# GNOME starts ibus by itself
case "$WINDOWMANAGER" in
    *gnome*)
        exit 0;;
esac

It seems that the autostart script, once launched, automatically exits when the windows manager is Gnome, thus we only need to add our window manager beside it.

The brute fix

We can prevent the start of the Plasma window manager from changing the previous part as:

# GNOME starts ibus by itself
case "$WINDOWMANAGER" in
    *gnome*|*startplasma*)
        exit 0;;
esac

or whatever window manager:

case "$WINDOWMANAGER" in
    *gnome*|$WINDOWMANAGER)
        exit 0;;
esac

If you are not sure about your Window Manager, just print the $WINDOWMANAGER variable in your terminal emulator:

$ echo $WINDOWMANAGER

Applying the change within the file and restarting the system confirms that the problem is solved!

Let’s patch

Of course, every time the package is updated the changes get lost, and must apply again the fixes.

First of all, let’s mechanize the patch by creating a… patch file.

To do that we need the original file first, we can get a copy of the original file directly from the OBS repository, or download it with zypper:

$ zypper download ibus

Then extract the file from the RPM archive:

$ rpm2cpio ibus.rpm | cpio -id

Imagining to have a copy of that file in the current folder, and that’s already fixed, while under the /usr/bin path there is the original, to create the patch we can use the diff command:

diff -u <original_file> <modified_file>
$ diff -u /usr/bin/ibus-autostart ibus-autostart > plasma-autostart.patch

Of course, if you brutally applied the changes within the installed file, must swap the order of the original and modified files:

$ diff -u ibus-autostart /usr/bin/ibus-autostart > plasma-autostart.patch

Opening the file with our text editor we get a similar code:

--- /usr/bin/ibus-autostart	2023-12-01 09:09:33.496385280 +0100
+++ ibus-autostart	2023-06-03 11:54:18.000000000 +0200
@@ -4,7 +4,7 @@
 
 # GNOME starts ibus by itself
 case "$WINDOWMANAGER" in
-    *gnome*)
+    *gnome*|*startplasma*)
         exit 0;;
 esac

Changing the header with:

--- /usr/bin/ibus-autostart	2023-12-01 09:09:33.496385280 +0100
+++ /usr/bin/ibus-autostart	2023-06-03 11:54:18.000000000 +0200

We can now use the patch command to apply the changes every time we need to:

$ sudo patch < plasma-autostart.patch

Repackage everything

Of course, we could manually apply the patch every time the package is reinstalled, as long as the file doesn’t change it will work, and also, being a marginal script for sure it will have a long life.

Even better we might also take advantage of the OBS infrastructure and rebuild the package ourselves.

There are two ways:

  • download everything, and repack with the patch changing the spec file to apply it;
  • link to the original package and apply the patch.

The difference is that formerly we will be responsible for keeping it updated, with the second option we can just upload and forget, every time the original package is updated it will be also rebuilt in our repository.

I decided to proceed with the second way.

I assume that you have an account in the OBS service and, unlike me, you already read the osc wiki to install and configure the application to handle your build service repo from the command line.

The first step is to go under your project folder which for me is ~/Documents/OSC/home:FabioMux and create a package with the same or a slightly different name:

$ cd ~/Documents/OSC/home:FabioMux

$ osc mkpac ibus

Here must create a _link file and edit it with our favorite text editor:

$ cd ibus

$ touch _link

$ vi _link

To simply link a package from another repo we must insert the XML-like string:

<link project="PROJECT_NAME" package="PACKAGE_NAME" />

Then we proceed to replace the uppercase strings:

PROJECT_NAME
This is the name of the project, or let’s say the main repo, where we borrow the package from, in our case it is openSUSE:Leap:15.5.
PACKAGE_NAME
The name of the package is exactly as it is stated in the original repository, in our case ibus.

Looking at the OBS repository we notice that our target file is within the main folder and will be there when included within the package.

So after moving the patch under the folder, we must change the header again removing any absolute path.

and apply the patch in the _link file introducing the patches and apply tags:

<link project="openSUSE:Leap:15.5" package="ibus">
  <patches>
    <apply name="plasma-autostart.patch" />
  </patches>
</link>

Everything is now ready to be sent to the OBS server!

What we have to do is send everything to the server:

$ osc add *

$ osc commit -m "First commit."

Switch to the new vendor

As the last step, we must tell our distro that we want to change the repository where the ibus package is picked, that operation is known as Vendor change.

We can use the Yast interface or zypper command for that:

$ sudo zypper install --from-repo REPO_NUMBER ibus

Of course must replace the REPO_NUMBER with the one associated with our custom repository, just use zypper again to discover it:

$ zypper lr

Final thoughts

Zoom isn’t the kind of application I use for my daily tasks, but when I do it is there, meanwhile that annoying behavior of one of its dependencies has been fixed permanently and with the help of the openSUSE tools it has been even more easier.


Creative Commons License This work is licensed under a Creative Commons Attribution-NoCommercial-ShareAlike 4.0 International License


Leave a Comment