Re: [dev] [st] Feature to replace st window by spawned x window

From: Hadrian Węgrzynowski <hadrian_AT_hawski.com>
Date: Tue, 29 Apr 2014 09:14:51 +0200

Dnia 2014-04-28, o godz. 17:17:56
Nick <suckless-dev_AT_njw.me.uk> napisał(a):

> Esteemed comrades,
>
> I remember reading ages ago about how graphical programs launched
> from Plan9's terminal thing (/editor/whatever) replace the window
> it's in. I would really love a patch for st to do the same. So I
> could type 'mupdf mything.pdf' and mupdf launches in the same window
> as st was inhabiting, with st magically returning once mupdf exits.
>
> Does someone with more knowledge of X11 know whether this is likely
> to be readily do-able? Can you launch an arbitrary X program and say
> "use this window"? I'm guessing not, but don't really know.
>
> There are disadvantages to this approach, the main one being hiding
> stdout & stderr. But I still think it could be interesting.
>
> Nick
>

It's possible with X11 proxy and tabbed. I experimented a bit in this
area. Proxy basically changes root window for it's clients to specified
window (e.g. tabbed). So I called it chrwin (change root window).

Example:

chrwin fakeroot-xid [program arg1 ...]

$ chrwin `tabbed` st

Ideally it should work in that way:
1. On start chrwin checks root window id.
2. Creates socket for proxy, sets DISPLAY and optionally proper xauth.
3. For every client's create window request with parent xid same as real
root window:
3.1. Change real root xid to fake root xid and send this to X11 server.
3.2. Send to client reparent notify with fake root xid.

It should also check for window type (it's in separate request),
because dialog boxes etc. shouldn't be reparented.

Tabbed can hide it's tab bar.

As noname said it's not possible for every program out there such as
multi-window programs.

I didn't have time to finish such proxy, but I have WIP (it's all
hardcoded and it worked):
http://hawski.com/chrwin/chrwin.c
Received on Tue Apr 29 2014 - 09:14:51 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 29 2014 - 09:24:06 CEST