Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion tiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,11 @@ export const Spaces = class Spaces extends Map {
this.signals.connect(display, 'grab-op-begin', (display, mw, type) => grabBegin(mw, type));
this.signals.connect(display, 'grab-op-end', (display, mw, type) => grabEnd(mw, type));

this.signals.connect(display, 'window-demands-attention',
(display, metaWindow) => {
if (isTransient(metaWindow))
repositionTransient(metaWindow);
});

this.signals.connect(global.window_manager, 'switch-workspace',
(wm, from, to, _direction) => this.switchWorkspace(wm, from, to));
Expand Down Expand Up @@ -3373,6 +3378,29 @@ export function isTransient(metaWindow) {
}
}

// Reposition a transient/popup window into its monitor's work area so it's visible.
// Transients are real MetaWindows rejected by add_filter so the scroll machinery
// can't reach them — we clamp their frame rect directly via move_frame.
function repositionTransient(metaWindow) {
if (!metaWindow || !metaWindow.get_compositor_private())
return;

let frame = metaWindow.get_frame_rect();
let monitorIndex = metaWindow.get_monitor();
let workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex);

if (!workArea)
return;

let x = Math.max(workArea.x,
Math.min(frame.x, workArea.x + workArea.width - frame.width));
let y = Math.max(workArea.y,
Math.min(frame.y, workArea.y + workArea.height - frame.height));

if (x !== frame.x || y !== frame.y)
metaWindow.move_frame(true, x, y);
}

/**
* Returns true if a metaWindow has at least one transient window.
* @param metaWindow
Expand Down Expand Up @@ -4603,8 +4631,9 @@ export function focus_handler(metaWindow) {
return;
}

// If metaWindow is a transient window, return (after deselecting tiled focus indicators)
// If metaWindow is a transient window, reposition into view and return
if (isTransient(metaWindow)) {
repositionTransient(metaWindow);
setAllWorkspacesInactive();
return;
}
Expand Down