@@ -16,6 +16,7 @@ const Settings = imports.ui.settings;
16
16
const St = imports . gi . St ;
17
17
const Tweener = imports . ui . tweener ;
18
18
const Config = imports . misc . config
19
+ const ExtensionSystem = imports . ui . extensionSystem ;
19
20
20
21
let desktopscroller = null ;
21
22
@@ -42,6 +43,7 @@ DesktopScroller.prototype = {
42
43
this . settings . bindProperty ( Settings . BindingDirection . IN , "showDirectionArrow" , "showDirectionArrow" , this . onSettingsChanged , null ) ;
43
44
this . settings . bindProperty ( Settings . BindingDirection . IN , "activationAreaWidth" , "activationAreaWidth" , this . onSettingsChanged , null ) ;
44
45
this . settings . bindProperty ( Settings . BindingDirection . IN , "showActivationAreas" , "showActivationAreas" , this . onSettingsChanged , null ) ;
46
+ this . settings . bindProperty ( Settings . BindingDirection . IN , "useSwitcherExtension" , "useSwitcherExtension" , this . onSettingsChanged , null ) ;
45
47
this . onSettingsChanged ( ) ;
46
48
} ,
47
49
@@ -77,6 +79,7 @@ DesktopScroller.prototype = {
77
79
78
80
onSettingsChanged : function ( )
79
81
{
82
+ this . workspaceSwitcherExt = null ;
80
83
this . updateSettings ( ) ;
81
84
} ,
82
85
@@ -113,7 +116,24 @@ DesktopScroller.prototype = {
113
116
var direction = scrollDirection == 1 ? Meta . MotionDirection . RIGHT : Meta . MotionDirection . LEFT ;
114
117
this . switch_workspace ( direction ) ;
115
118
} ,
116
-
119
+
120
+ _updateWorkspaceSwitcherExt : function ( ) {
121
+ // Check if one of the workspace switcher extensions are installed or if the state has changed since we last checked
122
+ if ( ExtensionSystem . runningExtensions . indexOf ( 'DesktopCube@yare' ) > - 1 ) {
123
+ if ( ! this . workspaceSwitcherExt || this . workspaceSwitcherExt !== ExtensionSystem . extensions [ 'DesktopCube@yare' ] [ '5.4' ] [ 'extension' ] ) {
124
+ this . workspaceSwitcherExt = ExtensionSystem . extensions [ 'DesktopCube@yare' ] [ '5.4' ] [ 'extension' ] ;
125
+ }
126
+ } else if ( ExtensionSystem . runningExtensions . indexOf ( 'Flipper@connerdev' ) > - 1 ) {
127
+ if ( ! this . workspaceSwitcherExt || this . workspaceSwitcherExt !== ExtensionSystem . extensions [ 'Flipper@connerdev' ] [ '5.4' ] [ 'extension' ] ) {
128
+ this . workspaceSwitcherExt = ExtensionSystem . extensions [ 'Flipper@connerdev' ] [ '5.4' ] [ 'extension' ] ;
129
+ }
130
+ }
131
+ // Make sure the switcher extension has the required API to allow us to change to any arbitrary workspace
132
+ if ( this . workspaceSwitcherExt && typeof this . workspaceSwitcherExt . ExtSwitchToWorkspace !== "function" ) {
133
+ this . workspaceSwitcherExt = null ;
134
+ }
135
+ } ,
136
+
117
137
switch_workspace : function ( direction )
118
138
{
119
139
let active = global . screen . get_active_workspace ( ) ;
@@ -123,8 +143,15 @@ DesktopScroller.prototype = {
123
143
{
124
144
if ( this . showDirectionArrow ) {
125
145
this . showDirection ( direction ) ;
126
- }
127
- neighbor . activate ( global . get_current_time ( ) ) ;
146
+ }
147
+ if ( this . useSwitcherExtension ) {
148
+ this . _updateWorkspaceSwitcherExt ( )
149
+ }
150
+ if ( this . workspaceSwitcherExt ) {
151
+ this . workspaceSwitcherExt . ExtSwitchToWorkspace ( neighbor ) ;
152
+ } else {
153
+ neighbor . activate ( global . get_current_time ( ) ) ;
154
+ }
128
155
}
129
156
} ,
130
157
0 commit comments