I have many pepole dot files using this syntax exec-once = <cmd> & Do we need &?
How does hyprland executes exec-once ? Because i see that we can even have bash syntax there like pipes , logical operator: ||, &&?
I have many pepole dot files using this syntax exec-once = <cmd> & Do we need &?
How does hyprland executes exec-once ? Because i see that we can even have bash syntax there like pipes , logical operator: ||, &&?
No need for the & at the and, since all it does is tell the shell to run the command in the background. As for the syntax, I believe it works, since according to the docs it “executes a shell script”
I couldn’t find the souce code but i did some testing and found out that if we just have simple commands in exec-once i.e, commands with arguments, it executed the command without any shell. But if we have shell syntax like pipe or logical operator, it uses sh shell. For the case of & as it is also bash syntax but this is excluded and still launched without any shell.
So i just learned that sh -c <cmd>, sh will exec() system call if it is simple command as there is no need to shell to be alive, but if use features like pipes, shell need to manage pipe filedescriptor and other things, so it stays alive.
Therefore, hyprland just passes everything after exec-once= to sh and sh handles all the cases.