Skip to content

Commit 2c3e76a

Browse files
committed
Merge branch 'develop' into release
2 parents 80666c0 + 9721269 commit 2c3e76a

4 files changed

+79
-45
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ Swiping the trackpad horizontally with three fingers (only available in Wayland)
9595
| <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>Tab</kbd> | Cycle through previously active scratch windows |
9696
| <kbd>Shift</kbd><kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>Tab</kbd> | Cycle through previously active scratch windows (backward order) |
9797
| <kbd>Shift</kbd><kbd>Super</kbd><kbd>C</kbd> | Switch between window focus modes |
98-
| <kbd>Shift</kbd><kbd>Super</kbd><kbd>W</kbd> | Switch between positions for creating new windows |
99-
| _Not set by default (set in extension settings)_ | Create new windows to the right of current window |
100-
| _Not set by default (set in extension settings)_ | Create new windows to the left of current window |
101-
| _Not set by default (set in extension settings)_ | Create new windows in vertical stack (down) |
102-
| _Not set by default (set in extension settings)_ | Create new windows in vertical stack (up) |
103-
| _Not set by default (set in extension settings)_ | Create new windows at start position |
104-
| _Not set by default (set in extension settings)_ | Create new windows at end position |
98+
| <kbd>Shift</kbd><kbd>Super</kbd><kbd>W</kbd> | Switch between positions for creating/dropping new windows |
99+
| _Not set by default (set in extension settings)_ | Create/drop windows to the right of current window |
100+
| _Not set by default (set in extension settings)_ | Create/drop windows to the left of current window |
101+
| _Not set by default (set in extension settings)_ | Create/drop windows in vertical stack (down) |
102+
| _Not set by default (set in extension settings)_ | Create/drop windows in vertical stack (up) |
103+
| _Not set by default (set in extension settings)_ | Create/drop windows at start position |
104+
| _Not set by default (set in extension settings)_ | Create/drop windows at end position |
105105
| <kbd>Super</kbd><kbd>Ctrl</kbd><kbd>,</kbd> or <kbd>Super</kbd><kbd>Ctrl</kbd><kbd>.</kbd> | Move the current window to the left or right |
106106
| <kbd>Shift</kbd><kbd>Super</kbd><kbd>,</kbd> or <kbd>Shift</kbd><kbd>Super</kbd><kbd>.</kbd> | Move the current window to the left or right |
107107
| <kbd>Super</kbd><kbd>Ctrl</kbd><kbd>Left</kbd> or <kbd>Super</kbd><kbd>Ctrl</kbd><kbd>Right</kbd> | Move the current window to the left or right |
@@ -280,9 +280,9 @@ You do this by using the special "match all" operator `*` as an input for `wm_cl
280280
This special operator is at a lower precedence, so more specific properties that match a window will always take precedence and be applied.
281281
282282
283-
## Window insertion position for new windows
283+
## Window insertion position for new windows (and dropped windows in `take` mode)
284284
285-
By default PaperWM inserts new windows to the right of the currently active window. This behaviour can be changed via PaperWM settings, or with the `Open Window Position` button/icon (which is to the right of the focus mode icon):
285+
By default PaperWM inserts new windows (and drops windows in `take` mode, see [Managing multiple windows at once](#managing-multiple-windows-at-once)) to the right of the currently active window. This behaviour can be changed via PaperWM settings, or with the `Open Window Position` button/icon (which is to the right of the focus mode icon):
286286
287287
![Open positions button](media/open-position-button.png)
288288

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "https://github.com/paperwm/PaperWM",
66
"settings-schema": "org.gnome.shell.extensions.paperwm",
77
"shell-version": [ "45", "46" ],
8-
"version-name": "46.16.1",
8+
"version-name": "46.17.0",
99
"donations": {
1010
"buymeacoffee": "jaytaala",
1111
"patreon": "valpackett"

schemas/org.gnome.shell.extensions.paperwm.gschema.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -182,31 +182,31 @@
182182

183183
<key type="as" name="switch-open-window-position">
184184
<default><![CDATA[['<Super><Shift>w']]]></default>
185-
<summary>Switch between positions for creating windows (e.g. right, left)</summary>
185+
<summary>Switch between positions for creating/dropping windows</summary>
186186
</key>
187187
<key type="as" name="open-window-position-right">
188188
<default><![CDATA[[]]]></default>
189-
<summary>Create new windows to the right</summary>
189+
<summary>Create/drop windows to the right</summary>
190190
</key>
191191
<key type="as" name="open-window-position-left">
192192
<default><![CDATA[[]]]></default>
193-
<summary>Create new windows to the left</summary>
193+
<summary>Create/drop windows to the left</summary>
194194
</key>
195195
<key type="as" name="open-window-position-down">
196196
<default><![CDATA[[]]]></default>
197-
<summary>Create new windows in vertical stack (down)</summary>
197+
<summary>Create/drop windows in vertical stack (down)</summary>
198198
</key>
199199
<key type="as" name="open-window-position-up">
200200
<default><![CDATA[[]]]></default>
201-
<summary>Create new windows in vertical stack (up)</summary>
201+
<summary>Create/drop windows in vertical stack (up)</summary>
202202
</key>
203203
<key type="as" name="open-window-position-start">
204204
<default><![CDATA[[]]]></default>
205-
<summary>Create new windows at start position</summary>
205+
<summary>Create/drop windows at start position</summary>
206206
</key>
207207
<key type="as" name="open-window-position-end">
208208
<default><![CDATA[[]]]></default>
209-
<summary>Create new windows at end position</summary>
209+
<summary>Create/drop windows at end position</summary>
210210
</key>
211211

212212
<key type="as" name="switch-next">

tiling.js

+62-28
Original file line numberDiff line numberDiff line change
@@ -3964,7 +3964,11 @@ export function add_handler(_ws, metaWindow) {
39643964
and `Display::window-created` through `WindowActor::show` if window is newly
39653965
created to ensure that the WindowActor exists.
39663966
*/
3967-
export function insertWindow(metaWindow, { existing }) {
3967+
export function insertWindow(metaWindow, options = {}) {
3968+
const existing = options?.existing ?? false;
3969+
const dropping = options?.dropping ?? false;
3970+
const dropCallback = options?.dropCallback ?? function() {};
3971+
39683972
// Add newly created windows to the space being previewed
39693973
if (!existing &&
39703974
!metaWindow.is_on_all_workspaces() &&
@@ -4096,6 +4100,40 @@ export function insertWindow(metaWindow, { existing }) {
40964100
// run a simple layout in pre-prepare layout
40974101
space.layout(false);
40984102

4103+
const slurpCheck = timeout => {
4104+
let slurpPosition;
4105+
switch (Settings.prefs.open_window_position) {
4106+
case Settings.OpenWindowPositions.DOWN:
4107+
slurpPosition = SlurpInsertPosition.BELOW;
4108+
break;
4109+
case Settings.OpenWindowPositions.UP:
4110+
slurpPosition = SlurpInsertPosition.ABOVE;
4111+
break;
4112+
}
4113+
4114+
if (!slurpPosition) {
4115+
dropCallback(metaWindow);
4116+
return;
4117+
}
4118+
4119+
// has slurpPosition but no timeout
4120+
if (!timeout) {
4121+
slurp(active, slurpPosition);
4122+
dropCallback(metaWindow);
4123+
return;
4124+
}
4125+
4126+
// if need to slurp (i.e. vertical stack)
4127+
stackSlurpTimeout = GLib.timeout_add(
4128+
GLib.PRIORITY_DEFAULT,
4129+
100,
4130+
() => {
4131+
slurp(active, slurpPosition);
4132+
dropCallback(metaWindow);
4133+
return false; // on return false destroys timeout
4134+
});
4135+
};
4136+
40994137
/**
41004138
* If window is new, then setup and ensure is in view
41014139
* after actor is shown on stage.
@@ -4118,26 +4156,7 @@ export function insertWindow(metaWindow, { existing }) {
41184156
ensureViewport(space.selectedWindow, space);
41194157
space.setSpaceTopbarElementsVisible(true);
41204158

4121-
let slurpPosition;
4122-
switch (Settings.prefs.open_window_position) {
4123-
case Settings.OpenWindowPositions.DOWN:
4124-
slurpPosition = SlurpInsertPosition.BELOW;
4125-
break;
4126-
case Settings.OpenWindowPositions.UP:
4127-
slurpPosition = SlurpInsertPosition.ABOVE;
4128-
break;
4129-
}
4130-
4131-
// if need to slurp (i.e. vertical stack)
4132-
if (slurpPosition) {
4133-
stackSlurpTimeout = GLib.timeout_add(
4134-
GLib.PRIORITY_DEFAULT,
4135-
100,
4136-
() => {
4137-
slurp(active, slurpPosition);
4138-
return false; // on return false destroys timeout
4139-
});
4140-
}
4159+
slurpCheck(true);
41414160
});
41424161

41434162
return;
@@ -4152,6 +4171,10 @@ export function insertWindow(metaWindow, { existing }) {
41524171
} else {
41534172
ensureViewport(space.selectedWindow, space);
41544173
}
4174+
4175+
if (dropping) {
4176+
slurpCheck(false);
4177+
}
41554178
}
41564179

41574180
/**
@@ -5130,6 +5153,10 @@ export function slurp(metaWindow, insertAt = SlurpInsertPosition.BOTTOM) {
51305153
}
51315154

51325155
const space = spaces.spaceOfWindow(metaWindow);
5156+
if (!space) {
5157+
return;
5158+
}
5159+
51335160
const index = space.indexOf(metaWindow);
51345161
let to, from, metaWindowToSlurp;
51355162

@@ -5299,11 +5326,11 @@ export function moveUpSpace(_mw, _space) {
52995326
Detach the @metaWindow, storing it at the bottom right corner while
53005327
navigating. When done, insert all the detached windows again.
53015328
*/
5302-
export function takeWindow(metaWindow, space, params) {
5329+
export function takeWindow(metaWindow, space, options = {}) {
53035330
space = space ?? spaces.selectedSpace;
53045331
metaWindow = metaWindow ?? space.selectedWindow;
5305-
const navigator = params?.navigator ?? Navigator.getNavigator();
5306-
const existing = params?.existing ?? false;
5332+
const navigator = options?.navigator ?? Navigator.getNavigator();
5333+
const existing = options?.existing ?? false;
53075334

53085335
if (!existing && !space.removeWindow(metaWindow))
53095336
return;
@@ -5375,7 +5402,7 @@ export function takeWindow(metaWindow, space, params) {
53755402
const pop = navigator._moving.pop();
53765403
if (pop) {
53775404
changeSpace(pop);
5378-
insertWindow(pop, { existing: true });
5405+
insertWindow(pop, { existing: true, dropping: true });
53795406
// make space selectedWindow (keeps index for next insert)
53805407
selectedSpace().selectedWindow = pop;
53815408
ensureViewport(pop);
@@ -5400,8 +5427,15 @@ export function takeWindow(metaWindow, space, params) {
54005427
case Clutter.KEY_q: {
54015428
navigator._moving.forEach(w => {
54025429
changeSpace(w);
5403-
insertWindow(w, { existing: true });
5404-
w.delete(global.get_current_time());
5430+
insertWindow(
5431+
w,
5432+
{
5433+
existing: true,
5434+
dropping: true,
5435+
dropCallback: mw => {
5436+
mw.delete(global.get_current_time());
5437+
},
5438+
});
54055439
});
54065440

54075441
navigator._moving = [];
@@ -5421,7 +5455,7 @@ export function takeWindow(metaWindow, space, params) {
54215455
let selectedSpace = spaces.selectedSpace;
54225456
navigator._moving.forEach(w => {
54235457
changeSpace(w);
5424-
insertWindow(w, { existing: true });
5458+
insertWindow(w, { existing: true, dropping: true });
54255459

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

0 commit comments

Comments
 (0)