Startup script not working

I have a startup script:

ibus-on-boot.sh

#!/bin/sh

ibus-daemon -drx

It’s simply supposed to start the ibus-daemon on boot. But it doesn’t work. The same command, when invoked manually, works properly.

It sounds like that daemon depends on another. You can very easily express this kind of dependency when you create a systemd service script. You could maybe try that.

I’m not sure how to do that.

I can’t really give you a point by point tutorial, but you can take a look at any of the .service files that your system already has, which give you an idea on how the files are structured. They are really not complicated.

Alternatively, there are good tutorials explaining the basics of service descriptions for systemd.

1 Like

Okay, so I created this systemd service file. After a little bit of debugging (had to change the type from simple to forking), it seems to work.

ibus-daemon.service

# this is a systemd service file for automatically starting ibus-daemon at boot

# copy this file to ~/.config/systemd/user/ and execute
# systemctl enable --now --user ibus-daemon.service

[Unit]
Description=IBus Daemon
Documentation=man:ibus-daemon(1)
Conflicts=fcitx.service

[Service]
Type=forking
ExecStart=/usr/bin/ibus-daemon -drx
ExecReload=/usr/bin/ibus restart
ExecStop=/usr/bin/ibus exit
Environment=GTK_IM_MODULE=ibus
Environment=XMODIFIERS="@im=ibus"
Environment=QT_IM_MODULE=ibus

[Install]
WantedBy=default.target

Update: The systemd service method wasn’t working reliably. The process ibus-daemon was starting but the keyboard shortcut weren’t working. Setting the script below as a startup script turned out to be much more reliable. The sleep is required for the shortcuts to work. (I think otherwise the ibus-daemon process starts before the plasma-desktop related processes have fully started. Maybe 10 is too much, but it doesn’t really matter.)

#!/bin/sh

# this is a script to start the ibus-daemon on startup
# set it up to run automatically on startup somehow

export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
sleep 10
ibus-daemon -drxR
2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.