Bug 588343 - Major rework of window monitoring to be application-based
The previous application monitoring code was originally designed to be based on WM_CLASS, which was then resolved on a server. We have that resolution code locally now, so instead of saving WM_CLASS data, save application IDs. Also, inside the WM we have a much better infrastructure for tracking windows. In particular, rather than polling, we can just watch for focus notification on the display, and window add/remove. Instead of polling XScreensaver, use DBus to watch org.gnome.Session which already has an idle time watch. Now there is no polling at all inside the monitor.
This commit is contained in:
parent
b1150eb147
commit
2726fdb831
@ -277,7 +277,8 @@ AppDisplay.prototype = {
|
||||
},
|
||||
|
||||
_getMostUsed: function() {
|
||||
return this._appMonitor.get_most_used_apps(0, 30).map(Lang.bind(this, function (id) {
|
||||
let context = "";
|
||||
return this._appMonitor.get_most_used_apps(context, 30).map(Lang.bind(this, function (id) {
|
||||
return this._appSystem.lookup_app(id + '.desktop');
|
||||
})).filter(function (e) { return e != null });
|
||||
},
|
||||
@ -723,6 +724,9 @@ AppWell.prototype = {
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
/* hardcode here pending some design about how exactly activities behave */
|
||||
let contextId = "";
|
||||
|
||||
let arrayToObject = function(a) {
|
||||
let o = {};
|
||||
for (let i = 0; i < a.length; i++)
|
||||
@ -731,7 +735,8 @@ AppWell.prototype = {
|
||||
};
|
||||
let favoriteIds = this._appSystem.get_favorites();
|
||||
let favoriteIdsObject = arrayToObject(favoriteIds);
|
||||
let runningIds = this._appMonitor.get_running_app_ids().filter(function (e) {
|
||||
|
||||
let runningIds = this._appMonitor.get_running_app_ids(contextId).filter(function (e) {
|
||||
return !(e in favoriteIdsObject);
|
||||
});
|
||||
let favorites = this._lookupApps(favoriteIds);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,15 +40,14 @@ ShellAppMonitor* shell_app_monitor_get_default(void);
|
||||
|
||||
ShellAppInfo *shell_app_monitor_get_window_app (ShellAppMonitor *monitor, MetaWindow *metawin);
|
||||
|
||||
/* Get the most popular applications for a given activity */
|
||||
GSList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
|
||||
int activity,
|
||||
gint number);
|
||||
GList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
|
||||
const char *context,
|
||||
gint number);
|
||||
|
||||
GSList *shell_app_monitor_get_windows_for_app (ShellAppMonitor *monitor, const char *appid);
|
||||
|
||||
/* Get whatever's running right now */
|
||||
GList *shell_app_monitor_get_running_app_ids (ShellAppMonitor *monitor);
|
||||
GSList *shell_app_monitor_get_running_app_ids (ShellAppMonitor *monitor, const char *context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user