Skip to content

Commit 2f884aa

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 current top level window.
1 parent 5438bd7 commit 2f884aa

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

js/ui/layout.js

Lines changed: 39 additions & 12 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,23 @@ 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+
const monitorsInFullscreen = [];
779+
this._monitors.forEach( monitor => {
780+
const topWindow = this._getTopWindowOnMonitor(monitor.index)
781+
monitorsInFullscreen[monitor.index] = topWindow && topWindow.is_fullscreen();
782+
});
783+
784+
this._trackedActors.forEach( actorData => {
785+
const monitor = this.findMonitorForActor(actorData.actor);
786+
let visible = false;
778787
if (!actorData.isToplevel)
779-
continue;
788+
return;
780789
else if (global.stage_input_mode == Cinnamon.StageInputMode.FULLSCREEN) {
781-
let monitor = this.findMonitorForActor(actorData.actor);
782-
783790
if (global.display.get_n_monitors() == 1 || !monitor.inFullscreen) {
784791
visible = true;
785792
} else {
786793
if (Main.modalActorFocusStack.length > 0) {
787-
let modalActor = Main.modalActorFocusStack[Main.modalActorFocusStack.length - 1].actor;
794+
const modalActor = Main.modalActorFocusStack[Main.modalActorFocusStack.length - 1].actor;
788795

789796
if (this.findMonitorForActor(modalActor) == monitor) {
790797
visible = true;
@@ -794,18 +801,38 @@ Chrome.prototype = {
794801
} else if (this._inOverview)
795802
visible = true;
796803
else {
797-
let monitor = this.findMonitorForActor(actorData.actor);
798-
799-
if (!actorData.visibleInFullscreen && monitor && monitor.inFullscreen)
800-
visible = false;
801-
else
804+
if (actorData.visibleInFullscreen || !monitorsInFullscreen[monitor.index]) {
802805
visible = true;
806+
}
803807
}
804808
Main.uiGroup.set_skip_paint(actorData.actor, !visible);
805-
}
809+
});
810+
806811
this._queueUpdateRegions();
807812
},
808813

814+
_getTopWindowOnMonitor: function(monitorIndex) {
815+
const focusedWindow = global.display.get_focus_window();
816+
if (focusedWindow && focusedWindow.get_monitor() === monitorIndex) {
817+
return focusedWindow;
818+
} else {
819+
let topWindow = null, topWindowTime = 0;
820+
global.get_window_actors().forEach(actor=> {
821+
const window = actor.meta_window;
822+
if (!window || window.get_monitor() !== monitorIndex ||
823+
window.minimized || !window.showing_on_its_workspace() ||
824+
window.get_workspace() !== global.workspace_manager.get_active_workspace())
825+
return;
826+
if (window.get_user_time() > topWindowTime) {
827+
topWindowTime = window.get_user_time();
828+
topWindow = window;
829+
}
830+
});
831+
832+
return topWindow;
833+
}
834+
},
835+
809836
_overviewShowing: function() {
810837
this._inOverview = true;
811838
this._updateVisibility();

js/ui/panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ PanelDummy.prototype = {
12931293

12941294
this.actor = new Cinnamon.GenericContainer({style_class: "panel-dummy", reactive: true, track_hover: true, important: true});
12951295

1296-
Main.layoutManager.addChrome(this.actor, { addToWindowgroup: false });
1296+
Main.layoutManager.addChrome(this.actor, { addToWindowgroup: false, visibleInFullscreen: true });
12971297
//
12981298
// layouts set to be full width horizontal panels, and vertical panels set to use as much available space as is left
12991299
//

0 commit comments

Comments
 (0)