aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-10-17 18:46:03 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-10-17 19:05:58 +0400
commitf3e04981d8eaf7cc25b9f01cf91cf595abc4387c (patch)
treec90b627c3f017a5f907ebbee491089bff12c9245
parent58f6b3032519ce22635aba0d2d55f00c57c6e0f5 (diff)
downloadniri-f3e04981d8eaf7cc25b9f01cf91cf595abc4387c.tar.gz
niri-f3e04981d8eaf7cc25b9f01cf91cf595abc4387c.tar.bz2
niri-f3e04981d8eaf7cc25b9f01cf91cf595abc4387c.zip
Try to pick user login shell instead of assuming bash
The trick is inspired by `gnome-session`.
-rwxr-xr-xresources/niri-session13
1 files changed, 12 insertions, 1 deletions
diff --git a/resources/niri-session b/resources/niri-session
index 8d24bccc..46d73aa2 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