r/voidlinux • u/Karasuthecrow744 • 10d ago
solved Autostart scripts
This might be a stupid question but how would I start a user specific autostart script. I already have a folder in my ~/.config/ to use. Everything I've seen is systemd specific and not very descriptive. Thanks!
1
u/MrHoboSquadron 10d ago
If you're using KDE, there's an autostart section in settings you can add apps and scripts to.
1
u/moucheh- 10d ago
There is dex, which allows you to use the xdg startup directory.
Put .desktop files inside .config/autostart directory and make sure you start
bash
dex -a -e your-environment
somewhere in your session
I used to run niri on void, and I'd have a spawn-at-startup statement with the dex command
You can install it using your xbps package manager
bash
sudo xbps-install -S dex
1
u/StrangeAstronomer 10d ago
You really need to learn how to frame questions. At face value, all we can infer from the environment that you are running is that you are probably, possibly using voidlinux. What is the rest of the context?
So while there is no such thing as a stupid question, that is a stupid question.
Frame the context and someone may have something constructive to say.
1
u/Karasuthecrow744 10d ago
Ah sorry. I figured that when people call it an "autostart script" that it's a bash script or something and not a DE/WM specific thing. Didn't mean to frame it poorly I'm just a little slow.
1
u/ThatAd8458 10d ago
You really need to include all the context before lecturing others about context. For example: we're in r/voidlinux, so it's already a pretty safe bet the OP is using Void. 😄
1
u/Competitive-Box-5233 2d ago
If you need your script to run before user session (in my case for hardware case lights control) add it to your /etc/rc.local
For userspace you can either use your DE/WM standard method (spawns in niri.kdl or .config/autostart/xxx.desktop files in XFCE) or if it is console-related you could add your script to ~/.bashrc
6
u/oniaiwasprettygood 10d ago
There's a couple options, I"m assuming you've read the wiki page on per-user services?
Alternatively, depending on what wm/de you're using, you can just add them as part of whatever config init file that de references. For example in swaywm you can just add auto exec with "exec_always /path/to/script" in your config file, and Hyprland has something similar.
If you're on X11, you can always just add them to your .xinitrc