Computer control: reach windows on other workspaces and virtual desktops
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
Opening a web service in a browser whose window sat on another i3 workspace failed with "I could not select the intended window": the window list only covered visible workspaces, so the browser window was never found nor activated. - i3: leaves carry their workspace; hidden_leaves() lists windows on other workspaces and in the scratchpad. - KWin: the list script reports the desktop of non-current windows and activation switches to that desktop first. - Desktop::state(true) now includes those windows (minimized = true, desktop = workspace/desktop name), after the on-screen ones; state(false) is unchanged, so input and capture still only target visible windows. - App window lists given to the model tag them with otherDesktop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+119
-37
No files matched your search
@@ -418,10 +418,22 @@ impl Catalog {
|
||||
// ------------------------------------------------------------------ catalog actions
|
||||
|
||||
fn windows_payload(ws: &[DesktopWindow]) -> Value {
|
||||
Value::Array(ws.iter().map(|w| json!({"windowId": w.id, "untrustedTitle": w.title.chars().take(180).collect::<String>()})).collect())
|
||||
Value::Array(
|
||||
ws.iter()
|
||||
.map(|w| {
|
||||
let mut v = json!({"windowId": w.id, "untrustedTitle": w.title.chars().take(180).collect::<String>()});
|
||||
if !w.desktop.is_empty() {
|
||||
// Choosing it switches the owner's screen to that virtual desktop / workspace.
|
||||
v["otherDesktop"] = json!(w.desktop.chars().take(60).collect::<String>());
|
||||
}
|
||||
v
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Visible titled windows owned by the entry (<= 20).
|
||||
/// Titled windows owned by the entry (<= 20): on screen first, then minimized ones and those on
|
||||
/// other virtual desktops / i3 workspaces, which activation brings back.
|
||||
pub async fn windows_of(entry: &Entry, windows: &dyn Windows) -> Result<Vec<DesktopWindow>> {
|
||||
Ok(windows.state(true).await?.windows.into_iter().filter(|w| !w.title.trim().is_empty() && entry.owns(w)).take(20).collect())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user