You are not logged in.

#1 2016-07-04 02:51:12

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Reorganize autostart

I've been bitten by volumeicon not starting on 2 installs, so I came up with this. It's fully commented, please adjust it as needed and test it.

~/.config/openbox/autostart
(I've omitted lines 1-20, the opening comments.)

## SETTINGS START

## Start the tint2 session (the default tint2 will run if no sessions have been set)
bl-tint2-session &

## Set a wallpaper
nitrogen --restore &

## DAEMONS

## GNOME PolicyKit authentication
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &

## Enable power management
xfce4-power-manager &

## Start Thunar Daemon, if set as bl-file-manager
if [ "$(readlink -f $(which bl-file-manager))" = "$(which thunar)" ]
then
    thunar --daemon &
fi

## DAEMONS END

## Turn on/off system beep.
xset b off

## Set keyboard settings - 250 ms delay and 25 cps (characters per second) repeat rate.
## Adjust the values according to your preferances.
xset r rate 250 25

## Add keyboard mapping.
#xmodmap -e "keysym Insert = Multi_key"

## Configure touchpad. See 'man synaptics' for more info.
synclient VertEdgeScroll=1 HorizEdgeScroll=1 TapButton1=1 2>/dev/null

## Disable touchpad while typing
syndaemon -i .5 -K -t -R -d &

## Disable CapsLK
setxkbmap -option ctrl:nocaps

## SETTINGS END


## DELAYS

## Compton
(sleep 1; bl-compositor --start) &

## Volume control for systray
(sleep 2; volumeicon) &

## Start Clipboard manager
(sleep 3; clipit) &

## I like toonz
(sleep 4; audacious) &

## Start the Conky session (the default conkyrc will run if no sessions have been set)
(sleep 5; bl-conky-session --autostart) &



## DISABLED

## Volume keys daemon
#xfce4-volumed &

## Start the battery applet
#(sleep 2; fdpowermon) &

## Start xscreensaver (light-locker now used by default, run via XDG autostart.)
#xscreensaver -no-splash &

## bl-welcome - post-installation script, will not run in a live session and
## only runs once. Safe to remove.
#(sleep 10; bl-welcome --firstrun) &

## bl-fortune - have the system come up with a little adage (not yet enabled)
#(sleep 120; bl-fortune) &

Offline

#2 2016-07-04 03:13:46

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

You're not advocating this as a replacement for the default install file are you?
If so, I'd have a few comments...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#3 2016-07-04 03:16:25

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

I'm opening a discussion thread to see if our autostart could be improved. I saw one post where someone needed a 30sec delay for volumeicon. There are also tint2 artifact icon posts. Comment away!

-edit- Ah, this post...
https://forums.bunsenlabs.org/viewtopic … 352#p31352

Is that true? The file is read from top to bottom, some daemons take longer to start than others, some applets take longer to start than others, etc... Just ghost stories?

Offline

#4 2016-07-04 03:27:42

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

  • ##SETTINGS## was meant to be a section for commands that didn't need a final ampersand.

  • Some necessary things (esp. bl-welcome) have been disabled, others can just be removed.

  • Agreed we should increase the default sleep for volumeicon.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#5 2016-07-04 03:29:44

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

johnraff wrote:

##SETTINGS## was meant to be a section for commands that didn't need a final ampersand.

Learn something new every day. :^D I added an edit a couple posts up.

Offline

#6 2016-07-04 03:31:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

All commands with final ampersands will be started one after the other, yes, but the delay will be microscopic - just the time needed to create a new shell - so the time difference between top and bottom can be ignored. Applets and daemons will do their own things inside those new shells, leaving the parent shell free to continue to the next item. The sleeps are the only significant factor.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#7 2016-07-04 07:06:05

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

No ampersand is needed after

nitrogen --restore
xfce4-power-manager
thunar --daemon
syndaemon -i .5 -K -t -R -d
xfce4-volumed

Shall we remove them?

https://github.com/BunsenLabs/bunsen-configs/pull/45


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#8 2016-07-04 07:26:14

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

^So all those commands return quickly?
Even if they only run for a few milliseconds, there might be a case for keeping the ampersands anyway.

*) Those milliseconds might add up.
*) The abhorred subshell will close anyway once the command has finished running.
*) It's easier to explain to a new user that ampersands are needed except for things in the ##SETTINGS## section.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#9 2016-07-04 08:49:24

