From f3e04981d8eaf7cc25b9f01cf91cf595abc4387c Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 17 Oct 2023 18:46:03 +0400 Subject: [PATCH] Try to pick user login shell instead of assuming bash The trick is inspired by `gnome-session`. --- resources/niri-session | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/niri-session b/resources/niri-session index 8d24bccc7..46d73aa20 100755 --- a/resources/niri-session +++ b/resources/niri-session @@ -1,4 +1,15 @@ -#!/bin/bash --login +#!/bin/sh + +if [ -n "$SHELL" ] && + grep -q "$SHELL" /etc/shells && + ! (echo "$SHELL" | grep -q "false") && + ! (echo "$SHELL" | grep -q "nologin"); then + if [ "$1" != '-l' ]; then + exec bash -c "exec -l '$SHELL' -c '$0 -l $*'" + else + shift + fi +fi # Make sure there's no already running session. if systemctl --user -q is-active niri.service; then