Closed rambip closed 3 years ago
What you are trying to do (doing shell expansion within the cmd
attribute) is not supported, either by tuigreet
(for now) or, as far as I know, greetd
. Commands are executed as is, without a shell present.
Without any modification in tuigreet
, what I would do is execute a global script, /usr/local/bin/start-session
for example, that will check the current user and start the appropriate session accordindly (the script will be executed as the just-authenticated user).
Something akin to this:
#!/bin/sh
case "$(whoami)" in
'apognu')
sway
;;
'bob')
uname
;;
esac
Thanks, this is really helpfull ! And with nixos I will be able to create the script in my global config, this could be a really nice solution !
Just for curiosity sake, would that work if the content of my file is as follows:
!/bin/sh
source $HOME/.profile
exec $START_SESSION_COMMAND
# START_SESSION_COMMAND is defined in the user config
Absolutely, the session is executed by your user, so $HOME
will be defined and you can start a session exactly like that.
What $START_SESSION_COMMAND
should do will depend on the program you need to run, obviously, but I'm sure you already have that lying around.
@rambip Did that answer your question?
Yeah thanks a lot ! I just need to dig a bit to know when exactly the user environment variables are set on nixos, and it will be good.
I would like to start a graphical session (gnome, sway, xmonad, and so on) depending on the user. I tried to do
But that didn't work.
Since there is no standard way to start a graphical session (except startx but this was created for X), I don't know how to do that.
I know this is not a good issue, but help would be really apreciated.