From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aH0KFT0huF7qPQAA0tVLHw (envelope-from ) for ; Sun, 10 May 2020 15:43:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 3MfeN0ohuF7fAQAAB5/wlQ (envelope-from ) for ; Sun, 10 May 2020 15:44:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 899E6940607 for ; Sun, 10 May 2020 15:44:08 +0000 (UTC) Received: from localhost ([::1]:40218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXo7d-0005cR-11 for larch@yhetil.org; Sun, 10 May 2020 11:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXo7W-0005aS-2y for guix-patches@gnu.org; Sun, 10 May 2020 11:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXo7V-00072Y-PY for guix-patches@gnu.org; Sun, 10 May 2020 11:44:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jXo7V-0003hf-Mw for guix-patches@gnu.org; Sun, 10 May 2020 11:44:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41163] [PATCH] gnu: grub: Allow a PNG image and replace (aspect-ratio) with (resolution). Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 May 2020 15:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41163 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41163@debbugs.gnu.org Received: via spool by 41163-submit@debbugs.gnu.org id=B41163.158912544014221 (code B ref 41163); Sun, 10 May 2020 15:44:01 +0000 Received: (at 41163) by debbugs.gnu.org; 10 May 2020 15:44:00 +0000 Received: from localhost ([127.0.0.1]:50254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXo7U-0003hJ-4V for submit@debbugs.gnu.org; Sun, 10 May 2020 11:44:00 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:33411) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXo7S-0003h3-95 for 41163@debbugs.gnu.org; Sun, 10 May 2020 11:43:58 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id ABF6959D130; Sun, 10 May 2020 15:43:52 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [90.186.146.103]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 2614B539AA0; Sun, 10 May 2020 15:43:47 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87y2q0i7xx.fsf@gnu.org> Date: Sun, 10 May 2020 17:43:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <9A0DB516-B428-40D9-8E00-2C189457F425@vodafonemail.de> References: <87y2q0i7xx.fsf@gnu.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 X-Spam-Score: -0.51 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Scan-Result: default: False [-0.51 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.53884604030695]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; MV_CASE(0.50)[]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.08), country: US(-0.00), ip: 209.51.188.17(-0.54)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[stefan-guix@vodafonemail.de,guix-patches-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[gnu.org:email]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[vodafonemail.de]; HAS_LIST_UNSUB(-0.01)[]; RECEIVED_SPAMHAUS_PBL(0.00)[90.186.146.103:received]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: g5wBWtXGvtin Hi Mathieu! Many thanks for your reply! :-) > Am 10.05.2020 um 09:07 schrieb Mathieu Othacehe : >=20 > For some reason I cannot apply this patch. Could you send an updated > revision based on master? I=E2=80=99ll try. > A few comments below: >=20 >> * gnu/bootloaders/grub.scm ()[resolution]: Replacement of = the >> 'aspect-ratio' field. >=20 > You can write something like: >=20 > * gnu/bootloaders/grub.scm ()[aspect-ratio]: Remove this > field and replace it by ... > [resolution]: ... this field. OK. >> + (resolution grub-image-resolution >> + (default '(1024 . 768))) >> + (file grub-image-file >> + (default (file-append %artwork-repository >> + = "/grub/GuixSD-fully-black-4-3.svg")))) >=20 > I'm not sure about defaulting to this file. This record is meant to > describe a generic image. Could you keep this empty? The point is that currently the grub-theme used by default is = %default-theme, even if you set the theme field inside your = bootloader-configuration to #f (this is documented). And %default-theme = is using the very same file.=20 If you now just want to modify the size of this image file to your = screen resolution (I'd guess 1920 x 1080 is common), then you need to = inherit form %default-theme and somehow change the resolution, probably = making use of %background-image as well. This gets complicated and is = not obvious =E2=80=93 moreover as both variables are not documented. With my proposed change, you can create a new grub-theme which has all = the current guix defaults and only modify the parts you want to change: (grub-theme (image (grub-image (resolution '(1920 . 1080))))) Compare this with an alternative code to achieve the same, if the file = field would default to #f: (grub-theme (inherit %default-theme)=20 (image (grub-image (inherit %background-image)=20 (resolution '(1920 . 1080)))))) Actually I question that it makes much sense to have a separate = grub-image record at all, now that I'm about to remove the list of it = from grub-theme. But I'm hesitating to change too much =E2=80=93 = that=E2=80=99s also the reason that I didn't delete %default-theme and = %background-image. So despite your comment, I=E2=80=99d go even further: For me something = like this would look much easier without having any loss: (grub-theme (resolution '(1920 . 1080) (file %my-neat-backround-svg) (color-highlight '((fg . green) (bg . black)))) Or to stay with the simpler examples above: (grub-theme (resolution '(1920 . 1080))) And any missing field would stay the same as the current default. >> (define* (svg->png svg #:key width height) >> - "Build a PNG of HEIGHT x WIDTH from SVG." >> + "Build a PNG of HEIGHT x WIDTH from SVG if its file suffix is = \".svg\". >=20 > I'm not sure having "svg->png" handle other file types than ".svg" is > very clear.=20 >=20 >> + #~(if (string-suffix? ".svg" #+svg) >> + (begin >> + (use-modules (gnu build svg)) >> + (svg->png #+svg #$output >> + #:width #$width >> + #:height #$height)) >> + (copy-file #+svg #$output)))))) >=20 > You could move this check to "grub-background-image" procedure. So = that > "svg->png" only deals with ".svg" files. Yes, that makes sense. >> + (let ((resolution (grub-image-resolution image))) >> + (svg->png (grub-image-file image) >> + #:width (car resolution) >> + #:height (cdr resolution)))))) >=20 > "car" and "cdr" should be avoided. You can write something like that > instead: >=20 > --8<---------------cut here---------------start------------->8--- > (match resolution > ((width . height) > (svg->png (grub-image-file image) > #:width width > #:height height))) > --8<---------------cut here---------------end--------------->8=E2=80=94 Looks nice. Bye Stefan=