all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Feng Shu <tumashu@163.com>
To: Brendan Tildesley <mail@brendan.scot>
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Maxime Devos" <maximedevos@telenet.be>,
	54434@debbugs.gnu.org
Subject: [bug#54434] [PATCH 0/6] XFCE Updates
Date: Mon, 04 Apr 2022 12:59:56 +0800	[thread overview]
Message-ID: <87h779xx2r.fsf@163.com> (raw)
In-Reply-To: <17675c0b-22c0-db01-b9ef-ee3348326056@brendan.scot> (Brendan Tildesley's message of "Mon, 4 Apr 2022 13:53:41 +1000")

Brendan Tildesley <mail@brendan.scot> writes:

> On 4/4/22 12:56 pm, Feng Shu wrote:
>> Brendan Tildesley <mail@brendan.scot> writes:
>>
>>> On 3/4/22 8:33 pm, Ludovic Courtès wrote:
>>>> [...]
>>>> One problem is that this won’t work for those using Guix Home, where the
>>>> default profile is ~/.guix-home/profile.
>>>>
>>>> Can this extra variable be avoided?  Or could it be handled by a search
>>>> path specification?
>>> It's xfce4-panel that needs the search path to load .so files for
>>> panel plugins.
>>> xfce4-panel already has the search-path set to load them, but since
>>> its installed
>>> to the system profile,it does not load the user installed plugins. If
>>> xfce4-panel
>>> was a user installed package it may work but userswould have to
>>> manually install it.
>>> So I'm not sure how else to solve it.
>> What happen when version of xfce4-panel installed in system profile is
>> different from installed in home profile?
> I think xfce4-panel will be run from $PATH so the system version will
> be picked first and the user installed one will be ignored. The search
> path will be set but will not work until the user logs out and back in
> again, which is not ideal. I'd like a user to be able to install a plugin
> and have it appear in the settings menu immediately.
>

Maybe it will first find xfce.desktop in <user-profile>/share/xsessions,
then in <system-profile>/share/xsessions.


(define* (xinitrc #:key fallback-session)
  "Return a system-wide xinitrc script that starts the specified X session,
which should be passed to this script as the first argument.  If not, the
@var{fallback-session} will be used or, if @var{fallback-session} is false, a
desktop session from the system or user profile will be used."
  (define builder
    #~(begin
        (use-modules (ice-9 match)
                     (ice-9 regex)
                     (ice-9 ftw)
                     (ice-9 rdelim)
                     (srfi srfi-1)
                     (srfi srfi-26))

        (define (close-all-fdes)
          ;; Close all the open file descriptors except 0 to 2.
          (let loop ((fd 3))
            (when (< fd 4096)               ;FIXME: use sysconf + _SC_OPEN_MAX
              (false-if-exception (close-fdes fd))
              (loop (+ 1 fd)))))

        (define (exec-from-login-shell command . args)
          ;; Run COMMAND from a login shell so that it gets to see the same
          ;; environment variables that one gets when logging in on a tty, for
          ;; instance.
          (let* ((pw    (getpw (getuid)))
                 (shell (passwd:shell pw)))
            ;; Close any open file descriptors.  This is all the more
            ;; important that SLiM itself exec's us directly without closing
            ;; its own file descriptors!
            (close-all-fdes)

            ;; The '--login' option is supported at least by Bash and zsh.
            (execl shell shell "--login" "-c"
                   (string-join (cons command args)))))

        (define system-profile
          "/run/current-system/profile")

        (define user-profile
          (and=> (getpw (getuid))
                 (lambda (pw)
                   (string-append (passwd:dir pw) "/.guix-profile"))))

        (define (xsession-command desktop-file)
          ;; Read from DESKTOP-FILE its X session command and return it as a
          ;; list.
          (define exec-regexp
            (make-regexp "^[[:blank:]]*Exec=(.*)$"))

          (call-with-input-file desktop-file
            (lambda (port)
              (let loop ()
                (match (read-line port)
                  ((? eof-object?) #f)
                  ((= (cut regexp-exec exec-regexp <>) result)
                   (if result
                       (string-tokenize (match:substring result 1))
                       (loop))))))))

        (define (find-session profile)
          ;; Return an X session command from PROFILE or #f if none was found.
          (let ((directory (string-append profile "/share/xsessions")))
            (match (scandir directory
                            (cut string-suffix? ".desktop" <>))
              ((or () #f)
               #f)
              ((sessions ...)
               (any xsession-command
                    (map (cut string-append directory "/" <>)
                         sessions))))))

        (let* ((home          (getenv "HOME"))
               (xsession-file (string-append home "/.xsession"))
               (session       (match (command-line)
                                ((_)
                                 #$(if fallback-session
                                       #~(list #$fallback-session)
                                       #f))
                                ((_ x ..1)
                                 x))))
          (if (file-exists? xsession-file)
              ;; Run ~/.xsession when it exists.
              (apply exec-from-login-shell xsession-file
                     (or session '()))
              ;; Otherwise, start the specified session or a fallback.
              (apply exec-from-login-shell
                     (or session
                         (find-session user-profile)
                         (find-session system-profile)))))))

  (program-file "xinitrc" builder))



-- 





  reply	other threads:[~2022-04-04  5:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:03 [bug#54434] [PATCH 0/6] XFCE Updates Brendan Tildesley
2022-03-17  8:04 ` [bug#54434] [PATCH 1/6] gnu: xfce4-whiskermenu-plugin: Update to 2.6.2 'Brendan Tildesley
2022-03-17  8:04   ` [bug#54434] [PATCH 2/6] gnu: xfce4-screenshooter: Update to 1.9.10 'Brendan Tildesley
2022-03-17  8:04   ` [bug#54434] [PATCH 3/6] gnu: XFCE: Remove input labels 'Brendan Tildesley
2022-03-17 19:48     ` Maxime Devos
2022-03-18  5:37       ` Brendan Tildesley
2022-03-17  8:04   ` [bug#54434] [PATCH 4/6] gnu: mate-polkit-for-xfce: Unhide package 'Brendan Tildesley
2022-03-17 17:36     ` Maxime Devos
2022-03-18  5:10       ` Brendan Tildesley
2022-03-18  8:16         ` Maxime Devos
2022-03-17  8:04   ` [bug#54434] [PATCH 5/6] gnu: XFCE: Add notification support 'Brendan Tildesley
2022-03-17  8:04   ` [bug#54434] [PATCH 6/6] gnu: mate-polkit: Improve synopsis 'Brendan Tildesley
2022-03-18  7:38 ` [bug#54434] [PATCH v2 0/7] XFCE Updates 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 1/7] gnu: xfce4-whiskermenu-plugin: Update to 2.6.2 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 2/7] gnu: xfce4-screenshooter: Update to 1.9.10 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 3/7] gnu: XFCE: Remove input labels 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 4/7] gnu: mate-polkit-for-xfce: Unhide package 'Brendan Tildesley
2022-04-03 10:25     ` [bug#54434] [PATCH 0/6] XFCE Updates Ludovic Courtès
2022-04-04  1:13       ` Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 5/7] gnu: XFCE: Add notification support 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 6/7] gnu: mate-polkit: Improve synopsis 'Brendan Tildesley
2022-03-18  7:38   ` [bug#54434] [PATCH v2 7/7] gnu: xfce4-session: Load user panel plugins 'Brendan Tildesley
2022-04-03 10:33     ` [bug#54434] [PATCH 0/6] XFCE Updates Ludovic Courtès
2022-04-04  2:42       ` Brendan Tildesley
2022-04-04  2:56         ` Feng Shu
2022-04-04  3:53           ` Brendan Tildesley
2022-04-04  4:59             ` Feng Shu [this message]
2022-08-22  1:16             ` 宋文武 via Guix-patches via
2023-08-25  9:57       ` bug#54434: " 宋文武 via Guix-patches via
2022-10-09  6:30 ` [bug#54434] " Brendan Tildesley

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=87h779xx2r.fsf@163.com \
    --to=tumashu@163.com \
    --cc=54434@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=mail@brendan.scot \
    --cc=maximedevos@telenet.be \
    /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.