diff --git a/CoverflowAltTab@dmo60.de/coverflowSwitcher.js b/CoverflowAltTab@dmo60.de/coverflowSwitcher.js index 5aedfc2..62f1040 100644 --- a/CoverflowAltTab@dmo60.de/coverflowSwitcher.js +++ b/CoverflowAltTab@dmo60.de/coverflowSwitcher.js @@ -41,7 +41,7 @@ const PREVIEW_SCALE = 0.5; function appendParams(base, extra) { for (let key in extra) { base[key] = extra[key]; } } - + function Switcher() { this._init.apply(this, arguments); } @@ -59,13 +59,13 @@ Switcher.prototype = { _createPreviews: function() { let monitor = this._activeMonitor; - let currentWorkspace = global.screen.get_active_workspace(); - + let currentWorkspace = this._manager.workspace_manager.get_active_workspace(); + this._yOffset = monitor.height / 2 - this._settings.offset; this._xOffsetLeft = monitor.width * 0.1; this._xOffsetRight = monitor.width - this._xOffsetLeft; this._xOffsetCenter = monitor.width / 2; - + this._previews = []; for (let i in this._windows) { let metaWin = this._windows[i]; @@ -120,12 +120,12 @@ Switcher.prototype = { this._updatePreviews(-1); } }, - + _flipStack: function(gravity) { this._looping = true; - + let xOffset, angle; - + if(gravity == Clutter.Gravity.WEST) { xOffset = -this._xOffsetLeft; angle = BLEND_OUT_ANGLE; @@ -133,9 +133,9 @@ Switcher.prototype = { xOffset = this._activeMonitor.width + this._xOffsetLeft; angle = -BLEND_OUT_ANGLE; } - + let animation_time = this._settings.animation_time * 2/3; - + for (let i in this._previews) { let preview = this._previews[i]; preview._cfIsLast = (i == this._windows.length-1); @@ -150,10 +150,10 @@ Switcher.prototype = { }); } }, - + _onFlipIn: function(preview, index, gravity) { let xOffsetStart, xOffsetEnd, angleStart, angleEnd; - + if(gravity == Clutter.Gravity.WEST) { xOffsetStart = this._activeMonitor.width + this._xOffsetLeft; xOffsetEnd = this._xOffsetRight; @@ -165,9 +165,9 @@ Switcher.prototype = { angleStart = BLEND_OUT_ANGLE; angleEnd = SIDE_ANGLE; } - + let animation_time = this._settings.animation_time * 2/3; - + preview.rotation_angle_y = angleStart; preview.x = xOffsetStart + 50 * (index - this._currentIndex); let lastExtraParams = { @@ -176,7 +176,7 @@ Switcher.prototype = { onCompleteScope: this }; let oppositeGravity = (gravity == Clutter.Gravity.WEST) ? Clutter.Gravity.EAST : Clutter.Gravity.WEST; - + if (index == this._currentIndex) { preview.raise_top(); let extraParams = preview._cfIsLast ? lastExtraParams : null; @@ -186,20 +186,20 @@ Switcher.prototype = { preview.raise_top(); else preview.lower_bottom(); - + let extraParams = { opacity: 255, rotation_angle_y: angleEnd, time: animation_time, transition: TRANSITION_TYPE }; - + if (preview._cfIsLast) appendParams(extraParams, lastExtraParams); this._animatePreviewToSide(preview, index, oppositeGravity, xOffsetEnd, extraParams); } }, - + _onFlipComplete: function() { this._looping = false; if(this._requiresUpdate == true) { @@ -207,7 +207,7 @@ Switcher.prototype = { this._updatePreviews(); } }, - + _animatePreviewToMid: function(preview, oldGravity, animation_time, extraParams) { let rotation_vertex_x = (oldGravity == Clutter.Gravity.EAST) ? preview.width / 2 : -preview.width / 2; preview.move_anchor_point_from_gravity(Clutter.Gravity.CENTER); @@ -223,13 +223,13 @@ Switcher.prototype = { time: animation_time, transition: TRANSITION_TYPE }; - + if(extraParams) appendParams(tweenParams, extraParams); - + Tweener.addTween(preview, tweenParams); }, - + _animatePreviewToSide: function(preview, index, gravity, xOffset, extraParams) { preview.move_anchor_point_from_gravity(gravity); preview.rotation_center_y = new Clutter.Vertex({ x: 0.0, y: 0.0, z: 0.0 }); @@ -240,9 +240,9 @@ Switcher.prototype = { width: Math.max(preview.target_width_side * (10 - Math.abs(index - this._currentIndex)) / 10, 0), height: Math.max(preview.target_height_side * (10 - Math.abs(index - this._currentIndex)) / 10, 0), }; - + appendParams(tweenParams, extraParams); - + Tweener.addTween(preview, tweenParams); }, @@ -251,10 +251,10 @@ Switcher.prototype = { this._requiresUpdate = true; return; } - + let monitor = this._activeMonitor; let animation_time = this._settings.animation_time; - + // preview windows for (let i in this._previews) { let preview = this._previews[i]; diff --git a/CoverflowAltTab@dmo60.de/extension.js b/CoverflowAltTab@dmo60.de/extension.js index 1371b76..9c081f7 100644 --- a/CoverflowAltTab@dmo60.de/extension.js +++ b/CoverflowAltTab@dmo60.de/extension.js @@ -59,7 +59,10 @@ function enable() { platform = new Platform.PlatformCinnamon18(); keybinder = HAS_META_KEYBIND_API ? new Keybinder.KeybinderNewApi() : new Keybinder.KeybinderOldApi(); } else { - if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 21 && PACKAGE_VERSION >= "3.21.0") { + if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 30 && PACKAGE_VERSION >= "3.30.0") { + platform = new Platform.PlatformGnomeShell314(); + keybinder = new Keybinder.Keybinder330Api(); + } else if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 21 && PACKAGE_VERSION >= "3.21.0") { platform = new Platform.PlatformGnomeShell314(); keybinder = new Keybinder.Keybinder322Api(); } else if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 14 && PACKAGE_VERSION >= "3.14.0") { diff --git a/CoverflowAltTab@dmo60.de/keybinder.js b/CoverflowAltTab@dmo60.de/keybinder.js index 39d6264..4eab36e 100644 --- a/CoverflowAltTab@dmo60.de/keybinder.js +++ b/CoverflowAltTab@dmo60.de/keybinder.js @@ -43,6 +43,43 @@ AbstractKeybinder.prototype = { } } + +function Keybinder330Api() { + this._init(); +} + +Keybinder330Api.prototype = { + __proto__: AbstractKeybinder.prototype, + + _init: function() { + AbstractKeybinder.prototype._init.call(this); + }, + + enable: function(startAppSwitcherBind) { + let Shell = imports.gi.Shell; + let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; + Main.wm.setCustomKeybindingHandler('switch-applications', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-windows', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-group', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-panels', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-applications-backward', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-windows-backward', mode.NORMAL, startAppSwitcherBind); + Main.wm.setCustomKeybindingHandler('switch-group-backward', mode.NORMAL, startAppSwitcherBind); + }, + + disable: function() { + let Shell = imports.gi.Shell; + let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; + Main.wm.setCustomKeybindingHandler('switch-applications', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + Main.wm.setCustomKeybindingHandler('switch-windows', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + Main.wm.setCustomKeybindingHandler('switch-group', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + Main.wm.setCustomKeybindingHandler('switch-panels', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startA11ySwitcher)); + Main.wm.setCustomKeybindingHandler('switch-applications-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + Main.wm.setCustomKeybindingHandler('switch-windows-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + Main.wm.setCustomKeybindingHandler('switch-group-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + } +}; + function KeybinderNewApi() { this._init(); } @@ -82,11 +119,11 @@ function KeybinderNewGSApi() { KeybinderNewGSApi.prototype = { __proto__: AbstractKeybinder.prototype, - + _init: function() { AbstractKeybinder.prototype._init.call(this); }, - + enable: function(startAppSwitcherBind) { let Shell = imports.gi.Shell; let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; @@ -101,7 +138,7 @@ KeybinderNewGSApi.prototype = { disable: function() { let Shell = imports.gi.Shell; - let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; + let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; Main.wm.setCustomKeybindingHandler('switch-applications', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startAppSwitcher)); Main.wm.setCustomKeybindingHandler('switch-windows', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startWindowSwitcher)); Main.wm.setCustomKeybindingHandler('switch-group', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startAppSwitcher)); @@ -118,34 +155,17 @@ function Keybinder322Api() { } Keybinder322Api.prototype = { - __proto__: AbstractKeybinder.prototype, - + __proto__: Keybinder330Api.prototype, + _init: function() { - AbstractKeybinder.prototype._init.call(this); - }, - - enable: function(startAppSwitcherBind) { - let Shell = imports.gi.Shell; - let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; - Main.wm.setCustomKeybindingHandler('switch-applications', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-windows', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-group', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-panels', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-applications-backward', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-windows-backward', mode.NORMAL, startAppSwitcherBind); - Main.wm.setCustomKeybindingHandler('switch-group-backward', mode.NORMAL, startAppSwitcherBind); + Keybinder330Api.prototype._init.call(this); }, - disable: function() { - let Shell = imports.gi.Shell; - let mode = Shell.ActionMode ? Shell.ActionMode : Shell.KeyBindingMode; - Main.wm.setCustomKeybindingHandler('switch-applications', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); - Main.wm.setCustomKeybindingHandler('switch-windows', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); - Main.wm.setCustomKeybindingHandler('switch-group', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); - Main.wm.setCustomKeybindingHandler('switch-panels', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startA11ySwitcher)); - Main.wm.setCustomKeybindingHandler('switch-applications-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); - Main.wm.setCustomKeybindingHandler('switch-windows-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); - Main.wm.setCustomKeybindingHandler('switch-group-backward', mode.NORMAL, Lang.bind(Main.wm, Main.wm._startSwitcher)); + enable: function(startAppSwitcherBind330) { + let startAppSwitcherBind = function(display, screen, window, binding) { + startAppSwitcherBind330(display, window, binding); + } + Keybinder330Api.prototype.enable.call(this, startAppSwitcherBind); } }; diff --git a/CoverflowAltTab@dmo60.de/manager.js b/CoverflowAltTab@dmo60.de/manager.js index 01d1f33..854cd29 100644 --- a/CoverflowAltTab@dmo60.de/manager.js +++ b/CoverflowAltTab@dmo60.de/manager.js @@ -55,6 +55,16 @@ Manager.prototype = { _init: function(platform, keybinder) { this.platform = platform; this.keybinder = keybinder; + + if (global.workspace_manager && global.workspace_manager.get_active_workspace) + this.workspace_manager = global.workspace_manager; + else + this.workspace_manager = global.screen; + + if (global.display && global.display.get_n_monitors) + this.display = global.display; + else + this.display = global.screen; }, enable: function() { @@ -75,9 +85,9 @@ Manager.prototype = { win.delete(global.get_current_time()); }, - _startWindowSwitcher: function(display, screen, window, binding) { + _startWindowSwitcher: function(display, window, binding) { let windows = []; - let currentWorkspace = screen.get_active_workspace(); + let currentWorkspace = this.workspace_manager.get_active_workspace(); // Construct a list with all windows let windowActors = global.get_window_actors(); diff --git a/CoverflowAltTab@dmo60.de/metadata.json b/CoverflowAltTab@dmo60.de/metadata.json index ef66467..c8257ed 100644 --- a/CoverflowAltTab@dmo60.de/metadata.json +++ b/CoverflowAltTab@dmo60.de/metadata.json @@ -1,38 +1,39 @@ { - "description": "Replacement of Alt-Tab, iterates through windows in a cover-flow manner.", + "description": "Replacement of Alt-Tab, iterates through windows in a cover-flow manner.", "cinnamon-version": [ - "1.2", - "1.4", - "1.6", - "1.8", - "1.9", - "2.0", - "2.1", - "2.2", - "2.3", - "2.4", - "2.8", + "1.2", + "1.4", + "1.6", + "1.8", + "1.9", + "2.0", + "2.1", + "2.2", + "2.3", + "2.4", + "2.8", "3.0", - "3.2" - ], + "3.2" + ], "shell-version": [ - "3.4", - "3.6", - "3.8", - "3.10", - "3.12", - "3.14", - "3.16", - "3.18", - "3.20", + "3.4", + "3.6", + "3.8", + "3.10", + "3.12", + "3.14", + "3.16", + "3.18", + "3.20", "3.22", "3.23", "3.24", "3.26", - "3.28" - ], - "dangerous": false, - "name": "Coverflow Alt-Tab", - "url": "https://github.com/dmo60/CoverflowAltTab", + "3.28", + "3.30" + ], + "dangerous": false, + "name": "Coverflow Alt-Tab", + "url": "https://github.com/dmo60/CoverflowAltTab", "uuid": "CoverflowAltTab@dmo60.de" } diff --git a/CoverflowAltTab@dmo60.de/switcher.js b/CoverflowAltTab@dmo60.de/switcher.js index f572490..ce29234 100644 --- a/CoverflowAltTab@dmo60.de/switcher.js +++ b/CoverflowAltTab@dmo60.de/switcher.js @@ -59,16 +59,16 @@ Switcher.prototype = { this._dcid = this._windowManager.connect('destroy', Lang.bind(this, this._windowDestroyed)); this._mcid = this._windowManager.connect('map', Lang.bind(this, this._activateSelected)); - + manager.platform.initBackground(); - + // create a container for all our widgets let widgetClass = manager.platform.getWidgetClass(); this.actor = new widgetClass({ visible: true, reactive: true, }); this.actor.hide(); this.previewActor = new widgetClass({ visible: true, reactive: true}); this.actor.add_actor(this.previewActor); - + Main.uiGroup.add_actor(this.actor); if (!Main.pushModal(this.actor)) { @@ -81,9 +81,9 @@ Switcher.prototype = { this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent)); this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent)); this.actor.connect('scroll-event', Lang.bind(this, this._scrollEvent)); - + this._modifierMask = manager.platform.getPrimaryModifier(mask); - + let [x, y, mods] = global.get_pointer(); if (!(mods & this._modifierMask)){ // There's a race condition; if the user released Alt before @@ -100,7 +100,7 @@ Switcher.prototype = { show: function() { this._enableMonitorFix(); - + let monitor = this._updateActiveMonitor(); this.actor.set_position(monitor.x, monitor.y); this.actor.set_size(monitor.width, monitor.height); @@ -136,7 +136,7 @@ Switcher.prototype = { } this._manager.platform.dimBackground(); - + this._initialDelayTimeoutId = 0; this._next(); @@ -205,7 +205,7 @@ Switcher.prototype = { return this._activeMonitor; }, - + _setCurrentWindowTitle: function(window) { let animation_time = this._settings.animation_time; @@ -247,10 +247,10 @@ Switcher.prototype = { time: animation_time, transition: TRANSITION_TYPE, }); - + let cx = Math.round((monitor.width + label_offset) / 2); let cy = Math.round(monitor.height * this._settings.title_position / 8 - this._settings.offset); - + this._windowTitle.x = cx - Math.round(this._windowTitle.get_width()/2); this._windowTitle.y = cy - Math.round(this._windowTitle.get_height()/2); @@ -383,7 +383,7 @@ Switcher.prototype = { _scrollEvent: function(actor, event) { if(!this._checkSwitchTime()) return true; - + switch (event.get_scroll_direction()) { case Clutter.ScrollDirection.SMOOTH: let [dx, dy] = event.get_scroll_delta(); @@ -399,18 +399,18 @@ Switcher.prototype = { this._previous(); } return true; - + case Clutter.ScrollDirection.LEFT: case Clutter.ScrollDirection.UP: this._previous(); return true; - + case Clutter.ScrollDirection.RIGHT: case Clutter.ScrollDirection.DOWN: this._next(); return true; } - + return true; }, @@ -459,7 +459,7 @@ Switcher.prototype = { _onHideBackgroundCompleted: function() { this._manager.platform.removeBackground(); Main.uiGroup.remove_actor(this.actor); - + // show all window actors global.window_group.show(); }, @@ -469,12 +469,12 @@ Switcher.prototype = { TRANSITION_TYPE = 'easeOutBack'; else TRANSITION_TYPE = 'easeOutCubic'; - + let monitor = this._activeMonitor; if (this._initialDelayTimeoutId == 0) { // preview windows - let currentWorkspace = global.screen.get_active_workspace(); + let currentWorkspace = this._manager.workspace_manager.get_active_workspace(); for (let i in this._previews) { let preview = this._previews[i]; let metaWin = this._windows[i]; @@ -570,22 +570,22 @@ Switcher.prototype = { destroy: function() { this._onDestroy(); }, - + _enableMonitorFix: function() { - if(global.screen.get_n_monitors() < 2) + if(this._manager.display.get_n_monitors() < 2) return; - + this._updateActiveMonitor(); this._monitorFix = true; this._oldWidth = global.stage.width; this._oldHeight = global.stage.height; - + let width = 2 * (this._activeMonitor.x + this._activeMonitor.width/2); let height = 2 * (this._activeMonitor.y + this._activeMonitor.height/2); - + global.stage.set_size(width, height); }, - + _disableMonitorFix: function() { if(this._monitorFix) { global.stage.set_size(this._oldWidth, this._oldHeight); diff --git a/CoverflowAltTab@palatis.blogspot.com/metadata.json b/CoverflowAltTab@palatis.blogspot.com/metadata.json index 255a754..e45d0c6 100644 --- a/CoverflowAltTab@palatis.blogspot.com/metadata.json +++ b/CoverflowAltTab@palatis.blogspot.com/metadata.json @@ -1,6 +1,6 @@ { "cinnamon-version": ["1.2", "1.4", "1.6", "1.8", "1.9", "2.0", "2.1", "2.2", "2.3", "2.4", "2.8", "3.0"], - "shell-version": ["3.4", "3.6", "3.8", "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.23", "3.24", "3.26", "3.28"], + "shell-version": ["3.4", "3.6", "3.8", "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.23", "3.24", "3.26", "3.28", "3.30"], "uuid": "CoverflowAltTab@palatis.blogspot.com", "name": "Coverflow Alt-Tab", "description": "Replacement of Alt-Tab, iterates through windows in a cover-flow manner.",