Skip to content

Commit 5588ec5

Browse files
committed
Don't hide chrome if fullscreened app isn't focused
The current behaviour is to hide cinnamon's chrome on a monitor if the monitor has a fullscreened app. This commit changes that behaviour so that chrome isn't hidden unless the fullscreened app is focused on that monitor or the currently focused window is on another monitor.
1 parent 5438bd7 commit 5588ec5

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

js/ui/layout.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ Chrome.prototype = {
637637
global.display.connect('restacked',
638638
Lang.bind(this, this._windowsRestacked));
639639
global.display.connect('in-fullscreen-changed', Lang.bind(this, this._updateVisibility));
640+
global.display.connect('notify::focus-window', Lang.bind(this, this._updateVisibility));
641+
global.display.connect('window-monitor-changed', Lang.bind(this, this._updateVisibility));
640642
global.window_manager.connect('switch-workspace', Lang.bind(this, this._queueUpdateRegions));
641643

642644
// Need to update struts on new workspaces when they are added
@@ -773,18 +775,17 @@ Chrome.prototype = {
773775
},
774776

775777
_updateVisibility: function() {
776-
for (let i = 0; i < this._trackedActors.length; i++) {
777-
let actorData = this._trackedActors[i], visible;
778+
this._trackedActors.forEach( actorData => {
779+
const monitor = this.findMonitorForActor(actorData.actor);
780+
let visible = false;
778781
if (!actorData.isToplevel)
779-
continue;
782+
return;
780783
else if (global.stage_input_mode == Cinnamon.StageInputMode.FULLSCREEN) {
781-
let monitor = this.findMonitorForActor(actorData.actor);
782-
783784
if (global.display.get_n_monitors() == 1 || !monitor.inFullscreen) {
784785
visible = true;
785786
} else {
786787
if (Main.modalActorFocusStack.length > 0) {
787-
let modalActor = Main.modalActorFocusStack[Main.modalActorFocusStack.length - 1].actor;
788+
const modalActor = Main.modalActorFocusStack[Main.modalActorFocusStack.length - 1].actor;
788789

789790
if (this.findMonitorForActor(modalActor) == monitor) {
790791
visible = true;
@@ -794,15 +795,20 @@ Chrome.prototype = {
794795
} else if (this._inOverview)
795796
visible = true;
796797
else {
797-
let monitor = this.findMonitorForActor(actorData.actor);
798-
799-
if (!actorData.visibleInFullscreen && monitor && monitor.inFullscreen)
798+
const focusedWindow = global.display.get_focus_window();
799+
if (!actorData.visibleInFullscreen && focusedWindow && focusedWindow.is_fullscreen()
800+
&& focusedWindow.get_monitor() === monitor.index) {
800801
visible = false;
801-
else
802+
} else if (!actorData.visibleInFullscreen && monitor.inFullscreen
803+
&& focusedWindow && focusedWindow.get_monitor() != monitor.index) {
804+
visible = false;
805+
} else {
802806
visible = true;
807+
}
803808
}
804809
Main.uiGroup.set_skip_paint(actorData.actor, !visible);
805-
}
810+
});
811+
806812
this._queueUpdateRegions();
807813
},
808814

0 commit comments

Comments
 (0)