-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from fredcw/master
[email protected]: Fix bug for mint version 20.3 and earlier.
- Loading branch information
Showing
5 changed files
with
224 additions
and
55 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
[email protected]/files/[email protected]/5.4/extension.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/*const St = imports.gi.St; | ||
const Lang = imports.lang; | ||
const Main = imports.ui.main;*/ | ||
const Clutter = imports.gi.Clutter; | ||
const Settings = imports.ui.settings; | ||
const Tweener = imports.ui.tweener; | ||
const Meta = imports.gi.Meta; | ||
|
||
let beginGrabOpId; | ||
let endGrabOpId; | ||
let settings; | ||
|
||
// globally unique strings, set in init() | ||
let tweenOpacity; | ||
let originalOpacity; | ||
// (nerdy note: we could have used the same string for both purposes! | ||
// but that'd be needlessly confusing) | ||
|
||
// opacity getter and setter for Tweener | ||
function getWindowOpacity(window, params, extra) { | ||
return window.get_opacity(); | ||
} | ||
|
||
function setWindowOpacity(window, value, params, extra) { | ||
window.set_opacity(value); | ||
} | ||
|
||
function init(metadata) | ||
{ | ||
settings = new SettingsHandler(metadata.uuid); | ||
|
||
// globally unique strings: | ||
tweenOpacity = "tween_opacity@" + metadata.uuid; | ||
originalOpacity = "original_opacity@" + metadata.uuid; | ||
|
||
// tell Tweener to call our set/get functions instead of setting opacity directly | ||
Tweener.registerSpecialProperty(tweenOpacity, getWindowOpacity, setWindowOpacity); | ||
} | ||
|
||
function SettingsHandler(uuid) { | ||
this._init(uuid); | ||
} | ||
|
||
SettingsHandler.prototype = { | ||
_init: function(uuid) { | ||
this.settings = new Settings.ExtensionSettings(this, uuid); | ||
this.settings.bindProperty(Settings.BindingDirection.IN, "opacity", "opacity", function(){}); | ||
this.settings.bindProperty(Settings.BindingDirection.IN, "beginTime", "beginTime", function(){}); | ||
this.settings.bindProperty(Settings.BindingDirection.IN, "beginEffect", "beginEffect", function(){}); | ||
this.settings.bindProperty(Settings.BindingDirection.IN, "endTime", "endTime", function(){}); | ||
this.settings.bindProperty(Settings.BindingDirection.IN, "endEffect", "endEffect", function(){}); | ||
} | ||
} | ||
|
||
// onStart and onComplete handlers for Tweener | ||
function windowSaveOriginalOpacity() { | ||
if (!(originalOpacity in this)) | ||
this[originalOpacity] = this.get_opacity(); | ||
} | ||
|
||
function windowDeleteOriginalOpacity() { | ||
delete this[originalOpacity]; | ||
} | ||
|
||
// window grab handler | ||
function onBeginGrabOp(display, screen, window, op) { | ||
if ((op == Meta.GrabOp.MOVING) || (op == Meta.GrabOp.KEYBOARD_MOVING) || | ||
(op == Meta.GrabOp.RESIZING_E) || (op == Meta.GrabOp.RESIZING_N) || | ||
(op == Meta.GrabOp.RESIZING_NE) || (op == Meta.GrabOp.RESIZING_NW) || | ||
(op == Meta.GrabOp.RESIZING_S) || (op == Meta.GrabOp.RESIZING_SE) || | ||
(op == Meta.GrabOp.RESIZING_SW) || (op == Meta.GrabOp.RESIZING_W) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_E) || (op == Meta.GrabOp.KEYBOARD_RESIZING_N) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_NE) || (op == Meta.GrabOp.KEYBOARD_RESIZING_NW) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_S) || (op == Meta.GrabOp.KEYBOARD_RESIZING_SE) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_SW) || (op == Meta.GrabOp.KEYBOARD_RESIZING_W)|| | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN)) | ||
{ | ||
// change opacity according to user's preference | ||
Tweener.addTween(window, { | ||
[tweenOpacity]: settings.opacity, | ||
time: settings.beginTime/1000, | ||
transition: settings.beginEffect, | ||
onStart: windowSaveOriginalOpacity, | ||
}); | ||
} | ||
} | ||
|
||
// window release handler | ||
function onEndGrabOp(display, screen, window, op) { | ||
if (!window || !(originalOpacity in window)) return; // releasing a window we haven't touched | ||
|
||
if ((op == Meta.GrabOp.MOVING) || (op == Meta.GrabOp.KEYBOARD_MOVING) || | ||
(op == Meta.GrabOp.RESIZING_E) || (op == Meta.GrabOp.RESIZING_N) || | ||
(op == Meta.GrabOp.RESIZING_NE) || (op == Meta.GrabOp.RESIZING_NW) || | ||
(op == Meta.GrabOp.RESIZING_S) || (op == Meta.GrabOp.RESIZING_SE) || | ||
(op == Meta.GrabOp.RESIZING_SW) || (op == Meta.GrabOp.RESIZING_W) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_E) || (op == Meta.GrabOp.KEYBOARD_RESIZING_N) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_NE) || (op == Meta.GrabOp.KEYBOARD_RESIZING_NW) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_S) || (op == Meta.GrabOp.KEYBOARD_RESIZING_SE) || | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_SW) || (op == Meta.GrabOp.KEYBOARD_RESIZING_W)|| | ||
(op == Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN)) | ||
{ | ||
// restore opacity to what it was before | ||
Tweener.addTween(window, { | ||
[tweenOpacity]: window[originalOpacity], | ||
time: settings.endTime/1000, | ||
transition: settings.endEffect, | ||
onComplete: windowDeleteOriginalOpacity, | ||
}); | ||
} | ||
} | ||
|
||
function enable() | ||
{ | ||
beginGrabOpId = global.display.connect('grab-op-begin', onBeginGrabOp); | ||
endGrabOpId = global.display.connect('grab-op-end', onEndGrabOp); | ||
} | ||
|
||
function disable() | ||
{ | ||
global.display.disconnect(beginGrabOpId); | ||
global.display.disconnect(endGrabOpId); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
[email protected]/files/[email protected]/5.4/settings-schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"opacity": { | ||
"type": "scale", | ||
"description": "Opacity", | ||
"min": 20, | ||
"max": 255, | ||
"step": 10, | ||
"default": 100 | ||
}, | ||
|
||
"sep1": { | ||
"type": "separator" | ||
}, | ||
|
||
"h1": { | ||
"type": "header", | ||
"description": "Start of Drag" | ||
}, | ||
|
||
"beginTime": { | ||
"type": "spinbutton", | ||
"description": "Transition time", | ||
"min": 0, | ||
"max": 2000, | ||
"step": 50, | ||
"units": "milliseconds", | ||
"default": 100 | ||
}, | ||
|
||
"beginEffect": { | ||
"type": "tween", | ||
"description": "Effect", | ||
"default": "easeOutSine" | ||
}, | ||
|
||
"sep2": { | ||
"type": "separator" | ||
}, | ||
|
||
"h2": { | ||
"type": "header", | ||
"description": "End of Drag" | ||
}, | ||
|
||
"endTime": { | ||
"type": "spinbutton", | ||
"description": "Transition time", | ||
"min": 0, | ||
"max": 2000, | ||
"step": 50, | ||
"units": "milliseconds", | ||
"default": 100 | ||
}, | ||
|
||
"endEffect": { | ||
"type": "tween", | ||
"description": "Effect", | ||
"default": "easeInSine" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
"2.2", | ||
"2.4" | ||
], | ||
"url": "https://github.com/AnishN/Cinnamon-Extensions.git", | ||
"url": "https://github.com/AnishN/Cinnamon-Extensions.git", | ||
"version": "1.0", | ||
"description": "Fade out the current window that the user is resizing or dragging.", | ||
"uuid": "[email protected]" | ||
} |