How to start a custom script with lightdm?

Hi guys. I installed EnOS barebones and installed bspwm. It running pretty well. But I am struggling to add an autostart script. I installed lightdm and a webkit2-greeter-theme.

I have a option to add script in bspwmrc file but it feels a bit laggy at startup. It doesn’t lag tho but the script runs after bspwm and for a second my screen become blank and then suddenly wallpaper and bar appears. When I used to start it with startx in tty i used .xinitrc file to restore wallpaper and bar. It would show up rightway.

After installing lightdm it is not using .xinitrc and I am struggling to find where I can put my startup script. I just want to start compositor, nitrogen and bar rightaway and for others I can add in bspwmrc.

Tried different ways to I found on the internet but nothing seems working.
Didn’t know where should I post. So I thought I can get help here.

Move it to /usr/local/bin/script.sh and make it executable:

sudo chmod +x /usr/local/bin/script.sh

Open /etc/lightdm/lightdm.conf as root and make these changes in the file and reboot:

[Seat:*] #remove the line which were here

display-setup-script = /usr/local/bin/script.sh
1 Like

will try right now. :grinning:

Edit: Didn’t work. It just started up polybar even before lightdm theme.

@hyper-dot
touch $HOME/.config/bspwm/autoscript.sh
chmod +x $HOME/.config/bspwm/autoscript.sh
nano $HOME/.config/bspwm/autoscript.sh

#!/bin/bash

function run {
  if ! pgrep $1 ;
  then
    $@&
  fi
}

# Wallpaper
nitrogen --restore &

#picom
picom &

# Notifications
/usr/bin/dunst &

# polkit
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

and in bspwmrc

put this line

#LAUNCHERS
$HOME/.config/bspwm/autoscript.sh

edit:
I have only written
picom nitrogen dunst and polkit
so you can put whatever you want to startup as autostart

1 Like

It works.
But not the way I wanted.
It certainly loads little faster than before and starts everything at a time. Even though I can see gray screen before loading for a some milisecond :sweat_smile:.

You have a typo here. It should be autoscript.sh

yes i just saw it thanks

now i have replaced ssd with eos bspwm
and I use autoscript.sh
started polybar wallpaper picom and some other things very fast
now i want to try with .xinitrc just to see if there is a difference

1 Like

Okay. :grinning:

now i have tried with .xinitrc
i put this line in .xinitrc
nano $HOME/.xinitrc

[ -r ~/.xprofile] &&. ~/.xprofile

nano $HOME/.xprofile

# dunst
dunst -config $HOME/.config/dunst/dunstrc &

# nitrogen
nitrogen --restore &

# picom
picom --experimental-backends --config $HOME/.config/picom.conf &

# polybar
$HOME/.config/bspwm/polybar/launch.sh &

can not feel the difference
but try to see if it works for you

I also didn’t feel any difference at all.

I think the snappiness was because of loading from tty. It would take time as much it needed and then display the whole thing in a shot.

I will use this one for sure.

It is a better solution.

It will be waste of time to dig into it.

@Venom Thank you for your support. Hope you don’t mind anything. :grinning:

1 Like

this is not running as your user and runs as lightdm “user” it will only work for like set up displays with Xorg (aka xrandr script)

Yes you are right. It might be this one then:

session-setup-script

session-setup-script = Script to run when starting a user session (runs as root)
will be bad too

1 Like

This is a standard xyproblem.
Post what you want to achieve with your script and why.
Then we can advise about how to accomplish this task.

3 Likes

@petsam I just dropped the idea. :slightly_smiling_face:
I am running it with bspwmrc.

I had stated what i wanted to start. But let it be. I am pretty satisfied with what I got.

1 Like