Skip to content

Commit 24c3293

Browse files
authored
[CinnamonMagicLamp@klangman] Fix for restore/maximize effects (#762)
The ShouldAnimateManager was failing to call the original Cinnamon _shouldAnimate() function for cases where the event context was not one that the manager is currently interested in. This meant that some Cinnamon's effects like maximize and restore (and maybe others) were failing to execute.
1 parent e590875 commit 24c3293

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

CinnamonMagicLamp@klangman/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.3
4+
5+
* Fix an issue that caused some default Cinnamon effect (i.e. Restore and Maximize effects) to be disabled when Magic Lamp effects were enabled.
6+
37
## 1.0.2
48

59
* Removed the need to change the System-Settings->Effect settings to "none" for the Minimize/Unminimize options. This is now accomplished by intercepting a cinnamon API and forcing it to disable the Cinnamon Minimize/Unminimize effects while the MagicLamp extension is enabled.

CinnamonMagicLamp@klangman/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# CinnamonMagicLamp
22

3-
A compiz like magic lamp effect for the Cinnamon desktop based on hermes83's Gnome extension (https://github.com/hermes83/compiz-alike-magic-lamp-effect)
3+
A compiz like magic lamp effect for the Cinnamon desktop based on hermes83's Gnome extension (https://github.com/hermes83/compiz-alike-magic-lamp-effect). **Please see Feedback section below to report issues, DO NOT open issues on hermes83's Gnome extension github**
44

55
This Cinnamon extension will create a Magic Lamp minimize and unminimize effect
66

77
## Requirements
88

99
Cinnamon 5.6.8 (Mint 21.1) or better.
1010

11-
To properly animate in relation to the window-list icon, you need to be using a window-list applet that sets the icon geometry. Otherwise the animation will animate from/to the middle of the monitor on the Cinnamon panel edge rather than an animation specific to the window. The pre-installed "Window list" and "Grouped window list" applets work fine as does "Cassia Window list" (version 2.3.2 or better). CobiWindowList does not currently set icon geometry.
11+
To properly animate in relation to the window-list icon, you need to be using a window-list applet that sets the icon geometry. Otherwise the animation will animate from/to the middle of the monitor on the Cinnamon panel edge rather than an animation specific to the window and it's window-list icon. The pre-installed "Window list" and "Grouped window list" applets work fine as does "Cassia Window list" (version 2.3.2 or better). CobiWindowList does not currently set icon geometry.
1212

1313
This extension requires no other packages other than what is included in a default installation of Mint 21.1 or better.
1414

1515
## Known issues
1616

17-
The Steam client for some reason does not support window cloning when minimized, therefore the "minimize" effect will show a blank/black window rather than the correct window contents. Other application might have the same behaviour but I have not seen any yet.
17+
For some reason the Steam client does not support window cloning when minimized, therefore the "minimize" effect will show a blank/black window rather than the correct window contents. I have not seen any other applications show this behaviour.
1818

1919
## Installation
2020

CinnamonMagicLamp@klangman/files/CinnamonMagicLamp@klangman/5.6/ShouldAnimateManager.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class ShouldAnimateManager {
6868
}
6969

7070
disconnect() {
71-
log( "in disconnect" );
7271
for (let i=0 ; i<Main.wm._shouldAnimateManager.length ; i++) {
7372
if (Main.wm._shouldAnimateManager[i].owner == this._uuid) {
7473
Main.wm._shouldAnimateManager.splice( i, 1 );
@@ -88,21 +87,23 @@ class ShouldAnimateManager {
8887
}
8988

9089
handler(actor, types) {
91-
const isNormalWindow = actor.meta_window.window_type == Meta.WindowType.NORMAL;
92-
const isDialogWindow = actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || actor.meta_window.window_type == Meta.WindowType.DIALOG;
90+
if (actor) {
91+
const isNormalWindow = actor.meta_window.window_type == Meta.WindowType.NORMAL;
92+
const isDialogWindow = actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || actor.meta_window.window_type == Meta.WindowType.DIALOG;
9393

94-
if (isNormalWindow || isDialogWindow) {
95-
let stack = (new Error()).stack;
96-
let event = (stack.includes('_minimizeWindow@' )) ? Events.Minimize : 0;
97-
event += (stack.includes('_unminimizeWindow@')) ? Events.Unminimize : 0;
98-
event += (stack.includes('_mapWindow@' )) ? Events.MapWindow : 0;
99-
event += (stack.includes('_destroyWindow@' )) ? Events.DestroyWindow : 0;
94+
if (isNormalWindow || isDialogWindow) {
95+
let stack = (new Error()).stack;
96+
let event = (stack.includes('_minimizeWindow@' )) ? Events.Minimize : 0;
97+
event += (stack.includes('_unminimizeWindow@')) ? Events.Unminimize : 0;
98+
event += (stack.includes('_mapWindow@' )) ? Events.MapWindow : 0;
99+
event += (stack.includes('_destroyWindow@' )) ? Events.DestroyWindow : 0;
100100

101-
for (let i=0 ; i<Main.wm._shouldAnimateManager.length ; i++) {
102-
if (event === (Main.wm._shouldAnimateManager[i].event & event)) {
103-
let ret = Main.wm._shouldAnimateManager[i].handler(actor, types, event);
104-
if (ret != RUN_ORIGINAL_FUNCTION) {
105-
return ret;
101+
for (let i=0 ; i<Main.wm._shouldAnimateManager.length ; i++) {
102+
if (event && event === (Main.wm._shouldAnimateManager[i].event & event)) {
103+
let ret = Main.wm._shouldAnimateManager[i].handler(actor, types, event);
104+
if (ret != RUN_ORIGINAL_FUNCTION) {
105+
return ret;
106+
}
106107
}
107108
}
108109
}

CinnamonMagicLamp@klangman/files/CinnamonMagicLamp@klangman/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"uuid": "CinnamonMagicLamp@klangman",
33
"name": "Magic Lamp Effect",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"description": "A minimize/unminimize magic lamp effect based on hermes83's Gnome extension",
66
"url": "https://github.com/klangman/CinnamonMagicLamp",
77
"website": "https://github.com/klangman/CinnamonMagicLamp",

0 commit comments

Comments
 (0)