Notices


Reply
Thread Tools
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, 304 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:
TMavica's Avatar
Posts: 2,021 | Thanked: 1,060 times | Joined on Apr 2010 @ Hong Kong
#2
MSCIM is extremely eat battery as i know also, I uninstalled it long time.
I tried install again now see whether yours can improve or not
thx!
 
eefo's Avatar
Posts: 1,444 | Thanked: 461 times | Joined on Dec 2010 @ pakistan
#3
screenshots please!
 
Posts: 47 | Thanked: 27 times | Joined on Apr 2011
#4
@Xagoln
Thank you for the nice work. I just made a quick test - the "Conversation" seems to be unstable (application no response) after I disabled MSCIM. I tried this for 4 times (reboot + activate Conversation) and observed the same symptom. Any clue to fix this ?? Thanks,
 
Posts: 262 | Thanked: 315 times | Joined on Jun 2010
#5
Screenshots moved to post #1

Last edited by Xagoln; 2011-05-11 at 18:24.
 
Posts: 262 | Thanked: 315 times | Joined on Jun 2010
#6
Originally Posted by shawwawa View Post
@Xagoln
Thank you for the nice work. I just made a quick test - the "Conversation" seems to be unstable (application no response) after I disabled MSCIM. I tried this for 4 times (reboot + activate Conversation) and observed the same symptom. Any clue to fix this ?? Thanks,
I found conversations to be a little unstable after switching to Hildon input. I killed 'rtcom-messaging-ui' and waited about 20 seconds for it to restart, and all was well.

Is your MSCIM disabled after reboot? And what do you get if you run this (please copy and paste output):

Code:
ps -ef | grep scim
and...


Code:
ls -l /etc/gtk-2.0
 
Posts: 69 | Thanked: 18 times | Joined on Apr 2010
#7
This is awesome news. Exactly what I've been waiting for for the past few month! will definitely test when i get home.
 
Posts: 47 | Thanked: 27 times | Joined on Apr 2011
#8
@Xagoln
Sorry for the late response.
yes, I disabled MSCIM after reboot. Below are the output of code run after MSCIM disabled. FYI & thanks,

Nokia-N900:~# ps -ef | grep scim
1674 user 13976 S /usr/lib/scim-1.0/scim-launcher -d -c simple -e all -
1689 user 27560 T /usr/lib/scim-1.0/scim-panel-gtk --display :0.0 -c so
1871 root 2092 S grep scim
Nokia-N900:~# ls -l /etc/gtk-2.0
-rw-r--r-- 1 root root 3084 Sep 10 2010 gdk-pixbuf.loaders
-rw-r--r-- 1 root root 767 May 5 08:46 gtk.immodules
-rw-rw-rw- 1 user root 158 May 11 22:54 gtk.immodules_mscim_off
-rw-rw-rw- 1 user root 105 May 11 22:54 gtk.immodules_mscim_on
-rw-r--r-- 1 root root 565 Jun 9 2010 im-multipress.conf
 
Posts: 262 | Thanked: 315 times | Joined on Jun 2010
#9
@shawwawa

Thanks for that Shawwawa. I had omitted to grant sudoers permissions for creating the symlinks required for MSCIM Switcher to actually work! They only allow the precise operation required, as you'll see if you install the latest package from post #1 and check /etc/sudoers.d/mscimswitcherstatus.sudoers

Please upgrade and re-test!
 

The Following 2 Users Say Thank You to Xagoln For This Useful Post:
Posts: 47 | Thanked: 27 times | Joined on Apr 2011
#10
Originally Posted by Xagoln View Post
@shawwawa

Thanks for that Shawwawa. I had omitted to grant sudoers permissions for creating the symlinks required for MSCIM Switcher to actually work! They only allow the precise operation required, as you'll see if you install the latest package from post #1 and check /etc/sudoers.d/mscimswitcherstatus.sudoers

Please upgrade and re-test!
@Xagoln,
Thank you very much for your help. I'll update and test it ASAP.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:22.