r/nintype•
supermamon

[Tutorial] How to Force restart Nintype with Activator and ChooseBoard (for Jailbroken devices)

tl;dr at the end of the post.

First up, it started with this thread.

Long before that post, was looking at some processes on my device using CocoaTop and saw the NinType process -- com.jormy.nintype.NinKeyboard. Then I thought, I should be possible to terminate the NinType process using Activator if it hangs. I just have to start NinType again then. So I SSH into my device and with some experimenting, I was able to terminate the process with this command:

killall -9 NinKeyboard

So, I setup a custom command in Activator which killed NinType whenever I toggle the mute switch twice. So whenever I NinType hangs, I kill it, the keyboard switches to default, then I just switch it back to NinType. That worked well enough.

Then I read that thread where u/t0dk0n has a Launcher shortcut to the keyboard settings. With some comments on wanting a Flipswitch, I shared my method. But I immediately thought of having additional automation of re-launching NinType.

I remembered there was a tweak that allows you to switch keyboards using Activator -- ChooseBoard. I installed it and then immediately looked for the new listeners:

activator listeners | egrep "choose"

So, I got:

net.douglassoares.chooseboard.change-autocorrection
net.douglassoares.chooseboard.change-mode
net.douglassoares.chooseboard.change-keyboard

And there it was -- net.douglassoares.chooseboard.change-keyboard. So, instead of modifying the command in Activator, I opted to create and bash script and call it with Activator. Here is the first version:

file: ~/bin/restart-nin.sh

#!/bin/bash
killall -9 NinKeyboard
sleep 2
activator send net.douglassoares.chooseboard.change-keyboard

With a comment from u/Secretss, I figured this will only work well if you only have 2 keyboards. With a little exploring, I found out that ChooseBoard also creates activator listeners for specific Keyboards. I'm of course interested with Nintype. So I ssh into my device again and went searching for the nintype listener:

activator listeners | egrep "nin' 

which gives me:

com.jormy.nintype.NinKeyboard
com.jormy.nintype

With that, I've assumed that com.jormy.nintype.NinKeyboard is the listener for the keyboard. So I opened up spotlight, switched to the default keyboard then then fired up this command:

activator send com.jormy.nintype.NinKeyboard

Sure enough, the keyboard switched to NinType. I added another keyboard (Emoji) to test it and yes, it did switched to NinType. So I've updated my script:

#!/bin/bash
killall -9 NinKeyboard
sleep 2
activator send com.jormy.nintype.NinKeyboard

Profit!

In case you're interested on how's my ChooseBoard settings are:

  • Default Keyboard : Disabled
  • Activator Action : Did not set any
  • Mode : did not set any
  • Keyboard : English (US) (enabled), NinKeyboard (enabled), Emoji (disabled)
  • Globe Icon : System Default

The reason I disabled Emoji is because I want to be able to cycle from just English (US) & NinType by pressing the globe button and only switch to Emoji by holding it.


tl;dr : Automatically kill and re-launch NinType with this command:

killall -9 NinKeyboard ; sleep 2 && activator send com.jormy.nintype.NinKeyboard

Requires: ChooseBoard

Posted Sep 14, 2015, 12:37 PM UTC

1626
Loading comments…