help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: API to control the GTK parts from Elisp


From: Basile Starynkevitch
Subject: Re: API to control the GTK parts from Elisp
Date: Fri, 25 Aug 2023 09:25:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0


On 8/25/23 03:47, Po Lu wrote:
Sébastien Gendre <seb@k-7.ch> writes:

Hello world!

On GNU/Linux, the GUI version use GTK for some parts, like the
header-bar, the tool-box, etc.

Is it possible to control these GTK elements from Elisp ? Like modifying
their CSS rules or the GTK theme applied ?


Best regards
Such features aren't available in Emacs Lisp.


But recent GNU emacs is (on Linux) already using dlopen and dlsym (in file emacs/src/dynlib.c)

So I guess it should not be too difficult to customize your GNU emacs source code (or its GNU Elisp scripts) to add the necessary Elisp primitives to control these GTK elements. Some C and Elisp code is needed.

A practical possibility (see https://arxiv.org/pdf/1109.0779.pdf ...) could even be to generate -in some temporary file- some short C code dynamically on the fly (using your Elisp scripts), compile that short C temporary code as a plugin, then have it dlopen-ed and dlsym-ed. Current Linux laptops are fast enough to make that compatible with human interaction. (e.g. generating 200 lines of C and compiling it into a shared object can be done in a fraction of a second, and is doable perhaps once every few keystrokes handed by GNU emacs).

Another practical possibility could be to develop (in a few hundred lines of C) your background process handling these.   The GNU emacs process would start it at initialization and communicate with it (e.g. thru pipes or AF_UNIX sockets). Proof of concept code on https://github.com/bstarynk/misc-basile/blob/master/manydl.c and https://github.com/bstarynk/misc-basile/blob/master/execicar.c ...


PS. My pet open source project is the RefPerSys inference engine (see code on https://github.com/RefPerSys/RefPerSys/ ....)


--

Basile Starynkevitch                  <basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]