Skip to main content
Topic: Run shell script on startup? (Read 2569 times) previous topic - next topic
0 Members and 5 Guests are viewing this topic.

Run shell script on startup?

I recently started using pipewire pulse, and it works really well, except for the fact that it doesnt start automatically.
So, I have to either start pipewire, pipewire-media-session, and pipewire-pulse manually at the beginning of each session, or I could write a shell script that runs all 3 of these everytime I login. I've tried looking stuff up on how to write this kind of script, but all of the guides I've read seem to assume that I already know a little bit of shell scripting, when in fact i'm completely clueless about it. What I need is a 'retard-proof' guide on how to run a shell script on start-up
"Makin stupid questions since 2021"

Re: Run shell script on startup?

Reply #1
I know nothing about pipewire things, but I'm going to guess these are all things that need to be run as a normal user (i.e. not root). In that case, you can just place the commands in your .bashrc (or .zshrc or whatever shell you use) and they will be executed when you login.

Re: Run shell script on startup?

Reply #2
You don't even need a shell script if you're using a DE, just add pipewire{,-media-session,-pulse} to the list of applications automatically started with it. The actual instructions vary slightly depending on whether it's KDE/XFCE/GNOME/etc..

Wiki with a shell script you can copy-paste: https://wiki.artixlinux.org/Site/PipewireInsteadPulseaudio

Re: Run shell script on startup?

Reply #3
I know nothing about pipewire things, but I'm going to guess these are all things that need to be run as a normal user (i.e. not root). In that case, you can just place the commands in your .bashrc (or .zshrc or whatever shell you use) and they will be executed when you login.

hm i tried puttin em in my zshrc but it just kinda fucked up my terminal windows. if i put it in zshrc it starts the programs when I open a terminal window, not when I login
"Makin stupid questions since 2021"

Re: Run shell script on startup?

Reply #4
Every interactive zshell sources ~/.zshrc, so you have each shell reading this command on startup of your terminal.

If you run a DM/DE, use ~/.xprofile as you would ~/.xinitrc.

Re: Run shell script on startup?

Reply #5
Every interactive zshell sources ~/.zshrc, so you have each shell reading this command on startup of your terminal.

If you run a DM/DE, use ~/.xprofile as you would ~/.xinitrc.
I dont got either
"Makin stupid questions since 2021"

Re: Run shell script on startup?

Reply #6

Put the pipewire-related stuff in ~/.xinitrc, then. Above the `exec` line at the bottom  that launches your window manager. This is how you autostart when using startx. If you have another startup script, source the script in this file.

Re: Run shell script on startup?

Reply #7
Hello,
I will not make another post since my problem is the same.
Used to run Manjaro and Arch and never had any issue with arandr output for i3wm.

Now i just cannot do it anymore.

The xrandr output is :
Code: [Select]
#!/bin/sh
xrandr --output LVDS1 --primary --mode 1366x768 --pos 277x1080 --rotate normal --output DP1 --off --output DP2 --off --output DP3 --off --output HDMI1 --off --output HDMI2 --off --output HDMI3 --off --output VGA1 --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off

I tried to put it in .config/i3/config, tried to put in .xinitrc, it never starts.

Tried to make a script in /scripts/screenlayout.sh, changed the permissions , does not start.
I'm out of ideas...never had this issue in Manjaro.

Artix runit - i3-gaps

Re: Run shell script on startup?

Reply #8
I'm currently running Artix Linux with emptty (minimal display manager) and i3 wm.

Also, I'm running Pipewire for audio - and  it's running great.

I'm using the ~/.xinitrc to set up the Pipeware on every login.

 - also there is mpd, playerctl daemon, etc. I put all of them on the i3wm autostart script.

Re: Run shell script on startup?

Reply #9
Code: [Select]
~/scripts/screenlayout.sh
Should look different in .xinitrc ?

Re: Run shell script on startup?

Reply #10
For screen "xrandr" configuration, I run it on the i3 configuration using "exec_always" option.

Code: [Select]

##-- For nvidia driver ----------
exec_always xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto


Re: Run shell script on startup?

Reply #11
I don't have nvidia.
Maybe some services are not running. I also cannot get the trash icon in Thunar to show up, even tho i have all the packages installed.
I read about something about dbus.

 

Re: Run shell script on startup?

Reply #12
dbus, polkit, and power manager is important packages.