Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shepherd service does not inherit environment variables #19

Open
luishgh opened this issue Jun 12, 2024 · 1 comment
Open

Shepherd service does not inherit environment variables #19

luishgh opened this issue Jun 12, 2024 · 1 comment

Comments

@luishgh
Copy link

luishgh commented Jun 12, 2024

I'm trying to use dwl-guile with Guix Home inside a Void Linux installation. When I start it with herd start dwl-guile, it does not inherit the environment variables from the tty session nor loads ~/.profile. If I start it manually, it works. Is this intended? If so, how could I load the profile upon launch? I use it to load additional Guix profiles like shown here.

My current config:

(define dwl-configuration
  (home-dwl-guile-configuration
    (package
      (patch-dwl-guile-package dwl-guile
                               #:patches (list %patch-xwayland)))
    (environment-variables 
      `(("XDG_CURRENT_DESKTOP" . "dwl")
        ("XDG_SESSION_TYPE" . "wayland")
        ("MOZ_ENABLE_WAYLAND" . "1")
        ("ELM_ENGINE" . "wayland_egl")
        ("ECORE_EVAS_ENGINE" . "wayland-egl")
        ("_JAVA_AWT_WM_NONREPARENTING" . "1")))
    (auto-start? #f)
    (native-qt? #f)
    (config
      `(((setq inhibit-defaults? #t)
         (dwl:start-repl-server)
         (setq tags (map number->string (iota 9 1)))
         (dwl:set-tty-keys "C-M")
         (dwl:set-tag-keys "s" "s-S")
         (set-keys "s-<space>" 'dwl:toggle-floating
                   "s-<return>" '(dwl:spawn "foot")
                   "s-p" '(dwl:spawn "bemenu-run")
                   "s-e" '(dwl:spawn "emacsclient" "-c")
                   "s-j" '(dwl:focus-stack 1)
                   "s-k" '(dwl:focus-stack -1)
                   "s-l" '(dwl:change-master-factor 0.05)
                   "s-h" '(dwl:change-master-factor -0.05)
                   "s-<page-up>" '(dwl:change-masters 1)
                   "s-<page-down>" '(dwl:change-masters -1)
                   "s-t" '(dwl:cycle-layout 1)
                   "s-<left>" '(dwl:focus-monitor 'DIRECTION-LEFT)
                   "s-<right>" '(dwl:focus-monitor 'DIRECTION-RIGHT)
                   "s-<up>" '(dwl:focus-monitor 'DIRECTION-UP)
                   "s-<down>" '(dwl:focus-monitor 'DIRECTION-DOWN)
                   "s-S-<left>" '(dwl:tag-monitor 'DIRECTION-LEFT)
                   "s-S-<right>" '(dwl:tag-monitor 'DIRECTION-RIGHT)
                   "s-S-<up>" '(dwl:tag-monitor 'DIRECTION-UP)
                   "s-S-<down>" '(dwl:tag-monitor 'DIRECTION-DOWN)
                   "s-S-c" 'dwl:kill-client
                   "s-<tab>" 'dwl:view
                   "s-S-0" '(dwl:view 0) ;; 0 will show all tags
                   "s-f" 'dwl:toggle-fullscreen
                   "S-s-q" 'dwl:quit
                   "s-<mouse-left>" 'dwl:move
                   "s-<mouse-middle>" 'dwl:toggle-floating
                   "s-<mouse-right>" 'dwl:resize)
         (set-layouts 'default "[]=" 'dwl:tile
                      'monocle "|M|" 'dwl:monocle)
         ;; Launch helpful programs after init
         (add-hook! dwl:hook-startup
                    (lambda ()
                      ;(dwl:spawn "setxkbmap" "-option" "ctrl:nocaps")
                      (dwl:spawn "dunst")
                      ;(dwl:spawn "nm-applet" "--indicator")
                      (dwl:spawn "dtao-guile" "-c" ".config/dtao-guile/config.scm")
                      (dwl:spawn "emacs" "--daemon"))))))))
@Frewacom
Copy link
Member

Hm, I think this is caused by Shepherd spawning dwl-guile in a new environment that is different from the one which you spawn it from (not sure, though). However, I don't think this should be the default behaviour, and it is almost certainly not the behaviour you would expect as a user.

I am not quite sure what the best way of loading the environment variables is, or if there even is a good solution in this case. I suppose the temporary fix is to just spawn it manually instead of using Shepherd, as you said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants