From 2886facd25509bda4f2a7d909cf8c44b722d17be Mon Sep 17 00:00:00 2001 From: claudiux Date: Sun, 1 Dec 2024 21:23:38 +0100 Subject: [PATCH 1/3] smart-panel and DesktopCube: work together --- .../files/DesktopCube@yare/5.4/extension.js | 3 + .../files/DesktopCube@yare/metadata.json | 45 +++++----- .../smart-panel@mohammad-sn/extension.js | 88 ++++++++++++------- .../smart-panel@mohammad-sn/metadata.json | 49 ++++++----- 4 files changed, 109 insertions(+), 76 deletions(-) diff --git a/DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js b/DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js index db4e33a0..2574f5b3 100644 --- a/DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js +++ b/DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js @@ -12,6 +12,8 @@ const Settings = imports.ui.settings; const Util = imports.misc.util; // Needed for spawnCommandLine() const SignalManager = imports.misc.signalManager; +const UUID = "DesktopCube@yare"; + let enabled; let settings; let signalManager; @@ -64,6 +66,7 @@ Cube.prototype = { this.destroy_requested = false; this.transitions = []; // An array of Meta.MotionDirection values for each face transiation that is queued up this.firstRotate = true; + settings = new CubeSettings(UUID); this.pullaway = (100-settings.pullawayPercent)/100/2; if (faces === undefined) diff --git a/DesktopCube@yare/files/DesktopCube@yare/metadata.json b/DesktopCube@yare/files/DesktopCube@yare/metadata.json index 0f27b78a..54c34143 100644 --- a/DesktopCube@yare/files/DesktopCube@yare/metadata.json +++ b/DesktopCube@yare/files/DesktopCube@yare/metadata.json @@ -1,24 +1,25 @@ { - "cinnamon-version": [ - "2.0", - "2.1", - "2.2", - "2.4", - "2.6", - "2.8", - "3.0", - "3.2", - "3.4", - "3.8", - "4.0", - "4.2", - "4.4", - "4.6", - "5.4" - ], - "version": "2.0.0", - "uuid": "DesktopCube@yare", - "name": "Desktop Cube", - "description": "Compiz Cube-like animation for workspace switching", - "url": "http://cinnamon-spices.linuxmint.com/" + "cinnamon-version": [ + "2.0", + "2.1", + "2.2", + "2.4", + "2.6", + "2.8", + "3.0", + "3.2", + "3.4", + "3.8", + "4.0", + "4.2", + "4.4", + "4.6", + "5.4" + ], + "version": "2.0.1", + "uuid": "DesktopCube@yare", + "name": "Desktop Cube", + "description": "Compiz Cube-like animation for workspace switching", + "url": "http://cinnamon-spices.linuxmint.com/extensions/view/68", + "author": "klangman" } diff --git a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js index d1320abb..4581da15 100644 --- a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js +++ b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js @@ -43,7 +43,7 @@ function SmartPanelExt(metadata, orientation, panel_height, instanceId) { SmartPanelExt.prototype = { _init: function(metadata, orientation, panel_height, instanceId) { - + Settings.BindingDirection.BI = Settings.BindingDirection.BIDIRECTIONAL this.settings = new Settings.ExtensionSettings(this, "smart-panel@mohammad-sn"); this.settings.bindProperty(Settings.BindingDirection.BI, "scroll-action" , "scrl_action", this._onScrollActionChanged, null); @@ -66,7 +66,7 @@ SmartPanelExt.prototype = { this.settings.bindProperty(Settings.BindingDirection.IN, "appswitcher-scope" , "switcher_scope", null, null); this.settings.bindProperty(Settings.BindingDirection.IN, "scope-modified" , "switcher_modified", null, null); this.settings.bindProperty(Settings.BindingDirection.IN, "appswitcher-modifier", "switcher_modifier", null, null); - + this.cwm_settings = new Gio.Settings({ schema: "org.cinnamon.desktop.wm.preferences" }); // schema location has changed around 5.4, do a try catch for maximum compatibility @@ -78,9 +78,9 @@ SmartPanelExt.prototype = { this.mos_settings = new Gio.Settings({ schema: "org.cinnamon.desktop.peripherals.mouse" }); } } - + this.muf_settings = new Gio.Settings({ schema: "org.cinnamon.muffin" }); - + //this._panel = Main.panel._centerBox; this._panel = Main.panel.actor; @@ -88,11 +88,11 @@ SmartPanelExt.prototype = { this.dblb = false; this.dblb_T = this.mos_settings.get_int('double-click'); }, - + _onScrollActionChanged : function() { if (this.scrl_action != "none") this.sep_acts = false; }, - + _onScrollSettingsChanged : function() { if (this.sep_acts == true ) this.scrl_action = "none"; }, @@ -120,7 +120,7 @@ SmartPanelExt.prototype = { return; }, - _onLeave : function(actor, event) { + _onLeave : function(actor, event) { if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE; if (this.p && this.use_gestures) { let v = Math.abs(global.get_pointer()[0] - this.ppos[0]) < 33; @@ -162,7 +162,7 @@ SmartPanelExt.prototype = { this.p = false; return; }, - + _onScroll : function(actor, event) { if (this.checkEventSource(actor, event)) return Clutter.EVENT_PROPAGATE; let currentTime = Date.now(); @@ -191,10 +191,10 @@ SmartPanelExt.prototype = { if (this.scrl_action == 'adjust_opacity') { let min_opacity = this.cwm_settings.get_int("min-window-opacity") * 255 / 100; let m = 50; - m = global.window_group.opacity + m * scrollDirection; + m = global.window_group.get_opacity() + m * scrollDirection; if (m < min_opacity) m = min_opacity; if (m > 255) m = 255; - global.window_group.opacity = m; + global.window_group.set_opacity(m); } else if (this.scrl_action == 'desktop') { if (Main.panel.bottomPosition) scrollDirection = -scrollDirection; @@ -208,14 +208,35 @@ SmartPanelExt.prototype = { let limit = this._lastScroll + this.scroll_delay; if (this.no_fast_scroll && currentTime < limit && currentTime >= this._lastScroll) { } else if (this.scrl_action == 'switch_workspace') { - if(ExtensionSystem.runningExtensions['Flipper@connerdev']){ + if (ExtensionSystem.runningExtensions.indexOf('DesktopCube@yare') > -1 ) { + //~ global.log("DesktopCube@yare DETECTED!!!"); + if (this.DesktopCube) {} + else { + //~ global.log("ExtensionSystem.extensions['DesktopCube@yare']['5.4']['extension']: "+Object.keys(ExtensionSystem.extensions['DesktopCube@yare']['5.4']['extension'])); + this.DesktopCube = ExtensionSystem.extensions['DesktopCube@yare']['5.4']['extension']; + } + let binding = []; + binding.get_mask = function(){ return 0x0; }; + if (scrollDirection == 1) binding.get_name = function(){ return 'switch-to-workspace-left'; }; + else if (scrollDirection == -1) binding.get_name = function(){ return 'switch-to-workspace-right'; }; + let cube = new this.DesktopCube.Cube(null, null, binding); + if (cube.isAnimating) { + cube.destroy_requested = true; + } else { + cube.destroy_requested = true; + cube.onDestroy(); + } + } + else + if (ExtensionSystem.runningExtensions.indexOf('Flipper@connerdev') > -1) { + //~ global.log("Flipper@connerdev DETECTED!!!"); if (this.Flipper){} - else { this.Flipper = ExtensionSystem.extensions['Flipper@connerdev']['extension']; } + else { this.Flipper = ExtensionSystem.extensions['Flipper@connerdev']['5.4']['extension']; } let binding = []; binding.get_mask = function(){ return 0x0; }; if (scrollDirection == 1) binding.get_name = function(){ return 'switch-to-workspace-left'; }; else if (scrollDirection == -1) binding.get_name = function(){ return 'switch-to-workspace-right'; }; - flipper = new this.Flipper.Flipper(null, null, null, binding); + let flipper = new this.Flipper.Flipper(null, null, binding); if (flipper.is_animating) { flipper.destroy_requested = true; } else { @@ -232,7 +253,7 @@ SmartPanelExt.prototype = { if (this.muf_settings.get_boolean("workspace-cycle")){ first = last; flast = 0; - } + } if (reqWsInex < 0) reqWsInex = first; else if (reqWsInex > last) reqWsInex = flast; let reqWs = global.screen.get_workspace_by_index(reqWsInex); @@ -266,14 +287,14 @@ SmartPanelExt.prototype = { this._lastScroll = currentTime; return; }, - + checkEventSource : function(actor, event) { let source = event.get_source(); let clr = (source != Main.panel._centerBox || source != Main.panel._leftBox || source != Main.panel._rightBox); let not_ours = (source != actor && clr); return not_ours; }, - + Do : function(action) { let activeWs = 0, reqWs = 0; switch (action) { @@ -321,7 +342,7 @@ SmartPanelExt.prototype = { break; case 'appswitcher' : this.get_name = Lang.bind(this, function(){ - if (eval(this.switcher_modifier) & global.get_pointer()[2]) return this.switcher_modified; + if (eval(this.switcher_modifier) & global.get_pointer()[2]) return this.switcher_modified; else return this.switcher_scope; }); this.get_mask = function(){ return 0xFFFF; } @@ -342,12 +363,12 @@ SmartPanelExt.prototype = { else { new myClassicSwitcher(this); } - + break; } if (reqWs) { reqWs.activate(global.get_current_time()); this.showWorkspaceOSD(); } }, - + showWorkspaceOSD : function() { this._hideWorkspaceOSD(); if ( @@ -364,7 +385,8 @@ SmartPanelExt.prototype = { this._workspace_osd.set_text( Main.getWorkspaceName(current_workspace_index) ); - this._workspace_osd.set_opacity = 0; + //this._workspace_osd.set_opacity = 0; + this._workspace_osd.set_opacity(0); Main.layoutManager.addChrome(this._workspace_osd, { visibleInFullscreen: false, affectsInputRegion: false, @@ -431,14 +453,14 @@ function myClassicSwitcher() { myClassicSwitcher.prototype = { __proto__: ClassicSwitcher.ClassicSwitcher.prototype, - + _init: function() { AppSwitcher.AppSwitcher.prototype._init.apply(this, arguments); this.actor = new Cinnamon.GenericContainer({ name: 'altTabPopup', reactive: true, visible: false }); - + this._thumbnailTimeoutId = 0; this.thumbnailsVisible = false; this._displayPreviewTimeoutId = 0; @@ -447,7 +469,7 @@ myClassicSwitcher.prototype = { if (!this._setupModal()) return; - + let styleSettings = this._binding.switcher_style; if (styleSettings == 'default') styleSettings = global.settings.get_string("alttab-switcher-style"); let features = styleSettings.split('+'); @@ -459,13 +481,13 @@ myClassicSwitcher.prototype = { this._showThumbnails = this._thumbnailsEnabled && !this._iconsEnabled; this._showArrows = this._thumbnailsEnabled && this._iconsEnabled; - + this._updateList(0); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this.actor.connect('allocate', Lang.bind(this, this._allocate)); - + // Need to force an allocation so we can figure out whether we // need to scroll when selecting this.actor.opacity = 0; @@ -479,7 +501,7 @@ myClassicSwitcher.prototype = { this._activateSelected(); else { this._disableHover(); - + 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)); @@ -499,7 +521,7 @@ myClassicSwitcher.prototype = { this._activateSelected(); return true; }, - + owndestroy: function() { this._activateSelected(); }, @@ -511,7 +533,7 @@ function myTimelineSwitcher() { myTimelineSwitcher.prototype = { __proto__: TimelineSwitcher.TimelineSwitcher.prototype, - + _init: function() { TimelineSwitcher.TimelineSwitcher.prototype._init.apply(this, arguments); }, @@ -522,7 +544,7 @@ myTimelineSwitcher.prototype = { this._activateSelected(); else { this._disableHover(); - + 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)); @@ -542,7 +564,7 @@ myTimelineSwitcher.prototype = { this._activateSelected(); return true; }, - + owndestroy: function() { this._activateSelected(); }, @@ -555,7 +577,7 @@ function myCoverflowSwitcher() { myCoverflowSwitcher.prototype = { __proto__: CoverflowSwitcher.CoverflowSwitcher.prototype, - + _init: function() { CoverflowSwitcher.CoverflowSwitcher.prototype._init.apply(this, arguments); }, @@ -566,7 +588,7 @@ myCoverflowSwitcher.prototype = { this._activateSelected(); else { this._disableHover(); - + 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)); @@ -586,7 +608,7 @@ myCoverflowSwitcher.prototype = { this._activateSelected(); return true; }, - + owndestroy: function() { this._activateSelected(); }, diff --git a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json index 0d0cfa17..2891c32f 100644 --- a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json +++ b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json @@ -1,23 +1,30 @@ { - "cinnamon-version": [ - "1.8", - "1.9", - "2.0", - "2.1", - "2.2", - "2.4", - "2.6", - "2.8", - "3.0", - "3.2", - "3.4", - "3.8", - "4.0", - "4.2", - "4.4" - ], - "description": "Switch between workspaces, show desktop, activate overview or expo, ... by scrolling, double click, mouse gestures etc on free space of the panel.", - "name": "Smart Panel", - "version": 1.4, - "uuid": "smart-panel@mohammad-sn" + "cinnamon-version": [ + "1.8", + "1.9", + "2.0", + "2.1", + "2.2", + "2.4", + "2.6", + "2.8", + "3.0", + "3.2", + "3.4", + "3.8", + "4.0", + "4.2", + "4.4", + "4.6", + "4.8", + "5.0", + "5.2", + "5.4" + ], + "description": "Switch between workspaces, show desktop, activate overview or expo, ... by scrolling, double click, mouse gestures etc on free space of the panel.", + "name": "Smart Panel", + "version": 1.4.1, + "uuid": "smart-panel@mohammad-sn", + "url": "https://cinnamon-spices.linuxmint.com/extensions/view/80", + "author": "mohammad-sn" } From db0dc83c3b2382501c4b887c7705420c30a5e604 Mon Sep 17 00:00:00 2001 From: claudiux Date: Sun, 1 Dec 2024 21:24:06 +0100 Subject: [PATCH 2/3] smart-panel and Flipper: work together --- Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js b/Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js index 16555b71..b8d547d2 100644 --- a/Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js +++ b/Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js @@ -17,6 +17,8 @@ const Tweener = imports.ui.tweener; const Settings = imports.ui.settings; const Panel = imports.ui.panel; +const UUID = "Flipper@connerdev"; + let settings; let bindings = ['switch-to-workspace-left', 'switch-to-workspace-right', @@ -35,6 +37,7 @@ Flipper.prototype = { this.destroy_requested = false; this.queued_direction = null; this.monitor = Main.layoutManager.primaryMonitor; + settings = new FlipperSettings(UUID); let [binding_type,,,direction] = binding.get_name().split('-'); direction = Meta.MotionDirection[direction.toUpperCase()]; From bfa88326877db2aab450a670e8038d327c1fd3f6 Mon Sep 17 00:00:00 2001 From: claudiux Date: Sun, 1 Dec 2024 21:33:03 +0100 Subject: [PATCH 3/3] smart-panel: Fixes a typo in metadata.json --- .../files/smart-panel@mohammad-sn/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json index 2891c32f..5c39b160 100644 --- a/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json +++ b/smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json @@ -23,7 +23,7 @@ ], "description": "Switch between workspaces, show desktop, activate overview or expo, ... by scrolling, double click, mouse gestures etc on free space of the panel.", "name": "Smart Panel", - "version": 1.4.1, + "version": "1.4.1", "uuid": "smart-panel@mohammad-sn", "url": "https://cinnamon-spices.linuxmint.com/extensions/view/80", "author": "mohammad-sn"