split chooser names its windows and brings the pick to the zone
This commit is contained in:
parent
9ec031c8a8
commit
9b470b8e22
2 changed files with 30 additions and 6 deletions
|
|
@ -279,11 +279,18 @@ Scope {
|
|||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
// The compositor answers with ids, not titles —
|
||||
// `workspaces` carries {id, workspace}. A title
|
||||
// needs foreign-toplevel, which is a separate
|
||||
// lookup; showing the id is honest until then.
|
||||
text: "window " + parent.modelData.id
|
||||
elide: Text.ElideRight
|
||||
width: parent.width - 24
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
// The strip carries app_id and title now, so this
|
||||
// names the window instead of numbering it. Falls
|
||||
// back to the id rather than to blank: a chooser
|
||||
// row you cannot identify is worse than an ugly one.
|
||||
text: {
|
||||
const w = parent.modelData;
|
||||
const name = w.title || w.app_id || ("window " + w.id);
|
||||
return w.floating ? name + " (float)" : name;
|
||||
}
|
||||
color: Appearance.colors.colOnLayer1
|
||||
font.pixelSize: Appearance.font.pixelSize.small
|
||||
}
|
||||
|
|
@ -292,7 +299,18 @@ Scope {
|
|||
id: pick
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
ViewtopControl.place(parent.modelData.id, 0,
|
||||
const pickId = parent.modelData.id;
|
||||
// Bring it here first. The chooser offers every
|
||||
// open window, and most of them are on another
|
||||
// zone — placing one without moving it puts the
|
||||
// other half of your split on a zone you are not
|
||||
// looking at, which reads as the pick doing
|
||||
// nothing.
|
||||
const here = ViewtopControl.windows
|
||||
.find(w => w.id === scope.target)?.workspace;
|
||||
if (here !== undefined && parent.modelData.workspace !== here)
|
||||
ViewtopControl.moveToZone(pickId, here);
|
||||
ViewtopControl.place(pickId, 0,
|
||||
win.height / 2, win.width, win.height / 2);
|
||||
scope.choosing = false;
|
||||
scope.dismiss();
|
||||
|
|
|
|||
|
|
@ -358,6 +358,12 @@ Singleton {
|
|||
root._send({ op: "workspace", to: to });
|
||||
}
|
||||
|
||||
// Move a window to a zone without going there. Same op, its other half —
|
||||
// `workspace` takes an optional surface and moves it before it looks.
|
||||
function moveToZone(id, to) {
|
||||
root._send({ op: "workspace", to: to, surface: id });
|
||||
}
|
||||
|
||||
function focus(id) {
|
||||
root.scene("focus", { id: id });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue