7
7
const Shell = imports.gi.Shell;
9
9
const AltTab = imports.ui.altTab;
10
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
10
11
const Main = imports.ui.main;
11
12
const Tweener = imports.ui.tweener;
43
44
shellwm.takeover_keybinding('switch_windows');
44
45
shellwm.connect('keybinding::switch_windows', Lang.bind(this, this._startAppSwitcher));
47
this._workspaceSwitcherPopup = null;
48
shellwm.takeover_keybinding('switch_to_workspace_left');
49
shellwm.takeover_keybinding('switch_to_workspace_right');
50
shellwm.takeover_keybinding('switch_to_workspace_up');
51
shellwm.takeover_keybinding('switch_to_workspace_down');
52
shellwm.connect('keybinding::switch_to_workspace_left', Lang.bind(this, this._showWorkspaceSwitcher));
53
shellwm.connect('keybinding::switch_to_workspace_right', Lang.bind(this, this._showWorkspaceSwitcher));
54
shellwm.connect('keybinding::switch_to_workspace_up', Lang.bind(this, this._showWorkspaceSwitcher));
55
shellwm.connect('keybinding::switch_to_workspace_down', Lang.bind(this, this._showWorkspaceSwitcher));
47
59
_shouldAnimate : function(actor) {
74
86
* maybe TODO: get icon geometry passed through and move the window towards it?
76
88
this._minimizing.push(actor);
90
let primary = global.get_primary_monitor();
77
92
Tweener.addTween(actor,
80
97
time: WINDOW_ANIMATION_TIME,
81
98
transition: "easeOutQuad",
82
99
onComplete: this._minimizeWindowDone,
274
291
_startAppSwitcher : function(shellwm, binding, window, backwards) {
292
/* prevent a corner case where both popups show up at once */
293
if (this._workspaceSwitcherPopup != null)
294
this._workspaceSwitcherPopup.actor.hide();
275
296
let tabPopup = new AltTab.AltTabPopup();
277
298
if (!tabPopup.show(backwards))
278
299
tabPopup.destroy();
302
_showWorkspaceSwitcher : function(shellwm, binding, window, backwards) {
303
/* We don't support this kind of layout */
304
if (binding == "switch_to_workspace_up" || binding == "switch_to_workspace_down")
307
if (global.screen.n_workspaces == 1)
310
if (this._workspaceSwitcherPopup == null)
311
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
313
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
315
if (binding == "switch_to_workspace_left") {
316
if (activeWorkspaceIndex > 0) {
317
global.screen.get_workspace_by_index(activeWorkspaceIndex - 1).activate(global.get_current_time());
318
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.LEFT, activeWorkspaceIndex - 1);
321
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.LEFT, activeWorkspaceIndex);
324
if (binding == "switch_to_workspace_right") {
325
if (activeWorkspaceIndex < global.screen.n_workspaces - 1) {
326
global.screen.get_workspace_by_index(activeWorkspaceIndex + 1).activate(global.get_current_time());
327
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.RIGHT, activeWorkspaceIndex + 1);
330
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.RIGHT, activeWorkspaceIndex);