From: Arnaud Daby-Seesaram via Guix-patches via <guix-patches@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: "Hilton Chain" <hako@ultrarare.space>,
"Ludovic Courtès" <ludo@gnu.org>,
72714@debbugs.gnu.org
Subject: [bug#72714] [PATCH] home: services: Add 'home-sway-service-type'.
Date: Thu, 03 Oct 2024 22:53:42 +0200 [thread overview]
Message-ID: <877caoewmh.fsf@nanein.fr> (raw)
In-Reply-To: <875xq9we7n.fsf@pelzflorian.de> (pelzflorian@pelzflorian.de's message of "Thu, 03 Oct 2024 14:41:48 +0200")
[-- Attachment #1: Type: text/plain, Size: 4358 bytes --]
Hello Florian,
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:
> Arnaud Daby-Seesaram <ds-ac@nanein.fr> writes:
>> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:
>>> Perhaps for more hackability, we could deviate from upstream and put in
>>> a call to guile with a Scheme script in a computed-file that opens a
>>> pipe to/from wmenu and does the same as dmenu_path without cache only on
>>> ~/.guix-home/profile/bin.
>>
>> Yes indeed. Do you think that the Guile script should replace all of
>> "$menu", or just the dmenu_path part?
>>
>
> All of "$menu", because it looks nicer? But I should not imply that
> such deviation from upstream were necessary for getting your patch in.
No worries. I think that finding a better solution now would be better
(and should not delay this issue for too long). It would avoid opening
a second issue and delaying/forgetting the cache problem.
> Basically my issue was that dmenu_path did not work.
>
> Indeed stest is part of the dmenu package, so when dmenu is installed to
> the profile, dmenu_path would work. So a more upstream conformant
> solution would be to just add the dmenu package to sway’s packages.
>
> However, dmenu_path’s cache means that if we used dmenu_path like
> upstream, it would never recognize changes to the installed packages.
> OpenBSD opted for wmenu_path which is like dmenu_path without cache
> and a guile script seems more appropriate for Guix’ defaults.
Yes, adding dmenu would work (minus your second point). However, to
rely on both wmenu and dmenu feels a little weird, especially since the
latter is only used for a bash script.
It seems that Sway recently switched[1] to a utility called wmenu-run
(C program shipped with the last version of wmenu) to get rid of their
dependency on dmenu.
[1] https://github.com/swaywm/sway/commit/b44015578a3d53cdd9436850202d4405696c1f52
>>> only on ~/.guix-home/profile/bin.
>>
>> What is the rationale for restricting the menu to this directory (and
>> not all directories in
>> (filter directory-exists? (string-split (getenv "PATH") #\:))
>> ?
>>
> All my graphical applications are in the home profile and non-graphical
> programs will not be used and clutter wmenu. Do others put graphical
> apps in the system profile? Perhaps so. But then non-graphical
> coreutils would be in the wmenu as well. Hmm I am not sure and would be
> fine with either.
Yes, this is a good point. I also agree that using a single script for
all of the menu would make it clearer and more maintainable.
For both these reasons, here is a draft proposal for a script that could
replace the current content of "$menu". As suggested, it uses `scandir'
and only focuses on packages of the "home profile".
--8<---------------cut here---------------start------------->8---
(define sway-menu
(computed-file
"sway-menu.scm"
#~(begin
(use-modules (ice-9 receive)
(ice-9 rdelim)
(ice-9 ftw)
(guix build utils))
(define (directory->files dir)
(define (executable-file? f)
;; Cf. `(@@ (guix build utils) executable-file?)' for an
;; explanation of `(zero? ...)'.
(and=> (stat f)
(lambda (s)
(not (or (zero? (logand (stat:mode s) #o100))
(eq? (stat:type s) 'directory))))))
(with-directory-excursion dir
(scandir "." executable-file?)))
(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)
(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))))))))
--8<---------------cut here---------------end--------------->8---
WDYT?
Best regards,
--
Arnaud
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
next prev parent reply other threads:[~2024-10-03 20:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 15:30 [bug#72714] [PATCH] home: services: Add 'home-sway-service-type' Arnaud Daby-Seesaram via Guix-patches via
2024-08-24 15:32 ` [bug#72714] [PATCH v2] " Arnaud Daby-Seesaram via Guix-patches via
2024-08-26 10:38 ` [bug#72714] [PATCH v3] " Arnaud Daby-Seesaram via Guix-patches via
2024-09-03 7:27 ` [bug#72714] [PATCH v4] " Arnaud Daby-Seesaram via Guix-patches via
2024-09-14 13:28 ` pelzflorian (Florian Pelz)
2024-09-14 14:06 ` pelzflorian (Florian Pelz)
2024-09-17 6:52 ` Arnaud Daby-Seesaram via Guix-patches via
2024-09-20 16:45 ` pelzflorian (Florian Pelz)
2024-09-22 13:43 ` Arnaud Daby-Seesaram via Guix-patches via
2024-09-25 6:58 ` pelzflorian (Florian Pelz)
2024-09-25 7:52 ` Arnaud Daby-Seesaram via Guix-patches via
2024-09-25 11:42 ` pelzflorian (Florian Pelz)
2024-09-18 8:15 ` [bug#72714] [PATCH v5] " Arnaud Daby-Seesaram via Guix-patches via
2024-09-18 18:56 ` Arnaud Daby-Seesaram via Guix-patches via
2024-09-22 8:14 ` Hilton Chain via Guix-patches via
2024-09-25 8:00 ` [bug#72714] [PATCH v6] " Arnaud Daby-Seesaram via Guix-patches via
2024-09-30 20:07 ` Ludovic Courtès
2024-10-01 22:12 ` [bug#72714] [PATCH] " Arnaud Daby-Seesaram via Guix-patches via
2024-10-02 14:08 ` pelzflorian (Florian Pelz)
2024-10-02 20:49 ` Arnaud Daby-Seesaram via Guix-patches via
2024-10-03 12:41 ` pelzflorian (Florian Pelz)
2024-10-03 20:53 ` Arnaud Daby-Seesaram via Guix-patches via [this message]
2024-10-04 20:17 ` pelzflorian (Florian Pelz)
2024-10-05 17:02 ` Arnaud Daby-Seesaram via Guix-patches via
2024-10-06 8:15 ` pelzflorian (Florian Pelz)
2024-10-06 9:05 ` Arnaud Daby-Seesaram via Guix-patches via
2024-10-06 9:51 ` pelzflorian (Florian Pelz)
2024-10-06 10:44 ` Arnaud Daby-Seesaram via Guix-patches via
2024-10-08 16:39 ` pelzflorian (Florian Pelz)
2024-10-08 22:33 ` [bug#72714] [PATCH v8] " Arnaud Daby-Seesaram via Guix-patches via
2024-10-12 13:11 ` bug#72714: " pelzflorian (Florian Pelz)
2024-10-01 22:30 ` [bug#72714] [PATCH v7] " Arnaud Daby-Seesaram via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877caoewmh.fsf@nanein.fr \
--to=guix-patches@gnu.org \
--cc=72714@debbugs.gnu.org \
--cc=ds-ac@nanein.fr \
--cc=hako@ultrarare.space \
--cc=ludo@gnu.org \
--cc=pelzflorian@pelzflorian.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.