How to bring up OSK in script?

I cannot seem to get squeekboard to come up in a script. For example, in a script that starts a gui app and then brings up keyboard. Among other things, I’ve tried this:

<start gui> &
/usr/bin/squeekboard

any suggestions?

I am getting

$ /usr/bin/squeekboard

** (squeekboard:9281): WARNING **: 22:48:34.126: DBus unavailable, unclear how to continue. Is Squeekboard already running?

So although I am not super informed about this, a guess without knowledge is making me think that squeekboard is always running regardless of whether OSK is onscreen or not.

I tried killing squeekboard by doing ps aux | grep squeekboard to get the pid, and then kill 1160 which happened to be the pid for me. The OSK disappeared then immediately reappeared. Previously this process was running on my device since Jan 14 according to that ps command, but now I have a new squeekboard running with a new pid.

So it seems that surely this process auto launches itself whenever it is not running.

My curiosity about this led me to want to use the Librem 5’s superpower, which is to say, reading its code. Sitting in bed on my Librem 5 itself, I cloned down the repo for phosh and squeekboard and surfed around, which led me to some internet search which led me to the following terminal command that seems to spawn the OSK on my Librem 5 whenever it is not visible:

busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true

So for example, if I use the following terminal command then visually hide my squeekboard, after 10 second the command ends and the OSK automatically appears onscreen:

sleep 10 && busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true

But I don’t know if this is solving your original problem because I am using the dbus to communicate with the active squeekboard, but not actually solving the problem of ending or starting the squeekboard process.

Edit: Source:

4 Likes