View Single Post
Posts: 262 | Thanked: 315 times | Joined on Jun 2010
#1
(N.B.: This package is now available in the extras-devel Maemo repository)

Why do I care about M/SCIM?

For those interested in communicating in or learning languages that use complex characters, particularly Chinese, Japanese and Korean, but many others too, there exist special 'input methods' for the N900. Most are based on the SCIM project (called MSCIM in its Maemo incarnation, but SCIM is also used by some), and are distributed as Maemo packages, and use a special keyboard combination to switch between normal and additional input methods.

Unfortunately M/SCIM is a known battery hog. Furthermore, installing M/SCIM would normally disable the virtual keyboard and the symbol keyboard. Not any more!

On my phone, powertop shows that its 'scim-panel-gtk' process constantly wakes up the CPU many times per second when running. My N900 went from fully charged to switching itself off in around 5 hours on standby with it running recently.

Unfortunately, the process respawns immediately if killed, and nobody seems to know how to stop it. Last night I had the idea of sending the process a SIGSTOP signal, which effectively pauses it.

I scripted it up in Ash shell, and it seemed to work, so today I've coded a status menu applet to enable and disable MSCIM this way.

For now this is very alpha. You have been warned!

Usage
  1. Bring up the status menu and click the Preferences icon, configure to your preference and then click Save.
  2. Back at the status menu, you can select either "Hildon" or "MSCIM".
  3. Depending on how you have configured the applet, When switching to Hildon the battery-hungry SCIM process may be suspended, or left running.
  4. If, and only if, you have chosen to suspend the SCIM process in the configuration, any applications started under SCIM are likely to hang until SCIM is re-enabled.
  5. Applications started while Hildon Input is active will not hang under any circumstances. However, they will not have access to SCIM input unless restarted while MSCIM is active.
  6. Conversations and IM/SMS cannot be restarted without killing a process. If configured, this applet can do that for you.
  7. In general, enabling M/SCIM again via the applet should always bring hung applications back to life.
Please see this post for instructions on how to make SCIM work best for you.

How does it work?
  1. Taking this post of this thread as inspiration, I separated the GTK IM modules as suggested, creating two new templates in /etc/gtk-2.0/, named 'gtk.immodules_mscim_off' and 'gtk.immodules_mscim_on'.
  2. My script/status menu applet symlinks the 'live' file /etc/gtk-2.0/gtk.immodules to the above file when changed
  3. When disabling M/SCIM, after symlinking to 'off', the 'scim-panel-gtk' applet is sent a SIGSTOP, effectively pausing it.
  4. When re-enabling, we symlink to 'on' and then the same process is sent a SIGCONT to wake it up.

Yes, this is all very inelegant, but I don't have time right now to see if M/SCIM can be optimised.

Possible future additions
In brainstorming, I was thinking that whenever the device goes off AC power it should warn the user and/disable M/SCIM.
Also, apart from using the device with TV out, we probably should stop M/SCIM whenever the screen is locked. Whether this can be done with a reduction in power consumption is another question.
When the keyboard slider is closed (except when bluetooth keyboard in use), would be another nice time to disable M/SCIM and allow use of the virtual keyboard.

All feedback/queries to this thread please.

Change Log for Updates/Corrections
v0.3.1
  • Translations for Chinese Traditional (zh_HK & zh_TW) included.

v0.3.0
  • Converted translations to GNU Gettext. Translations for French (fr_FR) and Chinese Simplified (zh_CN) included.

v0.2.1
  • Selected an icon that all N900 users have installed (fixed the bug with mscimswitcherstatus disappearing after upgrade)
  • Added some basic logging to help with troubleshooting

v0.2.0
  • Finally with a user-friendly configuration dialog!

v0.1.1
  • rtcom-messaging-ui now only killed if suspend of scim enabled in config.

v0.1.0
  • Lots of built-in error handling to avoid malfunctions
  • File /home/user/.config/mscimswitcherstatus/mscimswitcherstatus.conf allows you to set whether SCIM starts on boot
  • Two new options below: can only be changed by editing /usr/lib/hildon-desktop/mscimswitcher_status.py: for now
  • Can now set whether the 'scim-panel-gtk' process is suspended when switching to Hildon
  • And if suspending, whether or not to kill 'rtcom-messaging-ui'

v0.0.5
  • Removed extraneous 'kill' notification, left over from testing
  • Now depends on either the 'scim' or the 'mscim' Maemo packages

v0.0.4
  • All rtcom-messaging-ui processes are killed on each change of Input Method

v0.0.3
  • Due to the omission of a file in /etc/sudoers.d from the package, earlier versions actually did not work, as the symlinking was denied by sudo policy
  • Your /etc/gtk-2.0/gtk.immodules is backed up on install and restored on uninstall, also process 'scim-panel-gtk' is unsuspended on uninstall
  • All files ownerships and permissions restricted appropriately

v0.0.2
  • Minor update: M/SCIM will always be started after a reboot to prevent an inconsistent state arising

Screenshots
Attached Images
    
Attached Files
File Type: deb mscimswitcherstatus_0.3.1-17_armel.deb (5.9 KB, 321 views)

Last edited by Xagoln; 2011-05-21 at 02:43. Reason: Added Chinese Traditional, Chinese Simplifed & French localisations
 

The Following 20 Users Say Thank You to Xagoln For This Useful Post: