From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Basile Starynkevitch Newsgroups: gmane.emacs.help Subject: Re: API to control the GTK parts from Elisp Date: Fri, 25 Aug 2023 09:25:39 +0200 Message-ID: References: <87il94frjz.fsf@k-7.ch> <87o7iv51w7.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25553"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: seb@k-7.ch To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 25 09:26:48 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZRDU-0006RR-5B for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 25 Aug 2023 09:26:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZRCp-0002NH-Rt; Fri, 25 Aug 2023 03:26:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZRCX-0002MV-Gn for help-gnu-emacs@gnu.org; Fri, 25 Aug 2023 03:25:49 -0400 Original-Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZRCU-0004N9-3J for help-gnu-emacs@gnu.org; Fri, 25 Aug 2023 03:25:48 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 49969240006; Fri, 25 Aug 2023 07:25:39 +0000 (UTC) Content-Language: en-US In-Reply-To: <87o7iv51w7.fsf@yahoo.com> X-GND-Sasl: basile@starynkevitch.net Received-SPF: pass client-ip=2001:4b98:dc4:8::221; envelope-from=basile@starynkevitch.net; helo=relay1-d.mail.gandi.net X-Spam_score_int: -54 X-Spam_score: -5.5 X-Spam_bar: ----- X-Spam_report: (-5.5 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-2.919, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144954 Archived-At: On 8/25/23 03:47, Po Lu wrote: > Sébastien Gendre 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 (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la-Reine, France web page: starynkevitch.net/Basile/