GNOME Autostart

From wiki.gpii
Jump to: navigation, search


A question that came up at one of the weekly architecture meetings was whether GPII could ever launch a screen reader other than Orca on Linux/GNOME.

The way one starts/stops Orca is by changing the screen-reader-enabled system setting to "true" or "false", respectively. Notice that there is nothing in the setting that indicates which actual screen reader is launched.

That led to an inquiry into how Orca itself is launched -- what causes Orca to start when the user flips a switch in some settings dialog? While it's relatively easy to determine how Orca reacts when screen-reader-enabled is set to false, it turned out that starting Orca from scratch is, well, complicated. The following is a summary of what happens, and what that implies for changing the actual screen reader you get.

How It Works

  1. gnome-session-manager (gsm) starts up when the user logs in.
  2. gsm launches a number of "autostart" apps.
    • autostart apps are listed in an autostart directory; there is one file containing information about a each app.
    • the file can contain an autolaunch condition, meaning launch only if the condition holds.
      • there is an autolaunch file for Orca.
      • it has the condition "launch only if screen-reader-enabled equals true".
  3. gsm keeps a store of the autostart apps; or, put another way: gsm keeps a store of the information in the files in the autostart directory.
  4. for each app, track its autostart condition using a callback function to invoke if the condition changes.
    • app connects to the "condition changed" signal.
    • the callback is gsm.app_condition_changed().
  5. sometime later, if the gsetting screen-reader-enabled is switched from false to true:
    1. the app hears the switch due to the condition change and calls gsm.app_condition_changed().
    2. if the app is not running (assume it isn't), call gsm.start_app_or_warn().
      • In Orca's case, this ultimately leads to launching the actual Orca process.

The key is step 4. The change to screen-reader-enabled is linked via a condition-changed signal to the Orca autostart app.

The other direction is much simpler. If Orca is running, it itself is listening to the screen-reader-enabled system setting. If that is switched from true to false, Orca responds by shutting itself off gracefully exiting the Orca process.

The question that started all of this was, in theory, how can a user start a screen reader other than Orca on Linux/GNOME? It could be done if:

  • Orca's autostart file is replaced with another autostart file that reference another screen reader application, with the same autolaunch condition.
  • (perhaps obvious) the alternate screen reader application is installed on the system.

Also, in theory there could be multiple screen reader autostart files, but that would lead to multiple screen reader's running when the screen-reader-enabled system setting changes.

Note that the same logic applies to the Caribou onscreen keyboard. It has an autolaunch app that is keyed to the onscreen-keyboard-enabled setting. However, not the GNOME Shell magnifier, since it is an actor within the GNOME Shell desktop manager's stage.

Startup Applications Preferences

There is a dialog that shows information about the autostart applications, and allows additions, removals, and limited editing. In order to open this dialog, do the following from the command line:

$ gnome-session-properties &

You won't see Orca listed in the dialog, though, because Orca's autostart file has a property "NoDisplay" set to true.

On Fedora20, the autostart files are in: /etc/xdg/autostart/.