earlybird
ほやほや
Registered: 2015-12-16
Posts: 738
Website

Re: Reorganize autostart

johnraff wrote:

^So all those commands return quickly?
Even if they only run for a few milliseconds, there might be a case for keeping the ampersands anyway.

*) Those milliseconds might add up.
*) The abhorred subshell will close anyway once the command has finished running.
*) It's easier to explain to a new user that ampersands are needed except for things in the ##SETTINGS## section.

Technically, only nitrogen should get run in a subshell because the other applications daemonize themselves (nitrogen will block until it's done). With ampersand that'd be at maybe 3x(2+1) fork() calls over just 3x2 fork() calls for the executables which perform demonization by themselves.

For Helium, there could be a systemd-based implementation of that file so that we can just systemctl --user enable $FOO and the unit config would encapsulate all this  logic ]:-)

Offline

#10 2016-07-04 09:17:20

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

madoromi wrote:

For Helium, there could be a systemd-based implementation of that file so that we can just systemctl --user enable $FOO and the unit config would encapsulate all this  logic ]:-)

Would that cope with all the stuff in openbox's autostart?
Would it be easily user-tweakable?
If so, then let's go for it!


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#11 2016-07-04 14:11:38

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

I'm glad I opened this thread!

I'm guessing that compositing is the culprit for icon glitches and maybe even for volumeicon choking, so just delay items long enough for compton to kick in? Does staggering startups like I did help? It certainly looks pretty on my desktop, each element popping up a second apart.

Offline

#12 2016-07-04 14:27:47

damo
....moderator....
Registered: 2015-08-20
Posts: 5,647

Re: Reorganize autostart

^ or start compositing last?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#13 2016-07-04 16:43:41

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

damo wrote:

^ or start compositing last?

Would seem to make sense, and that's how I have things now, but it doesn't seem to make much difference. Neither does my question about staggering, it's not like the computer gets confused by 2 or more sleep times being identical.

I did discover, though, that logging out and logging back in is fairly worthless for testing. volumeicon needs a long delay when logging in after a fresh boot/reboot. I currently have mine set to sleep for 10 seconds, so I could see how one might need 30 seconds on old hardware.

Grrr, if the applet doesn't start or if your panel/systray of choice dies, you have no volume control. Not ideal. I'm going to take some hard looks at Mate and Gnome, pulseaudio and keyboard volume controls and notifications work OOTB on both with my hardware (KDE too). Lxde has exactly the same issue on my box, and enlightenment has it's own issues.

Offline

#14 2016-07-04 16:51:46

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

madoromi wrote:

