From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id iCyXNl1xAWeIDwAA62LTzQ:P1 (envelope-from ) for ; Sat, 05 Oct 2024 17:03:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id iCyXNl1xAWeIDwAA62LTzQ (envelope-from ) for ; Sat, 05 Oct 2024 19:03:25 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=oYQLGmbM; dkim=fail ("headers rsa verify failed") header.d=nanein.fr header.s=mail header.b=fCwW8e6l; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1728147805; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=4UddSLMKZXvErS9GiyWuBxl+rYlkdoRv5pNlgvppuBs=; b=kd/gjkIlBNx8wPKhE6981oDENaxw2qI4UcaDJEnSDxI+fzSRaCAHwUd8Rj2SRl6hzeyPE0 IqbVHvv6KeyN1rso84HYvpsfbpj2O38jF8qG3tXFx2doNldnvvcAXtB6q+IX87Cz3rRO/b UeF9HhMRR68m2D9I8y79MP52/zW/yNgwPyCw1AzfzlnpmmAALbPRVoLrfwL9HEU0w4mphh +k8qOtpO+DXBZwv76EjVeBamKAJQXZZDptrrdWNe8T1U+gyCkMlnwnQ5V3SrWuq0S4HZEV q6u4HBWeiNov0gGErCKm+TViMpMhFyaxlnwoJX7jjk8aOr/rZlRQnmcslXDGbQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728147805; a=rsa-sha256; cv=none; b=Q6/BqHFOFOrOxh+jc1C9iQwP9Wyr0aQTFQVfPA1qZS2Y72jG4gwQP9mZ1kYl+uiA8NOXjh SrkZNeq+FeqZGi/PCGL39m8AFEASObWEYCxIL52IA+h6ny2jMZ5+Maq4bV0sOnJf61fDdm aV1lcuCVh3RhPqUoJO5807CER+nxw3YvHcRc9QoJ1URXxP4Rvsn4a5/CjNygNH65gAgipd JoZeYOX6tV08qe8UZVzvnru/wav5ajuCpDroSeMAbthmIrgeApuBiDXLoIzw+p+i8M2xzB LN+HReO5Q8Nn9pO+wls6LCD9J3fxhrhKmEcOgXTOvj3162+bnq0qwD4avNMXhA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=oYQLGmbM; dkim=fail ("headers rsa verify failed") header.d=nanein.fr header.s=mail header.b=fCwW8e6l; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org 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 A80165C0B4 for ; Sat, 05 Oct 2024 19:03:24 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx8BL-0003Jb-4i; Sat, 05 Oct 2024 13:03:03 -0400 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 1sx8BG-0003J6-QK for guix-patches@gnu.org; Sat, 05 Oct 2024 13:02:58 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sx8BG-00045u-48 for guix-patches@gnu.org; Sat, 05 Oct 2024 13:02:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=4UddSLMKZXvErS9GiyWuBxl+rYlkdoRv5pNlgvppuBs=; b=oYQLGmbMEqvcHnuvNRqkWfpoD7eu6HsV3jnCW2TNffg9oluBz2lXEnh+id7dM5JX/QtUmlz0/7exhBG6LR1D2lcQe4ikvMxaccUlTOoYMYAweplSr4jipLRuQEsDoH07LDnwQcgqNF2ZKLAUgMx7pM72Em7KpDTDYF2kLELO5GGrLOPKBpEeN5cz8wExsgbc6ck8cEV45PREAL2OaHzviyH9skkAvcuhEZxt41sRvaRR9hnKkMs8779BT+LOpCTq3bW1PIaVpkJiShdv6baXZ0L+c5KWsEM5XBc105IoaoVHsxKinx7e2XKQVWKjtYBKB2KYn1PUEsT6l1T6gI6/6w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sx8BK-0002bv-Jn for guix-patches@gnu.org; Sat, 05 Oct 2024 13:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72714] [PATCH] home: services: Add 'home-sway-service-type'. Resent-From: Arnaud Daby-Seesaram Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 05 Oct 2024 17:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72714 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "pelzflorian (Florian Pelz)" Cc: Hilton Chain , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 72714@debbugs.gnu.org Received: via spool by 72714-submit@debbugs.gnu.org id=B72714.17281477639993 (code B ref 72714); Sat, 05 Oct 2024 17:03:02 +0000 Received: (at 72714) by debbugs.gnu.org; 5 Oct 2024 17:02:43 +0000 Received: from localhost ([127.0.0.1]:39519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sx8B0-0002b5-CE for submit@debbugs.gnu.org; Sat, 05 Oct 2024 13:02:42 -0400 Received: from nanein.fr ([185.230.78.41]:49190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sx8Ay-0002al-K4 for 72714@debbugs.gnu.org; Sat, 05 Oct 2024 13:02:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nanein.fr; s=mail; t=1728147749; bh=jprxF3nD+zxVOItLdGgjW/cJEhvH6kPsqUKLCEccNLk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fCwW8e6l9zAL0Nb4oXvZRt4Jk1w4JhhEbCCowK6xdpMyHlpqUiL5A1JeX/eJc490s 9Q529DgmRIPZnBZjBvvKReA2hbmeBFI+cqa8sM2U+WEkyGE0xMklen0X1COzvbWmE/ i1c5MrYJJHPbXcIVbVV1jhomQ9CYIES5bqjtJzBAYM2Xh2GZZnG8d0dXAMQMsWxYNm 2Wanf4EJwH7lshThtsfOL6UglM+LJzicFYFLxz35tZHUUiPBTraiZe+ddrjgUrHVaf Kw8adLkOzN1XiRz6OjD19ikPvJUvDCjYSRk1QSgRKuo9Ll2+pFA0RmMmrOGt7p2uB9 ColKJRTwUN/+I7gvmACG87n42PwAOpw7EwP4Q8yUcY62JxPPdoW7dP9y0fEnKjz8Hg VFho7ed8MQnPix6S6uZiIvifDUV+ToBMjs2HZm4KgRPpkh65e6gMSVVz6u2ukm5U40 /IKgCWGWgKGe4GiTStXsMCQSNkquSpRs8V8RVYKQidfRh1+WSVrBNEr1w3f5mkYPnv 2Uz0mDjwaJxUnop91dywS8qa95ZRZOQvS+bClpfia49BXILphn3y3K97f+pppni+HB EZFItHs82k4AnbMqKexYFIBADzn4aKs6YPShBqgre7TWi6kA14lkulHhFwrM9SaS7v aFs+qhtU4cHKY0WpKgVvJXVU= Received: from cochea (unknown [212.178.179.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by nanein.fr (Postfix) with ESMTPSA id CBB67140266; Sat, 5 Oct 2024 19:02:28 +0200 (CEST) In-Reply-To: <87jzenr5bj.fsf@pelzflorian.de> (pelzflorian@pelzflorian.de's message of "Fri, 04 Oct 2024 22:17:20 +0200") References: <87zfno52ig.fsf@gnu.org> <20241001221313.2490-1-ds-ac@nanein.fr> <878qv6tx5i.fsf@pelzflorian.de> <87ttdu9qmo.fsf@nanein.fr> <875xq9we7n.fsf@pelzflorian.de> <877caoewmh.fsf@nanein.fr> <87jzenr5bj.fsf@pelzflorian.de> Date: Sat, 05 Oct 2024 19:02:11 +0200 Message-ID: <877camv5yk.fsf@nanein.fr> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Arnaud Daby-Seesaram X-ACL-Warn: , Arnaud Daby-Seesaram via Guix-patches From: Arnaud Daby-Seesaram via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.47 X-Spam-Score: -3.47 X-Migadu-Queue-Id: A80165C0B4 X-Migadu-Scanner: mx13.migadu.com X-TUID: lkrQCFF41Dqj --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Florian, > I=E2=80=99d welcome if you, Arnaud, sent a patch calling your sway-menu s= cript. >=20 > Also I=E2=80=99d be happy if more careful commiters would push it; I pref= er to > restrict my commits to translation updates. I will proof-read and re-test the whole patch soon, hoping to avoid additional careless bugs on my end. Also: given that you assisted me quite a lot, do you want me to add a line in the commit message to express that you helped me write the patch (such as "This patch was co-authored with Florian Pelz.", as in Guix commit 9371cf2138711ea7305951d82c5cf0b36ac4d6f1)? I will send a v8 as soon as I have both seen your answer and proof-read the patch. NB: I think that the v8 can be the last version of the patch. Thank you for your help and for your patience :)! > Sorry for having proposed compiled-file previously. No problem. I actually meant `program-file' instead of `computed-file' (which was incorrectly used in my previous email). This way, the lowered object in the store will be executable, allowing to define the menu directly like this=C2=B9: =2D-8<---------------cut here---------------start------------->8--- (define %sway-default-variables `([...] (menu . ,sway-menu))) =2D-8<---------------cut here---------------end--------------->8--- =C2=B9: In the next version of the patch, I=C2=A0allow any file-like object= in `string-ish' instead of file-append objects only, so that Sway variables can be bound to anything that can be lowered into a file (in additions to strings and G-expressions). > At first I had thought a compiled sway-menu.go would be appropriate, > created in a computed-file, which invokes `guild compile` on the .scm > code, but apparently this is not useful. I do not know enough here > and gnu/services/shepherd.scm does it in the scm->go procedure. Thank you for the pointer, `scm->go' is an interesting function. I=C2=A0experimented and bit and was able to compile the menu to byte-code using a similar function. However, I do not know a way to compile to native code in Guile. Hence, I will stick to `program-file'. > Anyway, some feedback: > >> (define (directory->files dir) >> (define (executable-file? f) >> ;; Cf. `(@@ (guix build utils) executable-file?)' for an >> ;; explanation of `(zero? ...)'. > > This is a comment anyway, but one @ in (@ (guix build utils) > executable-file?) would be enough, since the executable-file? > predicate is exported. Thx, fixed. >> (lambda (s) > > To reduce clutter in the wmenu suggestions more, I=E2=80=99d prefer > > (and=3D> (and (not (eq? (string-ref f 0) #\.)) > (stat f)) > (lambda (s) Indeed, this is better. >> (not (or (zero? (logand (stat:mode s) #o100)) >> (eq? (stat:type s) 'directory)))))) >> (with-directory-excursion dir >> (scandir "." executable-file?))) >>=20 >> (let ((path (string-append (getenv "HOME") >> "/.guix-home/profile/bin")) >> (wmenu #$(file-append wmenu "/bin/wmenu")) >> (swaymsg #$(file-append sway "/bin/swaymsg"))) >> (receive (from to pid) >> ((@@ (ice-9 popen) open-process) OPEN_BOTH wmenu) > > Better use @ instead of @@. Unfortunately, `open-process' is not exported in `(ice-9 popen)', so I kept @@. >> (for-each >> (lambda (c) (format to "~a~%" c)) >> (directory->files path)) >> (close to) >> (let ((choice (read-line from))) >> (close from) >> (waitpid pid) >> (execl swaymsg swaymsg "exec" >> (string-append path "/" choice)))))))) > > Even though I like to get suggestions only for > ~/.guix-home/profile/bin, if you do not prepend path, [...] > then it will remain possible to write shell commands in wmenu [...] > to run apps without installing them. Yes; I removed the string-append here. (As ~/.guix-home/profile/bin is supposed to be in the path, this should work properly). > Since you told me about wmenu-run, I also locally updated wmenu [1] > and tested the menu config > > (menu . ,#~(string-append > #$wmenu "/bin/wmenu-run")) > > which would also work, but in my opinion the suggestions are better > when tied to .guix-home/profile. The wmenu-run does not use exec but > a protocol called XDG_ACTIVATION_TOKEN. But I do not see an advantage > to it. It behaves like always. It is nice that this works too. NB: if you want, you can use `(file-append pkg "stuff")' instead of `#~(string-append #$pkg "stuff")'. I do not know much about the XDG_ACTIVATION stuff; only that it has to do with focused clients on Wayland IIRC. In my menu, I use `swaymsg exec -- [command]', which takes care of a few things as well, as explained below. =2D-8<---------------cut here---------------start------------->8--- Note: pass the final command to swaymsg so that the resulting window can be opened on the original workspace that the command was run on. =2D-8<---------------cut here---------------end--------------->8--- Source: commit c3353bb27317d294a91a8accec9a554ea392de04 of Sway. It explains why the menu is piped to 'swaymg exec --'. (I have added the "--" argument in the v8). > Also one more thing, in the commit message, you meant to write > flatmap instead of flatten. Indeed, thx. Best regards, =2D-=20 Arnaud --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJEBAEBCgAuFiEEMgqfJ4U0fby1t860ojLKXoMTiAwFAmcBcRQQHGRzLWFjQG5h bmVpbi5mcgAKCRCiMspegxOIDC/AEACVkEc2PL7Q9LsaegS955SdM5QxwazAEe9F n9Q/DsZ85Yk36IzGHIWc0T4Z/BySv2X9waQhjRYDsLSZAQzDSl1Skf5KhHlKPbrV JwpMG6t4DN0dHMetz1wS+tjsRr7F4f1kNKGtXWO/ZYxfUP3M3jm2RT7IFr0547aL nWv5dna5L3mL3Funq7J06Batqj5+flPRaBjJBSRZq723TTmgEgeVC5R809YIaod9 MAu1eFsl5+8h2OHUlJSMAZE0WLWcOi7u9SZTImm5kP7mhDD3uzCOBp/rIgfslgoj tVqjeaCEOA54BEoNbiGV2sVTziD01gMwg++f0CwXO/BCgyEGZNIveVEXSprfo2DZ G5k8X8Vh1fBhmRtXBFbaVKQ2iI8ubQbl7Odz39YnONBlfHybW0U1atu8yQfx0s05 MpjwWpzwHChRuFtTuq4iHXdrIavC5CblqBVltSX4EyaY0kxErmixe61IKgJ1J17d oAkVtSEI5A6DeNgAOOofMdpT+tMQtqb0zUuQNYa+Ef47U24r4+4m+QtDYiM4pGIX 8Y1wIGDSTr/zNy6vtEp/4BmXTr0E1jZduCzXrsrZTjqtG8QpqkLDNVkWKcvyi9eD XNN5gAW1m01pDhAbiig9F2aBH9JZQEj7+Hp6rrTcT+tR2YAKbRuFsWwVRsx7z8Id OBjuBhM9Iw== =hS73 -----END PGP SIGNATURE----- --=-=-=--