sway session does not source /etc/profile or ~/.profile

Bug #1924653 reported by Douglas Royds
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
sway (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

/usr/share/wayland-sessions/sway.desktop executes sway directly, not via a login shell, so /etc/profile is not sourced. Additionally, when the user opens a terminal (by default via x-terminal-emulator), this is not a login shell, so the user's ~/.profile is not sourced either. This is unexpected behaviour.

There was an extensive discussion on this subject for gnome wayland sessions [1] resolved by (amongst other things) adding logic to /usr/bin/gnome-session [2].

For my own personal use, I have created a /usr/bin/sway-session script that I launch from my own .desktop file in /usr/share/wayland-sessions:

#!/bin/sh
. /etc/profile
test -r ~/.profile && . ~/.profile
exec sway

Ubuntu 20.04.2 LTS
sway 1.4-2

[1] https://bugzilla.gnome.org/show_bug.cgi?id=736660
[2] https://bug736660.bugzilla-attachments.gnome.org/attachment.cgi?id=343441

Revision history for this message
Douglas Royds (douglas-royds) wrote :

On my install, I have /usr/bin/sh -> bash

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sway (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.