(dir = 1)
| 5576 | } |
| 5577 | |
| 5578 | export function cycleWorkspaceSettings(dir = 1) { |
| 5579 | let n = workspaceManager.get_n_workspaces(); |
| 5580 | let N = workspaceSettings.getWorkspaceList().get_strv('list').length; |
| 5581 | let space = spaces.selectedSpace; |
| 5582 | let wsI = space.index; |
| 5583 | |
| 5584 | // 2 6 7 8 <-- indices |
| 5585 | // x a b c <-- settings |
| 5586 | // a b c x <-- rotated settings |
| 5587 | |
| 5588 | let uuids = workspaceSettings.getWorkspaceList().get_strv('list'); |
| 5589 | // Work on tuples of [uuid, settings] since we need to uuid association |
| 5590 | // in the last step |
| 5591 | let settings = uuids.map( |
| 5592 | uuid => [uuid, workspaceSettings.getWorkspaceSettingsByUUID(uuid)] |
| 5593 | ); |
| 5594 | settings.sort((a, b) => a[1].get_int('index') - b[1].get_int('index')); |
| 5595 | |
| 5596 | let unbound = settings.slice(n); |
| 5597 | let strip = [settings[wsI]].concat(unbound); |
| 5598 | |
| 5599 | strip = rotated(strip, dir); |
| 5600 | |
| 5601 | let nextSettings = strip[0]; |
| 5602 | unbound = strip.slice(1); |
| 5603 | |
| 5604 | nextSettings[1].set_int('index', wsI); |
| 5605 | space.setSettings(nextSettings); // ASSUMPTION: ok that two settings have same index here |
| 5606 | |
| 5607 | // Re-assign unbound indices: |
| 5608 | for (let i = n; i < N; i++) { |
| 5609 | unbound[i - n][1].set_int('index', i); |
| 5610 | } |
| 5611 | return space; |
| 5612 | } |
| 5613 | |
| 5614 | // Backward compatibility |
| 5615 | export function defwinprop(...args) { |
nothing calls this directly
no test coverage detected