Skip to content

Commit 6794716

Browse files
authored
[DesktopCube@yare] Version 1.0.3 (#715)
1. Added an option to remove the panels from the animation effect 2. Fix the Effect Setting options that were broken when the "tween" option widget was removed starting with cinnamon 5.4 3. Allow Cinnamon to play the workspace switch sound if it is enabled 4. Change info.json author to me, since there is currently no maintainer * Closes #391 * Closes #535
1 parent c681496 commit 6794716

22 files changed

+1206
-242
lines changed

DesktopCube@yare/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.0.2
4+
5+
* Added an option to remove the panels from the animation effect
6+
* Fix the Effect Setting options that were broken when the "tween" option widget was removed starting with cinnamon 5.4
7+
* Allow Cinnamon to play the workspace switch sound if it is enabled
8+
* Note: All changed from here on will only be for the Cinnamon 5.4+ version
9+
* Change info.json author to me, since there is currently no maintainer
10+
311
## 1.0.1
412

513
* Updated for Cinnamon 5.4+ (tested on latest as well 6.2.9)

DesktopCube@yare/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
Compiz Cube-like animation for workspace switching
44

55
Using the standard workspace switching hotkeys Ctrl+Alt+Left/Right will show a rotating cube with the workspaces on the cube faces as the workspace switching animation.
6+
7+
# Known Issues
8+
9+
On the two machines I have tested with (Cinnamon 6+), the Cube animation does not seem to animate every well unless I set the pullaway setting value to a large number (i.e 0.3+). Even then I see some flashing some times or a complete failure to animate on occasion. I am not sure what's causing it but it happens on a Intel and a AMD GPU setup so I doubt it's a driver issue. I don't see the same issue using very old Mint versions in a Virtual Machine.

DesktopCube@yare/files/DesktopCube@yare/5.4/extension.js

+83-45
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ Cube.prototype = {
134134
}
135135
return 0;
136136
});
137-
workspace_clone.chromeGroup.get_parent()
138-
.set_child_above_sibling(workspace_clone.chromeGroup, null);
137+
if (workspace_clone.chromeGroup) {
138+
workspace_clone.chromeGroup.get_parent().set_child_above_sibling(workspace_clone.chromeGroup, null);
139+
}
139140
},
140141

