i3-companion: tentative to hanle OnlyOffice stealing focus

This commit is contained in:
Vincent Bernat 2023-06-07 19:42:35 +02:00
parent a2f2c410d3
commit c79fe3efb9

View file

@ -560,20 +560,26 @@ async def quake_console(i3, event):
term = quake_window.result() term = quake_window.result()
await term.command("move window to scratchpad") await term.command("move window to scratchpad")
workspaces = await i3.get_workspaces() if term in tree.scratchpad().descendants():
workspace = [ws for ws in workspaces if ws.focused][0] workspaces = await i3.get_workspaces()
ws_x, ws_y = workspace.rect.x, workspace.rect.y workspace = [ws for ws in workspaces if ws.focused][0]
ws_width, ws_height = workspace.rect.width, workspace.rect.height ws_x, ws_y = workspace.rect.x, workspace.rect.y
height = int(ws_height * height) ws_width, ws_height = workspace.rect.width, workspace.rect.height
command = ( height = int(ws_height * height)
f"[instance={term_name}] " command = (
"border none," f"[instance={term_name}] "
f"resize set {ws_width} px {height} px," "border none,"
"scratchpad show," f"resize set {ws_width} px {height} px,"
f"move absolute position {ws_x}px {ws_y}px" "scratchpad show,"
) f"move absolute position {ws_x}px {ws_y}px,"
logger.debug("QuakeConsole: %s", command) "focus"
await i3.command(command) )
logger.debug("QuakeConsole (show): %s", command)
await i3.command(command)
else:
command = f"[instance={term_name}] scratchpad show"
logger.debug("QuakeConsole (hide): %s", command)
await i3.command(command)
@on(CommandEvent("container-info")) @on(CommandEvent("container-info"))