-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyWorkspaceSwitcher.js
167 lines (157 loc) · 9.83 KB
/
myWorkspaceSwitcher.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/* ========================================================================================================
* dockedWorkspaces.js - dock object that holds the workspaces thumbnailsBox
* --------------------------------------------------------------------------------------------------------
* CREDITS: This code was copied from the Frippery Bottom Panel extension http://frippery.org/extensions/
* and modified to create a workspaces switcher popup. Copyright (C) 2011-2015 R M Yorston.
*
* Part of this code also comes from gnome-shell-extensions:
* http://git.gnome.org/browse/gnome-shell-extensions/
* ========================================================================================================
*/
const { Clutter, GLib, GObject, Meta, St, Shell } = imports.gi;
const Lang = imports.lang;
const Main = imports.ui.main;
const WorkspacesView = imports.ui.workspacesView;
const WindowManager = imports.ui.windowManager;
const Tweener = imports.ui.tweener;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
let nrows = 1;
var WorkspaceSwitcher = class WorkspacesToDock_WorkspaceSwitcher {
constructor(params) {
this._resetBindings();
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, nrows, -1);
}
destroy() {
this._resetBindings();
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, -1, 1);
}
_resetBindings() {
// Reset bindings to active showWorkspaceSwitcher function
let wm = Main.wm;
wm.setCustomKeybindingHandler('switch-to-workspace-left',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-right',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-up',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-down',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-last',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-left',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-right',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-up',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-down',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-1',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-2',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-3',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-4',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-5',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-6',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-7',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-8',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-9',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-10',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-11',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('switch-to-workspace-12',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-1',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-2',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-3',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-4',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-5',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-6',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-7',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-8',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-9',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-10',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-11',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-12',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm.setCustomKeybindingHandler('move-to-workspace-last',
Shell.ActionMode.NORMAL,
wm._showWorkspaceSwitcher.bind(wm));
wm._workspaceSwitcherPopup = null;
}
};