only nitrogen should get run in a subshell [...] (nitrogen will block until it's done)

This is not correct.

The `nitrogen --restore` command returns the prompt immediately and does not launch nitrogen itself, it just sets the wallpaper and quits.

johnraff wrote:

So all those commands return quickly?

Yes.

I've just been trying this out in my own (bare metal) BL system and this autostart works absolutely perfectly and much quicker than the current version:

empty@TheLab ~ % grep -v '^#\|^$' ~/.config/openbox/autostart
synclient VertEdgeScroll=1 VertTwoFingerScroll=0 HorizEdgeScroll=1 2>/dev/null
xset r rate 250 25 b off s 300 -dpms
nitrogen --restore 
bl-compositor --start
bl-tint2-session
bl-conky-session --autostart
volumeicon &
xfce4-volumed 
xfce4-power-manager

The only ampersand required is for volumeicon and this autostart script does *not* need any `sleep` commands at all...

Perhaps all the fork()s in the stock script are conflicting and causing problems?

twoion wrote:

For Helium, there could be a systemd-based implementation of that file

That would require the entire X server to be run as a --user session and is non-trivial to set up, see https://wiki.archlinux.org/index.php/Sy … er_service

I'm not sure if this is even possible under Debian hmm


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#15 2016-07-04 17:12:55

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

^ Will test asap, I'm building an ISO atm.

Offline

#16 2016-07-04 17:51:56

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

Head_on_a_Stick wrote:

this autostart script does *not* need any `sleep` commands at all

Update: that script works fine if the user logs out and back in again but volumeicon fails at the first log in after boot.

~/.xsession-errors

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

volumeicon: alsa_backend.c:86: asound_get_volume: Assertion `m_elem != ((void *)0)' failed.

hmm

I will test some more...

EDIT: This works on my hardware:
https://gist.github.com/Head-on-a-Stick … 2d50ed455a

So the `sleep 2s` seems to be needed only for the first log in after boot, perhaps because PA hasn't initialised properly at that point.

I think we need a bigger data set though.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#17 2016-07-04 20:03:15

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

@HoaS,

You can cross out xfce-volumed from your autostart. tongue

You're not starting polkit, is that just for this example? Same with the different touchpad settings?

Offline

#18 2016-07-04 20:07:35

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

hhh wrote:

You can cross out xfce-volumed from your autostart. tongue

Good spot, yes, but I did that just after posting angel (no change in behaviour)


hhh wrote:

You're not starting polkit, is that just for this example? Same with the different touchpad settings?

Ah yes, it's my own desktop.

I will try some runs with the stock script to see if they make any difference.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#19 2016-07-04 20:43:49

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

OK, this works for me:

synclient VertEdgeScroll=1 HorizEdgeScroll=1 TapButton1=1 2>/dev/null
xset r rate 250 25
xset b off
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
nitrogen --restore
bl-compositor --start
bl-tint2-session
bl-conky-session --autostart
(sleep 2s;volumeicon) &
clipit &
if [ "$(readlink -f $(which bl-file-manager))" = "$(which thunar)" ]
then
    thunar --daemon &
fi
xfce4-power-manager

Can somebody else test this please?

Interestingly, if `thunar --daemon` is run without an ampersand then volumeicon fails on my system even if called manually after the desktop has started with the error message I posted above. This may be a red herring though.

What does `thunar --daemon` actually do?

I still have automounting with that stanza commented out.

From thunar(1):

       --daemon
           Do not terminate the Thunar instance when the last window is
           closed, but keep it running to speed up opening new windows later
           on. This is the default when spawning Thunar as part of the default
           Xfce session or when using D-Bus activation.

I can't tell the difference in window opening speed hmm


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#20 2016-07-04 20:51:00

hhh
Meep!
Registered: 2015-09-17
Posts: 9,082
Website

Re: Reorganize autostart

thunar --daemon & autostarts thunar without opening a window, as opposed to thunar &. See man thunar. I can confirm thunar --daemon needs an ampersand whether or not it's wrapped in that little script.

I'm using almost the same file as you (&s are all the same) and I like how it's working, less flicker IMO. I can get volumeicon's sleep time down to 5 from a cold boot, it balks at 4. Better than it was, it would seem.

OK, I'm off to do a minimal Mate ISO and start comparing packages, but that's for another thread. monkey

-edit- I should post what I'm using...

## Set a wallpaper.
nitrogen --restore

## Configure touchpad. See 'man synaptics' for more info.
synclient VertEdgeScroll=1 HorizEdgeScroll=1 TapButton1=1 2>/dev/null

## Set keyboard settings - 250 ms delay and 25 cps (characters per second) repeat rate.
## Adjust the values according to your preferances.
xset r rate 250 25

## Turn on/off system beep.
xset b off

## Add keyboard mapping.
#xmodmap -e "keysym Insert = Multi_key"

## Disable touchpad while typing
syndaemon -i .5 -K -t -R -d

## Disable CapsLK
setxkbmap -option ctrl:nocaps

## GNOME PolicyKit authentication
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &

## Enable power management
xfce4-power-manager

## Start Thunar Daemon, if set as bl-file-manager
#if [ "$(readlink -f $(which bl-file-manager))" = "$(which thunar)" ]
#then
#    thunar --daemon &
#fi
thunar --daemon &

## Start the tint2 session (the default tint2 will run if no sessions have been set)
bl-tint2-session &


## DELAYS

## Start the Conky session (the default conkyrc will run if no sessions have been set)
(sleep 3; bl-conky-session --autostart) &

##Compton
(sleep 7.5; bl-compositor --start) &

## Volume control
(sleep 5.5; volumeicon) &

## Toonz
(sleep 7; audacious) &

-edit- compton is one flicker, I've decided I like it in the middle instead of at the end. I love that the wallpaper has no flicker on my desktop anymore.

Offline

#21 2016-07-05 06:38:56

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

I came here to report that 'thunar --daemon' does not return the prompt in a terminal, and locks autostart if it's used without an ampersand, but you guys seem to have figured that out already. (xfce4-power-manager does return the prompt however.)

As to a gain in the speed of opening Thunar windows after launching the daemon, I haven't noticed any to be honest. Perhaps it helped in days of yore, but maybe that command could now just be dropped?

HoaS wrote:

The `nitrogen --restore` command returns the prompt immediately

not for me: ~120ms here. Why hold up the script for even that time? The subshell will be gone once its work is done.

xfce4-volumed will be removed soon anyway.

That leaves:

xfce4-power-manager: I have no particular objections to dropping its ampersand, but don't think it will change anything to speak of.

bl-compositor --start: this launches compton in the background anyway, so, agreed, needs no ampersand itself.

bl-tint2-session: I've just noticed that the last line in this script is 'bl-compositor --restart'! Is that needed at startup? It seems a bit wasteful, and makes the script take 1.2s to run! Definitely a case for an ampersand, or reediting I'd say.

bl-conky-session --autostart: this takes even longer to run: ~3s on my setup (with 4 conkys, agreed) and surely should get an ampersand.

@HoaS to be honest, it's hard to imagine how leaving all those ampersands out of the autostart script you posted made your login faster. I can't test it easily here, though, because my desktop setup is so non-standard and my autostart contains a whole bunch of other stuff.

What remains is the sleep times. A lot of those were inherited from #! and others were the result of random trial and error.

I was under the impression that some apps needed to be started after openbox, hence the default 2s or 3s for many things. This might no longer be true...

There has been a lot of discussion about whether compton should be started before or after tint2.

There seems to be no doubt that if volumeicon doesn't get some sleep then on a fresh bootup pulse won't be ready in time for it. It would be nice if we could find some system call to detect whether the blessed state had been reached or not, rather than just guessing - a time which will be different for each machine.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#22 2016-07-05 06:53:57

damo
....moderator....
Registered: 2015-08-20
Posts: 5,647

Re: Reorganize autostart

johnraff wrote:

...
bl-tint2-session: I've just noticed that the last line in this script is 'bl-compositor --restart'! Is that needed at startup? It seems a bit wasteful, and makes the script take 1.2s to run! Definitely a case for an ampersand, or reediting I'd say.
...

IIRC That was introduced because of systray icon issues, which I think have now been resolved.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#23 2016-07-05 07:50:34

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,383
Website

Re: Reorganize autostart

^ I'll try commenting out that last line in /usr/bin/bl-tint2-session and see if anything breaks. Maybe you, and others, could try the same?

EDIT: I'm correct in thinking that bl-tint2-session is only called at startup, right?

Last edited by johnraff (2016-07-05 07:54:33)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#24 2016-07-05 07:52:14

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

johnraff wrote:
HoaS wrote:

The `nitrogen --restore` command returns the prompt immediately

not for me: ~120ms here. Why hold up the script for even that time? The subshell will be gone once its work is done.

That's less than an eyeblink -- why make a fork() call for the sake of 120ms?

@HoaS to be honest, it's hard to imagine how leaving all those ampersands out of the autostart script you posted made your login faster.

Yes, sorry the speed wasn't really the issue for me, I just mentioned that in passing.

I just dislike unnecessary calls in the script -- if the delays in the bl-scripts warrant an ampersand to speed up the desktop start process then why add arbitrary  `sleep` commands to it?

What remains is the sleep times. A lot of those were inherited from #! and others were the result of random trial and error.

I was under the impression that some apps needed to be started after openbox, hence the default 2s or 3s for many things. This might no longer be true...

Yes, I think so too -- the only `sleep` needed on my hardware is for volumeicon.

How about on your hardware?

There has been a lot of discussion about whether compton should be started before or after tint2.

Is this even relevant for the stock BL desktop?

The tint2 panel sits below the windows so a lack of true transparency makes no difference at all.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#25 2016-07-05 07:54:03

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Reorganize autostart

damo wrote:
johnraff wrote:

...
bl-tint2-session: I've just noticed that the last line in this script is 'bl-compositor --restart'! Is that needed at startup? It seems a bit wasteful, and makes the script take 1.2s to run! Definitely a case for an ampersand, or reediting I'd say.
...

IIRC That was introduced because of systray icon issues, which I think have now been resolved.

The systray icon artefacts are still present on my Intel Haswell laptop and the compositor restart fixes them -- that should be left in IMO.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

Board footer

Powered by FluxBB