fix for multi monitors, changing geometry, different panel locations
This commit is contained in:
+7
-7
@@ -40,6 +40,7 @@ function patcher(obj, method, original, patch) {
|
|||||||
eval(`${obj}.prototype.${method} = ${newBody}`);
|
eval(`${obj}.prototype.${method} = ${newBody}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getMessageTraySize = () => ({ width, height } = Main.layoutManager.getWorkAreaForMonitor(global.display.get_current_monitor()));
|
||||||
|
|
||||||
const originalShow = MessageTray.prototype._showNotification;
|
const originalShow = MessageTray.prototype._showNotification;
|
||||||
const originalHide = MessageTray.prototype._hideNotification;
|
const originalHide = MessageTray.prototype._hideNotification;
|
||||||
@@ -52,10 +53,10 @@ function calcTarget(self) {
|
|||||||
x = 0;
|
x = 0;
|
||||||
break;
|
break;
|
||||||
case 1: // right
|
case 1: // right
|
||||||
x = global.screen_width - self._banner.width;
|
x = getMessageTraySize().width - self._banner.width;
|
||||||
break;
|
break;
|
||||||
case 2: // center
|
case 2: // center
|
||||||
x = (global.screen_width - self._banner.width) / 2.0;
|
x = (getMessageTraySize().width - self._banner.width) / 2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (ANCHOR_VERTICAL) {
|
switch (ANCHOR_VERTICAL) {
|
||||||
@@ -63,13 +64,12 @@ function calcTarget(self) {
|
|||||||
y = 0;
|
y = 0;
|
||||||
break;
|
break;
|
||||||
case 1: // bottom
|
case 1: // bottom
|
||||||
y = global.screen_height - self._banner.height;
|
y = getMessageTraySize().height - self._banner.height;
|
||||||
break;
|
break;
|
||||||
case 2: // center
|
case 2: // center
|
||||||
y = (global.screen_height - self._banner.height) / 2.0;
|
y = (getMessageTraySize().height - self._banner.height) / 2.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { x, y }
|
return { x, y }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,13 +80,13 @@ function calcHide(self) {
|
|||||||
x = -self._banner.width;
|
x = -self._banner.width;
|
||||||
break;
|
break;
|
||||||
case 1: // from right
|
case 1: // from right
|
||||||
x = global.screen_width;
|
x = getMessageTraySize().width;
|
||||||
break;
|
break;
|
||||||
case 2: // from top
|
case 2: // from top
|
||||||
y = -self._banner.height
|
y = -self._banner.height
|
||||||
break;
|
break;
|
||||||
case 3: // from bottom
|
case 3: // from bottom
|
||||||
y = global.screen_height
|
y = getMessageTraySize().height
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user