Skip to content

Commit

Permalink
Cut down of log output by doing check on space before changing it.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtaala committed Mar 30, 2024
1 parent 3b03b62 commit fca46d6
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -4786,17 +4786,24 @@ export function takeWindow(metaWindow, space, { navigator }) {
navigator.showTakeHint(true);
navigator._moving = [];

const selectedSpace = () => spaces.selectedSpace;
const changeSpace = metaWindow => {
const space = selectedSpace();
if (spaces.spaceOfWindow(metaWindow) !== space) {
metaWindow.change_workspace(space.workspace);
}
};

/**
* Cycling function which orders the navigator._moving
* array according to direction.
*/
const selectedSpace = () => spaces.selectedSpace;
const cycler = order => {
const temparr = [];
order(navigator._moving);
navigator._moving.forEach(w => {
temparr.push(w);
w.change_workspace(selectedSpace().workspace);
changeSpace(w);
insertWindow(w, { existing: true });
});

Expand All @@ -4815,7 +4822,7 @@ export function takeWindow(metaWindow, space, { navigator }) {
// remove the last window you got
const pop = navigator._moving.pop();
if (pop) {
pop.change_workspace(selectedSpace().workspace);
changeSpace(pop);
insertWindow(pop, { existing: true });
// make space selectedWindow (keeps index for next insert)
selectedSpace().selectedWindow = pop;
Expand All @@ -4840,7 +4847,7 @@ export function takeWindow(metaWindow, space, { navigator }) {
// close all taken windows
case Clutter.KEY_q: {
navigator._moving.forEach(w => {
w.change_workspace(selectedSpace().workspace);
changeSpace(w);
insertWindow(w, { existing: true });
w.delete(global.get_current_time());
});
Expand All @@ -4859,13 +4866,11 @@ export function takeWindow(metaWindow, space, { navigator }) {
navigator.showTakeHint(false);
let selectedSpace = spaces.selectedSpace;
navigator._moving.forEach(w => {
w.change_workspace(selectedSpace.workspace);
if (w.get_workspace() === selectedSpace.workspace) {
insertWindow(w, { existing: true });
changeSpace(w);
insertWindow(w, { existing: true });

// make space selectedWindow (keeps index for next insert)
selectedSpace.selectedWindow = w;
}
// make space selectedWindow (keeps index for next insert)
selectedSpace.selectedWindow = w;
});

// activate last metaWindow after taken windows inserted
Expand Down

0 comments on commit fca46d6

Please sign in to comment.