mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-10-06 11:56:54 +00:00
Move add window logic to add_filter
add_all_from_workspace needs the same logic as add_handler, so move it to the common add_filter. This fixes a regression from the last commit which caused scratch windows to inserted in a space when restarting Gnome Shell.
This commit is contained in:
@@ -524,12 +524,45 @@ function focus_wrapper(meta_window, user_data) {
|
||||
}
|
||||
|
||||
function add_filter(meta_window) {
|
||||
let add = true;
|
||||
if (meta_window.window_type != Meta.WindowType.NORMAL
|
||||
|| meta_window.get_transient_for() != null
|
||||
) {
|
||||
return false;
|
||||
add = false;
|
||||
}
|
||||
return true;
|
||||
|
||||
let winprop = find_winprop(meta_window);
|
||||
if (winprop) {
|
||||
if (winprop.oneshot) {
|
||||
// untested :)
|
||||
winprops.splice(winprops.indexOf(winprop), 1);
|
||||
}
|
||||
if (winprop.float) {
|
||||
// Let gnome-shell handle the placement
|
||||
add = false;
|
||||
}
|
||||
if (winprop.scratch_layer) {
|
||||
meta_window.stick();
|
||||
meta_window.make_above();
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're focusing a scratch window make on top and return
|
||||
let focus_window = global.display.focus_window;
|
||||
if (focus_window && focus_window.is_on_all_workspaces()) {
|
||||
meta_window.stick();
|
||||
meta_window.make_above();
|
||||
add = false;
|
||||
}
|
||||
|
||||
// If the window is a scratch window make it always on top
|
||||
if (meta_window.is_on_all_workspaces()) {
|
||||
meta_window.make_above();
|
||||
add = false;
|
||||
}
|
||||
|
||||
return add;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -591,37 +624,6 @@ function add_handler(ws, meta_window) {
|
||||
return;
|
||||
}
|
||||
|
||||
let winprop = find_winprop(meta_window);
|
||||
if (winprop) {
|
||||
if (winprop.oneshot) {
|
||||
// untested :)
|
||||
winprops.splice(winprops.indexOf(winprop), 1);
|
||||
}
|
||||
if (winprop.float) {
|
||||
// Let gnome-shell handle the placement
|
||||
return;
|
||||
}
|
||||
if (winprop.scratch_layer) {
|
||||
meta_window.stick();
|
||||
meta_window.make_above();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're focusing a scratch window make on top and return
|
||||
let focus_window = global.display.focus_window;
|
||||
if (focus_window && focus_window.is_on_all_workspaces()) {
|
||||
meta_window.stick();
|
||||
meta_window.make_above();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the window is a scratch window make it always on top
|
||||
if (meta_window.is_on_all_workspaces()) {
|
||||
meta_window.make_above();
|
||||
return;
|
||||
}
|
||||
|
||||
let space = spaces.spaceOf(ws);
|
||||
|
||||
// Don't add already added windows
|
||||
|
||||
Reference in New Issue
Block a user