aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c16
-rw-r--r--doc/foot.5.scd7
-rw-r--r--footrc2
3 files changed, 15 insertions, 10 deletions
diff --git a/config.c b/config.c
index 246e0d18..4303c4ab 100644
--- a/config.c
+++ b/config.c
@@ -44,15 +44,19 @@ static const uint32_t default_bright[] = {
static char *
get_shell(void)
{
- struct passwd *passwd = getpwuid(getuid());
- if (passwd == NULL) {
- LOG_ERRNO("failed to lookup user");
- return NULL;
+ const char *shell = getenv("SHELL");
+
+ if (shell == NULL) {
+ struct passwd *passwd = getpwuid(getuid());
+ if (passwd == NULL) {
+ LOG_ERRNO("failed to lookup user");
+ return NULL;
+ }
+
+ shell = passwd->pw_shell;
}
- const char *shell = passwd->pw_shell;
LOG_DBG("user's shell: %s", shell);
-
return strdup(shell);
}
diff --git a/doc/foot.5.scd b/doc/foot.5.scd
index 30fd735c..2eebcf11 100644
--- a/doc/foot.5.scd
+++ b/doc/foot.5.scd
@@ -41,9 +41,10 @@ in this order:
_XxY_ (-padding).
*shell*
- Executable to launch. Typically a shell. Default: the user's
- default shell (as specified in _/etc/passwd_). You can also pass
- arguments. For example "/bin/bash --norc".
+ Executable to launch. Typically a shell. Default: _$SHELL_ if set,
+ otherwise the user's default shell (as specified in
+ _/etc/passwd_). You can also pass arguments. For example
+ "/bin/bash --norc".
*login-shell*
Start a login shell, by prepending a '-' to argv[0]. Default: _no_.
diff --git a/footrc b/footrc
index 7eea3ada..e63403f8 100644
--- a/footrc
+++ b/footrc
@@ -4,7 +4,7 @@
# scrollback=1000
# geometry=800x600
# pad=2x2
-# shell=<user's default shell (from /etc/passwd)> (you may need to override if you need a login shell)
+# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
# term=foot
# login-shell=no
# workers=<number of logical CPUs>