mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-06-28 21:20:06 +00:00
navigator: rewrite finish/destroy code
- Activate destination workspace if it isn't active, fake it if not. If a «stuck» window have focus, consider it selected. If selected window or one its transient window has focus, fake focus handler. Otherwise activate it.
This commit is contained in:
33
navigator.js
33
navigator.js
@@ -278,36 +278,29 @@ var Navigator = class Navigator {
|
||||
monitor.clickOverlay.activate();
|
||||
}
|
||||
|
||||
if (this.space === from && force) {
|
||||
if (this.space === from) {
|
||||
// Animate the selected space into full view - normally this
|
||||
// happens on workspace switch, but activating the same workspace
|
||||
// again doesn't trigger a switch signal
|
||||
Tiling.spaces.animateToSpace(this.space);
|
||||
force && Tiling.spaces.animateToSpace(this.space);
|
||||
} else {
|
||||
this.space.workspace.activate(global.get_current_time());
|
||||
}
|
||||
|
||||
selected = this.space.indexOf(selected) !== -1 ? selected :
|
||||
this.space.selectedWindow;
|
||||
|
||||
if (Tiling.inGrab && Tiling.inGrab.dnd) {
|
||||
Tiling.spaces.monitors.set(this.monitor, this.space);
|
||||
Tiling.spaces.animateToSpace(this.space);
|
||||
} else {
|
||||
if (selected &&
|
||||
(!force ||
|
||||
!(display.focus_window && display.focus_window.is_on_all_workspaces())) ) {
|
||||
let focus = display.focus_window;
|
||||
if (focus && focus.is_on_all_workspaces())
|
||||
selected = focus;
|
||||
|
||||
let hasFocus = selected.has_focus();
|
||||
selected.foreach_transient(mw => hasFocus = mw.has_focus() || hasFocus);
|
||||
if (!hasFocus) {
|
||||
Main.activateWindow(selected);
|
||||
} else {
|
||||
// Typically on cancel - the `focus` signal won't run
|
||||
// automatically, so we run it manually
|
||||
this.space.workspace.activate(global.get_current_time());
|
||||
Tiling.focus_handler(selected);
|
||||
}
|
||||
if (selected) {
|
||||
let hasFocus = selected && selected.has_focus();
|
||||
selected.foreach_transient(mw => hasFocus = mw.has_focus() || hasFocus);
|
||||
if (hasFocus) {
|
||||
Tiling.focus_handler(selected)
|
||||
} else {
|
||||
this.space.workspace.activate(global.get_current_time());
|
||||
Main.activateWindow(selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user