unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* API to control the GTK parts from Elisp
@ 2023-08-24 14:19 Sébastien Gendre
  2023-08-25  1:47 ` Po Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Sébastien Gendre @ 2023-08-24 14:19 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: API to control the GTK parts from Elisp
  2023-08-24 14:19 API to control the GTK parts from Elisp Sébastien Gendre
@ 2023-08-25  1:47 ` Po Lu
  2023-08-25  7:25   ` Basile Starynkevitch
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2023-08-25  1:47 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: help-gnu-emacs

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.

In general, we are seeking to reduce our dependence on things like GTK,
whose developers are zealously hostile to some of Emacs's requirements.
So I don't anticipate their introduction in the immediate future either.

If you build Emacs with some other X toolkit, the aesthetics of the menu
and tool bars can be modified by means of the `tool-bar' and `menu-bar'
faces.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: API to control the GTK parts from Elisp
  2023-08-25  1:47 ` Po Lu
@ 2023-08-25  7:25   ` Basile Starynkevitch
  0 siblings, 0 replies; 3+ messages in thread
From: Basile Starynkevitch @ 2023-08-25  7:25 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: seb


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/




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-25  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24 14:19 API to control the GTK parts from Elisp Sébastien Gendre
2023-08-25  1:47 ` Po Lu
2023-08-25  7:25   ` Basile Starynkevitch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).