From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "pelzflorian (Florian Pelz)" Newsgroups: gmane.lisp.guile.user Subject: Re: GNU G-Golf 0.8.0-rc6 available for testing Date: Fri, 20 Sep 2024 15:08:31 +0200 Message-ID: <874j6apj5c.fsf@pelzflorian.de> References: <20240917234912.1aadc596@tintin> <874j6bsyqx.fsf@pelzflorian.de> <20240919192006.14b2af40@tintin> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3434"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: guile-user To: David Pirotte Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Sep 20 15:09:35 2024 Return-path: Envelope-to: guile-user@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 1srdOA-0000er-Gq for guile-user@m.gmane-mx.org; Fri, 20 Sep 2024 15:09:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srdNM-0006TO-IV; Fri, 20 Sep 2024 09:08:45 -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 1srdNJ-0006SY-Ts for guile-user@gnu.org; Fri, 20 Sep 2024 09:08:41 -0400 Original-Received: from relay.yourmailgateway.de ([46.38.247.119]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srdNH-00030c-Bm for guile-user@gnu.org; Fri, 20 Sep 2024 09:08:41 -0400 Original-Received: from mors-relay-8404.netcup.net (localhost [127.0.0.1]) by mors-relay-8404.netcup.net (Postfix) with ESMTPS id 4X9CPb4plRz80Hm; Fri, 20 Sep 2024 15:08:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pelzflorian.de; s=key2; t=1726837715; bh=tV1z2f7U8CM8ppkuQku7Dx7TZOMt1PCwzXPETj2G02Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CWwQTc6lFHjlbAeh+2lm/v3l/Hm6MCJ+fGrXJDBH2SsN5fgxT0eESKKDN9K8DHh3X K4wnkQhDAu3D6OOWhLup9/ftv/tbrTwBNL0xL+IOQHhU0dqaXCZYxmbWdLpJvCLKj2 +3THvPwoQmlvSPZukmeitVpCGT37F90Dk6CxHiOf0QhCCo3JIEEoUyNjhjBABYEds4 vGy5zs3hJArAxZhcaLbGmAqAVmqOcu+DDPS6IViP/HppxG1P2UK5/RIsbYA0/tqYSc yoTQ1P4Uya74l4A0d/Clc9DvVFGGYlw5qoamAjg501sO9h3egveLTpm4jXPN2XpcNs T/+tDsvi6p4aA== Original-Received: from policy01-mors.netcup.net (unknown [46.38.225.35]) by mors-relay-8404.netcup.net (Postfix) with ESMTPS id 4X9CPb4QBsz4xXs; Fri, 20 Sep 2024 15:08:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at policy01-mors.netcup.net Original-Received: from mxe217.netcup.net (unknown [10.243.12.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by policy01-mors.netcup.net (Postfix) with ESMTPS id 4X9CPZ0J7vz8tY6; Fri, 20 Sep 2024 15:08:34 +0200 (CEST) Original-Received: from florianhp (ipb2186896.dynamic.kabel-deutschland.de [178.24.104.150]) by mxe217.netcup.net (Postfix) with ESMTPSA id A3E438420A; Fri, 20 Sep 2024 15:08:27 +0200 (CEST) In-Reply-To: <20240919192006.14b2af40@tintin> (David Pirotte's message of "Thu, 19 Sep 2024 19:20:06 -0300") X-Rspamd-Queue-Id: A3E438420A X-Rspamd-Server: rspamd-worker-8404 X-NC-CID: vlJ9ma8MGrnbKV9k56Dkjr5S2fuiK4wrMXUA6Fil6m+ux1Cv/g2gRj0o Received-SPF: pass client-ip=46.38.247.119; envelope-from=pelzflorian@pelzflorian.de; helo=relay.yourmailgateway.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19823 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable David Pirotte writes: > Excellent! Note that you'll need to update your configuration and > use/grab 0.8.0-rc7 - which fixes a 'missing some distributed files', > necessary to be able to run the newly added > > examples/gtk-4/layout-manager.scm > [ a g-golf port of the upstream gtk4-demo layout manager > [ (transition) example I see, but since Guix builds G-Golf from git rather than a tarball, examples/gtk-4/layout-manager.scm had worked already with rc6. Tarballs contain bundled M4 files and other build-aux files. Guix rather uses its own packaged version of these, avoiding something like the xz vulnerability=E2=80=99s code injection. Still it is good that you f= ixed the tarball. >> Now I can embed GTK programs within the Guix Home >> configurations ... > > I am glad that you (finally) can happily use the distro of your dream. > Your config example certainly should help other guixers willing to use > g-golf. :) >> All that is left is that I do not understand why >> (gdk-display-get-default) returns #f in G-Golf but >> gdk_display_get_default () in C returns 0x1c0e36c0. > > You need to have initialized either Gtk or Adw, otherwise it returns #f > (as expected). > > scheme@(guile-user)> ,use (g-golf) > scheme@(guile-user)> (gi-import-by-name "Gdk" "Display") > $5 =3D #< 7fee0e488c30> > > scheme@(guile-user)> (gdk-display-get-default) > $6 =3D #f > > scheme@(guile-user)> (gi-import-by-name "Gtk" "init") > $7 =3D #< 7fee075cb480> > scheme@(guile-user)> (gtk-init) > > scheme@(guile-user)> (gdk-display-get-default) > $8 =3D #< 7fee0f054a10> > > David This helped. When manually run, missing gtk-init import and use was the issue; thank you! Funny enough, when auto-started, gtk-init is run by GtkApplication or perhaps by some library constructor, but I also had forgotten to actually call add-css-class. Still I added gtk-init, so I can manually run my launcher as well. In case others use it as reference, the fixed version is attached. Regards, Florian --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=home-configuration.scm Content-Transfer-Encoding: quoted-printable ;;; Copyright =C2=A9 2023, 2024 Florian Pelz ;; ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;;=20 ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;;=20 ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;=20 ;; Dieses Programm ist Freie Software: Sie k=C3=B6nnen es unter den Bedingu= ngen ;; der GNU General Public License, wie von der Free Software Foundation, ;; Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren ;; ver=C3=B6ffentlichten Version, weiter verteilen und/oder modifizieren. ;;=20 ;; Dieses Programm wird in der Hoffnung bereitgestellt, dass es n=C3=BCtzli= ch sein wird, jedoch ;; OHNE JEDE GEW=C3=84HR,; sogar ohne die implizite ;; Gew=C3=A4hr der MARKTF=C3=84HIGKEIT oder EIGNUNG F=C3=9CR EINEN BESTIMMT= EN ZWECK. ;; Siehe die GNU General Public License f=C3=BCr weitere Einzelheiten. ;;=20 ;; Sie sollten eine Kopie der GNU General Public License zusammen mit diesem ;; Programm erhalten haben. Wenn nicht, siehe . (use-modules (gnu home) (gnu home services) (gnu home services desktop) (gnu home services shells) (gnu home services sound) (gnu home services sway) (gnu packages) (gnu packages gtk) (gnu packages guile-xyz) (gnu services) (guix build-system glib-or-gtk) (guix gexp) (guix licenses) (guix packages) (guix transformations)) (home-environment (packages (specifications->packages (list "git"))) (services (list (service home-bash-service-type) (service home-dbus-service-type) ;f=C3=BCr VLC ;; (service home-pipewire-service-type) (service home-sway-service-type (sway-configuration (execs `(,(with-extensions (list graphene gtk ((options->transformation '((with-commit . "guile-g-golf=3Dv0.8.0-rc6"))) guile-g-golf)) #~(string-append "guile " #$(scheme-file "launcher.scm" #~(begin (eval-when (expand load eval) (use-modules (oop goops)) (default-duplicate-binding-handler '(merge-generics replace warn-override-core warn last)) (setenv "GI_TYPELIB_PATH" #$(file-append (directory-union "typelibs" (list gdk-pixbuf graphene gtk harfbuzz pango)) "/lib/girepository-1.0")) (use-modules (g-golf)) (g-irepository-require "Gtk" #:version "4.0") (for-each (lambda (name) (gi-import-by-name "Gtk" name)) '("Application" "ApplicationWindow" "Builder" "CssProvider" "init"))) (use-modules (sxml simple)) (gtk-init) (define ui '(interface (requires (@ (version 4.0) (lib gtk))) (object (@ (id window) (class GtkApplicationWindow)) (child (object (@ (class GtkGrid)) (property (@ (name row-homogeneous)) 1) (property (@ (name column-homogeneous)) 1) (child (object (@ (id btn-kodi) (class GtkButton)) (property (@ (name label)) Kodi) (layout (property (@ (name column)) 0) (property (@ (name row)) 0)))) (child (object (@ (id btn-halt) (class GtkButton)) (property (@ (name label)) Halt) (layout (property (@ (name column)) 0) (property (@ (name row)) 1)))) (child (object (@ (id btn-reboot) (class GtkButton)) (property (@ (name label)) Reboot) (layout (property (@ (name column)) 1) (property (@ (name row)) 1)))) (child (object (@ (id btn-mount) (class GtkButton)) (property (@ (name label)) Mounten) (layout (property (@ (name column)) 1) (property (@ (name row)) 0))))))))) (define provider (make )) (define (mount-all) (gtk-css-provider-load-from-string provider "\ .reddable label { background-color: red; } ") (unless (=3D 0 (system "\ sudo /run/privileged/bin/mount \ /dev/disk/by-id/usb-WD_Elements_25A3_574343374B31544434313530-0:0-part1 \ /media/WDElements/")) (gtk-style-context-add-provider-for-display (gdk-display-get-default) provider 100))) (define (activate app) (let ((builder (make ))) (define (get str) (get-object builder str)) (add-from-string builder (with-output-to-string (lambda () (sxml->xml ui))) -1) (let ((window (get "window")) (btn-kodi (get "btn-kodi")) (btn-mount (get "btn-mount")) (btn-halt (get "btn-halt")) (btn-reboot (get "btn-reboot"))) (connect btn-kodi 'clicked (lambda (b) (gtk-widget-hide window) (system (string-append "\ /var/guix/profiles/per-user/florian/current-guix/bin/guix \ shell --container --network --no-cwd flatpak \ --expose=3D/home/user/.local/share/flatpak/ \ --share=3D/home/user/you-kodi/.kodi=3D/home/user/.var/app/tv.kodi.Kodi/data= \ --expose=3D/sys \ --preserve=3D'^DBUS_.*' \ --share=3D/media/WDElements \ --expose=3D/dev/dri --expose=3D" "/run/user/1001";(getenv "XDG_RUNTIME_DIR") "/bus=3D/var/run/dbus/system_bus_socket --expose=3D/dev/dri --expose=3D/dev= /snd \ --preserve=3D'^DISPLAY$' -- flatpak run -v tv.kodi.Kodi --audio-backend=3Da= lsa")) (present window))) (connect btn-mount 'clicked (lambda (b) (mount-all))) (add-css-class btn-mount "reddable") (connect btn-halt 'clicked (lambda (b) (system "\ sudo /run/current-system/profile/sbin/halt"))) (connect btn-reboot 'clicked (lambda (b) (system "\ sudo /run/current-system/profile/sbin/reboot"))) (add-window app window) (present window)))) (let ((app (make #:application-id "my.launcher"))) (mount-all) (connect app 'activate activate) (let ((status (g-application-run app '()))) (exit status status))))) " 2>&1 | tee /home/user/errors")))))) (simple-service 'gtk-config-service home-xdg-configuration-files-service-type `(("gtk-4.0/settings.ini" ,(mixed-text-file "gtk-config" "\ [Settings] gtk-xft-dpi=3D500000 "))))))) --=-=-=--