samuraix.appl

class samuraix.appl.App(synchronous_check=False, replace_existing_wm=False)

The samurai-x application object is the central point of the window manager. There is only one instance of App in one samurai-x process and it handles the connection to the X server, the event loop and the plugin loading process.

Every builtin samurai-x object should have an app member you can access.

Events:

on_load_config(config)
Dispatched when the configuration is loaded. Theoretically, that can happen multiple times in one run, and plugins should reload their config when receiving it.
on_new_screen(screen)
Dispatched when a screen was discovered. That only happens in the initialization phase of samurai-x2, and most likely there will only be one screen.
on_ready(app)
Dispatched when all initialization is done (i.e. after having dispatched on_new_screen()), but before any clients are managed.

Members:

get_screen_by_root(root)
return the Screen instance for the given root window root or None if there is no screen found.
init()

This method establishes a connection to the X server and turns on the synchronous checks if self.synchronous_check is True (that means that you get X exceptions synchronously). The rest:

  • It loads all plugins and checks if there is a plugin providing the required ‘desktop’ key.
  • It gets all screens, creates Screen instances and dispatches the ‘on_new_screen’ on self.
  • It configures signal handlers for SIGINT, SIGTERM, SIGHUP (all these signals will gracefully shut down samurai-x)
  • It calls self.reload_config() that initially loads the config and dispatches ‘on_load_config’
  • It dispatches ‘on_ready’
  • It calls scan on each Screen to make it scan for children.
Todo:allow the user to specify the X connection string. Maybe he wants to connect to a foreign display without changing the DISPLAY environment variable?
on_property_notify(ev)
Event handler for the property notify event. That just writes a message to the log for now.
reload_config()

(Re)load the config and dispatch the ‘on_load_config’ event with the new configuration as the first argument. All plugins should reload their configuration variables when receiving that, although we have to think a bit about the way we want to realize that :)

Todo:config is not really re-loaded yet. That should really be fixed.
stop(*args)
Stop samurai-x. Call unmanage_all on each screen and set self.running to False. This method takes no arguments. *args is just here that we can use stop directly as signal handler.

samurai-x

Previous topic

samurai-x2 api documentation

Next topic

samuraix.base

This Page