|
|
66b32e |
From 3d32ab1848011a3a7af97255307b3541a7553b09 Mon Sep 17 00:00:00 2001
|
|
|
66b32e |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
66b32e |
Date: Wed, 14 Dec 2022 16:55:51 +0100
|
|
|
66b32e |
Subject: [PATCH] classification-banner: Handle fullscreen monitors
|
|
|
66b32e |
|
|
|
66b32e |
When a monitor is in fullscreen, we don't want its classification
|
|
|
66b32e |
banner to be offset by an imaginary panel, but at the top of the
|
|
|
66b32e |
screen.
|
|
|
66b32e |
---
|
|
|
66b32e |
extensions/classification-banner/extension.js | 22 +++++++++++++++----
|
|
|
66b32e |
1 file changed, 18 insertions(+), 4 deletions(-)
|
|
|
66b32e |
|
|
|
66b32e |
diff --git a/extensions/classification-banner/extension.js b/extensions/classification-banner/extension.js
|
|
|
66b32e |
index 6c2fe007..1cf03b3f 100644
|
|
|
66b32e |
--- a/extensions/classification-banner/extension.js
|
|
|
66b32e |
+++ b/extensions/classification-banner/extension.js
|
|
|
66b32e |
@@ -27,16 +27,19 @@ const Main = imports.ui.main;
|
|
|
66b32e |
const ClassificationBanner = GObject.registerClass(
|
|
|
66b32e |
class ClassificationBanner extends Clutter.Actor {
|
|
|
66b32e |
_init(index) {
|
|
|
66b32e |
+ const constraint = new Layout.MonitorConstraint({index});
|
|
|
66b32e |
super._init({
|
|
|
66b32e |
layout_manager: new Clutter.BinLayout(),
|
|
|
66b32e |
- constraints: new Layout.MonitorConstraint({
|
|
|
66b32e |
- work_area: true,
|
|
|
66b32e |
- index,
|
|
|
66b32e |
- }),
|
|
|
66b32e |
+ constraints: constraint,
|
|
|
66b32e |
});
|
|
|
66b32e |
+ this._monitorConstraint = constraint;
|
|
|
66b32e |
|
|
|
66b32e |
this._settings = ExtensionUtils.getSettings();
|
|
|
66b32e |
this.connect('destroy', () => {
|
|
|
66b32e |
+ if (this._fullscreenChangedId)
|
|
|
66b32e |
+ global.display.disconnect(this._fullscreenChangedId);
|
|
|
66b32e |
+ delete this._fullscreenChangedId;
|
|
|
66b32e |
+
|
|
|
66b32e |
if (this._settings)
|
|
|
66b32e |
this._settings.run_dispose();
|
|
|
66b32e |
this._settings = null;
|
|
|
66b32e |
@@ -95,6 +98,11 @@ class ClassificationBanner extends Clutter.Actor {
|
|
|
66b32e |
userLabel, 'visible',
|
|
|
66b32e |
Gio.SettingsBindFlags.GET);
|
|
|
66b32e |
|
|
|
66b32e |
+ this._fullscreenChangedId =
|
|
|
66b32e |
+ global.display.connect('in-fullscreen-changed',
|
|
|
66b32e |
+ () => this._updateMonitorConstraint());
|
|
|
66b32e |
+ this._updateMonitorConstraint();
|
|
|
66b32e |
+
|
|
|
66b32e |
this._settings.connect('changed::color',
|
|
|
66b32e |
() => this._updateStyles());
|
|
|
66b32e |
this._settings.connect('changed::background-color',
|
|
|
66b32e |
@@ -111,6 +119,12 @@ class ClassificationBanner extends Clutter.Actor {
|
|
|
66b32e |
return `${key}: rgba(${red},${green},${blue},${alpha / 255});`;
|
|
|
66b32e |
}
|
|
|
66b32e |
|
|
|
66b32e |
+ _updateMonitorConstraint() {
|
|
|
66b32e |
+ const {index} = this._monitorConstraint;
|
|
|
66b32e |
+ this._monitorConstraint.work_area =
|
|
|
66b32e |
+ !global.display.get_monitor_in_fullscreen(index);
|
|
|
66b32e |
+ }
|
|
|
66b32e |
+
|
|
|
66b32e |
_updateStyles() {
|
|
|
66b32e |
const bgStyle = this._getColorSetting('background-color');
|
|
|
66b32e |
const fgStyle = this._getColorSetting('color');
|
|
|
66b32e |
--
|
|
|
66b32e |
2.38.1
|
|
|
66b32e |
|