Watch
1
0
Fork
You've already forked souveraine
0

dock lives on zone one; short swipe multitasks, big swipe goes home

This commit is contained in:
Fimeg 2026-08-05 16:17:47 -04:00
commit 277a0d2b32
3 changed files with 65 additions and 10 deletions

View file

@ -44,11 +44,34 @@ Singleton {
property var windows: []
signal windowsChanged_()
// Ask what is open. Answers into `windows`.
// Which zone is in front, as the compositor last reported it. -1 is
// "not asked yet" and is deliberately not 0: home is 0, so defaulting to it
// would make every surface believe it was on home before the first reply.
property int activeZone: -1
property int zoneCount: 0
// Home is zone 0, matching `workspace::HOME_ZONE` in the compositor. Named
// here rather than written as a literal at each call site so the two ends
// of the wire have one place to disagree if it ever moves.
readonly property int homeZone: 0
// Ask what is open, and where we are. Answers into `windows`/`activeZone`.
function refreshWindows() {
root._send({ op: "workspaces" });
}
// The zone is polled rather than pushed: the compositor has no subscription
// for it yet, and a surface that reads a stale zone shows the wrong
// furniture. Two seconds is slow enough to be free and fast enough that the
// dock does not visibly lag a zone change; a push channel would replace
// this and should.
Timer {
interval: 2000
running: true
repeat: true
triggeredOnStart: true
onTriggered: root.refreshWindows()
}
// Requests waiting on a connection. A queue rather than SessiondPolicy's
// single slot: the sheet can fire two verbs in a row (kill after a close
// that was refused), and dropping the second would be silent.
@ -208,6 +231,15 @@ Singleton {
root.windows = reply.windows;
root.windowsChanged_();
}
// `active` is an index and 0 is a real, meaningful value
// it is home so this must test for presence, not
// truthiness. `if (reply.active)` would silently ignore
// every report that we are on home, which is the one zone
// anything here cares about.
if (reply.active !== undefined)
root.activeZone = reply.active;
if (reply.count !== undefined)
root.zoneCount = reply.count;
root.succeeded(intent);
}
root._drain();