RFE: Auto-load maps based on the app with focus

Bug #605257 reported by Joanmarie
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
WiiCan
New
Wishlist
Unassigned

Bug Description

It would be nice if Wiican could detect what application had focus and automatically load a map based on that application (if such a map existed).

I'm not sure how to accomplish this *without* using AT-SPI; but I do know that you can figure out the app with focus using AT-SPI. If you wind up having to go that route, I'd think all you'd need to do is listen for window:activate events.

For instance, try enabling AT support for your session (System->Preferences->Assitive Technologies), and then running this snippet:

~~~~~~~
#!/usr/bin/python
import pyatspi

def onWindowActivate(event):
    print "window activated %s" % event.host_application

pyatspi.Registry.registerEventListener(onWindowActivate, "window:activate")
pyatspi.Registry.start()
~~~~~~~

Tags: mapping at-spi
Changed in wiican:
importance: Undecided → Wishlist
Revision history for this message
J. Félix Ontañón (fontanon) wrote :

The script works great!

I think this feature could be included in Wiican 0.3.x series. Once wiican-0.3 be released i'll target this rfe to the next milestone.

Revision history for this message
J. Félix Ontañón (fontanon) wrote :

I have some design questions.

I wonder what it's the better way to prompt the user the need of activate at-spi and restart user session. It's always needed to restart session in order to activate at-spi? Could wiican activate at-spi avoiding the user to manually activate it?

What will be more convenient for the user?: wiican detects a new focusing app and has a mapping for that app, so

1.- Wiican ask the user "a new app with matching mapping it's focused, would you like to run the mapping?"
2.- Wiican autoswitch the new mapping for the focused app.

Think that in every mapping switch the user still need to press 1+2 wiimote buttonts in order to link the wiimote.

tags: added: at-spi mapping
Revision history for this message
Joanmarie (joanmarie-diggs-deactivatedaccount) wrote :

(is there really no 'reply' for comments, like there is in bugzilla?)

> It's always needed to restart session in order to activate at-spi?

I *think* so. In this case anyway.

> Could wiican activate at-spi avoiding the user to manually activate
> it?

I don't *think* so.

You can run an individual app in an environment in which you enabled accessibility support, even if that support is not enabled session-wide, e.g.:

    $ env GTK_MODULES=gail:atk-bridge gedit

But in this case, Wiican is not the app that needs to have AT support enabled. It's all the other apps.

As an experiment, try *disabling* AT support for the session, log out, log back in, then try the snippet. For each app you launch setting GTK_MODULES, you should see events; for each one you launch without first setting GTK_MODULES, you won't see events.

As for what would be more convenient for the user.... I think that might depend on the user and thus need to be a preference. Perhaps go with option 1 (ask the user), but add one of those 'do not show this dialog again' checkboxes.

Pressing 1+2 each time won't kill anyone, but it's kind of a drag. Why is this needed? <takes a guess> Perhaps a device could have a single mapping and that mapping could in turn have application-specific items??

Ya know, that might actually be kinda cool [she says, not having actually looked at the code to know if it would make sense. ;-)] Consider the case where there's a default mapping that works perfectly for all apps but Foo. In Foo, only one button needs to be re-mapped. It would be nice to just remap that one button and have the rest be inherited from the default map.

Revision history for this message
J. Félix Ontañón (fontanon) wrote :

I was meaning about how wiican could advice the use that AT-SPI support it's needed to be active in order to enjoy this feature.

I'll do the Accerciser way: When accerciser run it no at-spi support it's active it prompt the user that accerciser could to activate it and restart the session.

The need of press 1+2 for change mapping it's about wminput issues. I think the first not-fine-grained version of auto-load maps based on the app with focus could be:

* The mapping info.desktop file contains an Application field with mapping associated app
* The user could mark mapping (by mapping manager facilities) for attempt to auto-activate it in the case the app receives the focus
* If the app receives the focus and the mapping it's marked for auto-load the press 1+2 notification will be displayed and the fun start

This approx it's compatible with wminput. What do you think?

Revision history for this message
Joanmarie (joanmarie-diggs-deactivatedaccount) wrote :

I think that sounds like a good plan.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.