forked from emasab/shelltile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspace.js
More file actions
53 lines (42 loc) · 1.33 KB
/
workspace.js
File metadata and controls
53 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const Mainloop = imports.mainloop;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Main = imports.ui.main;
const Extension = imports.misc.extensionUtils.getCurrentExtension();
const Log = Extension.imports.logger.Logger.getLogger("ShellTile");
function Workspace() {
this._init.apply(this, arguments)
}
Workspace.prototype = {
_init : function(meta_workspace, ext, strategy) {
this._shellwm = global.window_manager;
this.log = Log.getLogger("Workspace");
this.meta_workspace = meta_workspace;
this.extension = ext;
this.strategy = strategy
this.meta_windows().map(Lang.bind(this, function(win) { this.extension.on_window_create(null, win); }));
},
_disable: function() {
var self = this;
this.extension.disconnect_tracked_signals(this);
this.meta_workspace = null;
this.extension = null;
},
id: function(){
return this.meta_workspace.toString();
},
toString: function() {
return "<# Workspace at idx " + this.meta_workspace.index() + ">";
},
meta_windows: function() {
var self = this;
var wins = global.get_window_actors().map(function (act) {
return act.meta_window;
});
wins = wins.filter(function (win) {
return win.get_workspace() === self.meta_workspace;
});
wins = global.display.sort_windows_by_stacking(wins);
return wins;
}
}