141142
moveWindowClone: function(window, active_index, new_index) {
@@ -226,34 +227,35 @@ Cube.prototype = {
226227
clone.workspaceWindowActors.push(windowClone);
227228
}
228229
clone.workspaceWindows = workspaceWindows;
229-
230-
let chromeGroup = new St.Group();
231-
let panels = Main.getPanels().concat(Main.uiGroup.get_children());
232-
for (let i = 0; i < panels.length; i++) {
233-
if (!panels[i]) continue;
234-
let panel = panels[i];
235-
// Is it a non-autohideable panel, or is it a visible, tracked
236-
// chrome object?
237-
if ((panel.actor && !panel._hideable)
238-
|| (panel && Main.layoutManager.isTrackingChrome(panel) && panel.visible)) {
239-
let chromeClone = new Clutter.Clone({
240-
source: panel.actor ? panel.actor : panel,
241-
x : panel.actor ? panel.actor.x : panel.x,
242-
y: panel.actor ? panel.panelPosition === Panel.PanelLoc.bottom ?
243-
Main.layoutManager.primaryMonitor.y
244-
+ Main.layoutManager.primaryMonitor.height
245-
- panel.actor.height
246-
: Main.layoutManager.primaryMonitor.y
247-
: panel.y
248-
});
249-
chromeGroup.add_child(chromeClone);
250-
chromeClone.get_parent().set_child_above_sibling(chromeClone, null);
251-
}
230+
if (settings.includePanels) {
231+
let chromeGroup = new St.Group();
232+
let panels = Main.getPanels().concat(Main.uiGroup.get_children());
233+
for (let i = 0; i < panels.length; i++) {
234+
if (!panels[i]) continue;
235+
let panel = panels[i];
236+
// Is it a non-autohideable panel, or is it a visible, tracked
237+
// chrome object?
238+
if ((panel.actor && !panel._hideable)
239+
|| (panel && Main.layoutManager.isTrackingChrome(panel) && panel.visible)) {
240+
let chromeClone = new Clutter.Clone({
241+
source: panel.actor ? panel.actor : panel,
242+
x : panel.actor ? panel.actor.x : panel.x,
243+
y: panel.actor ? panel.panelPosition === Panel.PanelLoc.bottom ?
244+
Main.layoutManager.primaryMonitor.y
245+
+ Main.layoutManager.primaryMonitor.height
246+
- panel.actor.height
247+
: Main.layoutManager.primaryMonitor.y
248+
: panel.y
249+
});
250+
chromeGroup.add_child(chromeClone);
251+
chromeClone.get_parent().set_child_above_sibling(chromeClone, null);
252+
}
253+
}
254+
255+
clone.add_child(chromeGroup);
256+
chromeGroup.get_parent().set_child_above_sibling(chromeGroup, null);
257+
clone.chromeGroup = chromeGroup;
252258
}
253-
254-
clone.add_child(chromeGroup);
255-
chromeGroup.get_parent().set_child_above_sibling(chromeGroup, null);
256-
clone.chromeGroup = chromeGroup;
257259
clone.index = workspaceIndex;
258260
return clone;
259261
},
@@ -304,13 +306,13 @@ Cube.prototype = {
304306
if (visible) {
305307
Tweener.addTween(clone, {
306308
opacity: 255,
307-
transition: settings.unrotateEffect,
309+
transition: settings.getUnrotateEffect(),
308310
time: settings.animationTime * 0.3333,
309311
});
310312
} else {
311313
Tweener.addTween(clone, {
312314
opacity: 0,
313-
transition: settings.rotateEffect,
315+
transition: settings.getRotateEffect(),
314316
time: settings.animationTime * 0.3333,
315317
});
316318
}
@@ -341,6 +343,9 @@ Cube.prototype = {
341343
this.actor.add_child(from_workspace);
342344
}
343345

346+
// Allow Cinnamon to play the switcher sound if it's enabled.
347+
Main.soundManager.play('switch');
348+
344349
if (direction === this.last_direction) {
345350
if (this.from != null) {
346351
to_workspace = this.getWorkspaceCloneScaled(new_workspace.index(), direction);
@@ -390,8 +395,10 @@ Cube.prototype = {
390395

391396
to.set_scale(1 - 2 * settings.pullaway, 1 - 2 * settings.pullaway);
392397
from.get_parent().set_child_above_sibling(from, null);
393-
if (needScale) this.scale(from, to, direction);
394-
else this.rotate_mid(from, to, direction);
398+
if (needScale)
399+
this.scale(from, to, direction);
400+
else
401+
this.rotate_mid(from, to, direction);
395402
},
396403

397404
scale: function(from, to, direction) {
@@ -412,7 +419,7 @@ Cube.prototype = {
412419
scale_x: 1 - 2 * settings.pullaway,
413420
scale_y: 1 - 2 * settings.pullaway,
414421
x: x_pos,
415-
transition: settings.scaleEffect,
422+
transition: settings.getScaleEffect(),
416423
time: settings.animationTime,
417424
onCompleteParams: [from, to, direction],
418425
onComplete: this.rotate_mid,
@@ -424,6 +431,8 @@ Cube.prototype = {
424431
this.isAnimating = true;
425432
this.setDesktopClonesVisible(from, false);
426433
this.setDesktopClonesVisible(to, false);
434+
from.show();
435+
to.show();
427436

428437
let angle_from;
429438
let angle_to;
@@ -438,14 +447,14 @@ Cube.prototype = {
438447
Tweener.addTween(from, {
439448
x: global.stage.width / 2,
440449
rotation_angle_y: angle_from,
441-
transition: settings.rotateEffect,
450+
transition: settings.getRotateEffect(),
442451
time: settings.animationTime,
443452
});
444453

445454
Tweener.addTween(to, {
446455
x: global.stage.width / 2,
447456
rotation_angle_y: angle_to,
448-
transition: settings.rotateEffect,
457+
transition: settings.getRotateEffect(),
449458
time: settings.animationTime,
450459
onCompleteParams: [from, to, direction],
451460
onComplete: this.rotate_end,
@@ -455,6 +464,9 @@ Cube.prototype = {
455464

456465
rotate_end: function(from, to, direction) {
457466
to.get_parent().set_child_above_sibling(to, null);
467+
from.show();
468+
to.show();
469+
458470
let x_pos;
459471
let angle_from;
460472
if (direction === Meta.MotionDirection.LEFT) {
@@ -468,14 +480,14 @@ Cube.prototype = {
468480
Tweener.addTween(from, {
469481
x: x_pos,
470482
rotation_angle_y: angle_from,
471-
transition: settings.unrotateEffect,
483+
transition: settings.getUnrotateEffect(),
472484
time: settings.animationTime,
473485
});
474486

475487
Tweener.addTween(to, {
476488
x: x_pos,
477489
rotation_angle_y: 0,
478-
transition: settings.unrotateEffect,
490+
transition: settings.getUnrotateEffect(),
479491
time: settings.animationTime,
480492
onComplete: this.unsetIsAnimating,
481493
onCompleteScope: this,
@@ -504,7 +516,7 @@ Cube.prototype = {
504516
scale_x: 1.0,
505517
scale_y: 1.0,
506518
x: x_pos,
507-
transition: settings.unscaleEffect,
519+
transition: settings.getUnscaleEffect(),
508520
time: settings.animationTime,
509521
onComplete: this.destroy,
510522
onCompleteScope: this,
@@ -549,9 +561,9 @@ Cube.prototype = {
549561
this.setDesktopClonesVisible(this.from, true);
550562
this.setDesktopClonesVisible(this.to, true);
551563
}
552-
Main.wm.showWorkspaceOSD();
553564
this.isAnimating = false;
554565
if (this.destroy_requested) this.onDestroy();
566+
Main.wm.showWorkspaceOSD();
555567
},
556568

557569
_keyPressEvent: function(actor, event) {
@@ -669,17 +681,43 @@ function CubeSettings(uuid) {
669681
CubeSettings.prototype = {
670682
_init: function(uuid) {
671683
this.settings = new Settings.ExtensionSettings(this, uuid);
672-
this.settings.bindProperty( Settings.BindingDirection.IN, 'animationTime', 'animationTime', null);
684+
this.settings.bindProperty(Settings.BindingDirection.IN, 'animationTime', 'animationTime', null);
673685
this.settings.bindProperty(Settings.BindingDirection.IN, 'pullaway', 'pullaway', null);
674-
this.settings.bindProperty(Settings.BindingDirection.IN, 'scaleEffect', 'scaleEffect', null);
675-
this.settings.bindProperty(Settings.BindingDirection.IN, 'unscaleEffect', 'unscaleEffect', null);
676-
this.settings.bindProperty(Settings.BindingDirection.IN, 'rotateEffect', 'rotateEffect', null);
677-
this.settings.bindProperty(Settings.BindingDirection.IN, 'unrotateEffect', 'unrotateEffect', null);
686+
this.settings.bindProperty(Settings.BindingDirection.IN, 'newScaleEffect', 'newScaleEffect', null);
687+
this.settings.bindProperty(Settings.BindingDirection.IN, 'newRotateEffect', 'newRotateEffect', null);
688+
this.settings.bindProperty(Settings.BindingDirection.IN, 'includePanels', 'includePanels', null);
689+
},
690+
691+
getScaleEffect: function() {
692+
return "easeIn" + settings.newScaleEffect;
693+
},
694+
695+
getUnscaleEffect: function() {
696+
return "easeOut" + settings.newScaleEffect;
697+
},
698+
699+
getRotateEffect: function() {
700+
return "easeIn" + settings.newRotateEffect;
701+
},
702+
703+
getUnrotateEffect: function() {
704+
return "easeOut" + settings.newRotateEffect;
678705
}
679706
};
680707

681708
function init(metadata) {
682709
settings = new CubeSettings(metadata.uuid);
710+
711+
log( `animationTime: ${settings.animationTime}` );
712+
log( `pullaway: ${settings.pullaway}` );
713+
log( `scaleEffect: ${settings.newScaleEffect}` );
714+
log( `rotateEffect: ${settings.newRotateEffect}` );
715+
log( `includePanels: ${settings.includePanels}` );
716+
717+
log( `getScaleEffect: ${settings.getScaleEffect()}` );
718+
log( `getUnscaleEffect: ${settings.getUnscaleEffect()}` );
719+
log( `getRotateEffect: ${settings.getRotateEffect()}` );
720+
log( `getUnrotateEffect: ${settings.getUnrotateEffect()}` );
683721
}
684722

685723
function enable() {

DesktopCube@yare/files/DesktopCube@yare/5.4/settings-schema.json

+37-18
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,51 @@
1919
"default" : 0.05,
2020
"step" : 0.0001
2121
},
22+
"includePanels" : {
23+
"type" : "checkbox",
24+
"description" : "Include Panels",
25+
"default" : false
26+
},
2227
"sep1": {
2328
"type": "separator"
2429
},
2530
"header2" : {
2631
"type" : "header",
2732
"description" : "Effects"
2833
},
29-
"scaleEffect": {
30-
"type": "tween",
34+
"newScaleEffect": {
35+
"type": "combobox",
3136
"description": "Scale effect",
32-
"default": "easeOutQuad"
33-
},
34-
"unscaleEffect": {
35-
"type": "tween",
36-
"description": "Unscale effect",
37-
"default": "easeOutQuad"
38-
},
39-
"rotateEffect": {
40-
"type": "tween",
41-
"description": "Begin rotate effect",
42-
"default": "easeInQuad"
43-
},
44-
"unrotateEffect": {
45-
"type": "tween",
46-
"description": "End rotate effect",
47-
"default": "easeOutQuad"
37+
"default": "Quad",
38+
"options": {
39+
"Back": "Back",
40+
"Bounce": "Bounce",
41+
"Circ": "Circ",
42+
"Cubic": "Cubic",
43+
"Elastic": "Elastic",
44+
"Expo": "Expo",
45+
"Sine": "Sine",
46+
"Quad": "Quad",
47+
"Quart": "Quart",
48+
"Quint": "Quint"
49+
}
50+
},
51+
"newRotateEffect": {
52+
"type": "combobox",
53+
"description": "Rotate effect",
54+
"default": "Quad",
55+
"options": {
56+
"Back": "Back",
57+
"Bounce": "Bounce",
58+
"Circ": "Circ",
59+
"Cubic": "Cubic",
60+
"Elastic": "Elastic",
61+
"Expo": "Expo",
62+
"Sine": "Sine",
63+
"Quad": "Quad",
64+
"Quart": "Quart",
65+
"Quint": "Quint"
66+
}
4867
},
4968
"header3": {
5069
"type" : "header",

DesktopCube@yare/files/DesktopCube@yare/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"4.6",
1717
"5.4"
1818
],
19-
"version": "1.0.1",
19+
"version": "1.0.2",
2020
"uuid": "DesktopCube@yare",
2121
"name": "Desktop Cube",
2222
"description": "Compiz Cube-like animation for workspace switching",

0 commit comments

Comments
 (0)