You are not logged in.

#1 2021-12-17 02:37:20

DanielPowerNL
Member
Registered: 2017-06-09
Posts: 13

[SOLVED] Source zprofile when launching sway on login with greetd

Previously, I had the following in my .zshrc. This caused sway to auto-launch when I login on tty1. And my environments set in .zshrc would be set inherited in sway.

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
  XKB_DEFAULT_LAYOUT=us exec sway
fi

However, in order to get auto-login, I've recently switched to greetd, using the following config:

[terminal]
vt = 1

[default_session]
command = "sway"
user = "daniel"

This works fine to launch sway. But the environment variables defined in .zshrc do not get inherited. I've also tried setting command to `zsh -c sway` and `zsh --login -c sway`. But in both cases, my environment variables are not inherited.

I've also tried setting the environment variables in `.zprofile`, since according to this wiki article: https://wiki.archlinux.org/title/zsh

$ZDOTDIR/.zprofile Used for executing user's commands at start, will be read when starting as a login shell. Typically used to autostart graphical sessions and to set session-wide environment variables.

I'm sure there's something simple I'm overlooking here. Would appreciate if someone could point me in the right direction here. Thank you for your time.

Edit: This was just a dumb mistake on my part. `command = "zsh --login -c sway"` works fine. The problem was that I created a `.zprofile` in my dotfiles folder, and then never symlinked it to my home directory. Facepalm.

Last edited by DanielPowerNL (2021-12-17 07:51:17)

Offline

Board footer

Powered by FluxBB