Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-06-30 03:20:42

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 812

when ~/.config/autostart stuff runs

when ~/.config/autostart stuff runs, how much of Xfce is (supposed to be) up and running?

Offline

#2 2022-06-30 03:32:09

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: when ~/.config/autostart stuff runs

On Xubuntu 20.04, the run hooks are started after Client2, which is xfce4-panel, so pretty much the core Xfce is already set up.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#3 2022-06-30 03:41:57

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 812

Re: when ~/.config/autostart stuff runs

is the panel up and visible?  i guess panel loads plugins so that can be a timing thing.  i'm trying to decide if i can put my custom initialization code in autostart, or if i need to run it before Xfce starts (e.g X starts my script first and then my script starts Xfce (or whatever X was configured to start).   my script needs to be sure that only one instance gets run per session.  i'm worried that the environment won't have enough session context until Xfce is started.

Last edited by Skaperen (2022-06-30 03:42:44)

Offline

#4 2022-06-30 04:03:31

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: when ~/.config/autostart stuff runs

Skaperen wrote:

is the panel up and visible?

It is in the middle of it: the base windows get initialized just a split second later, though the bus name and is already owned.

i guess panel loads plugins so that can be a timing thing.

They are loaded as soon as the base window is initialized. Sequentially, IIRC.

i'm trying to decide if i can put my custom initialization code in autostart, or if i need to run it before Xfce starts (e.g X starts my script first and then my script starts Xfce (or whatever X was configured to start).

It really depends on what the script is intended to do and the component it acts upon. For example, my little wrapper to xfce4-panel that rearranges panel windows resides in the autostart directory and just waits until the panel windows appear, then calls the script that does the actual job in ~/bin.

my script needs to be sure that only one instance gets run per session.  i'm worried that the environment won't have enough session context until Xfce is started.

To help you decide, you can copy /etc/xdg/xfce4/xinitrc to ~/.config/xfce4/xinitrc and set the XFSM_VERBOSE environment variable there. This will make the Xfce session manager log its activity to ~/.xfce4-session.verbose-log, which you can further inspect and analyze.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#5 2022-07-01 01:03:24

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 812

Re: when ~/.config/autostart stuff runs

would be nice if it put timestamps on those log entries.

Offline

#6 2022-07-03 10:51:40

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: when ~/.config/autostart stuff runs

I haven't tested it, but it probably opens that file on file descriptor 2 (stderr).

Perhaps you could try duplicating stderr from stdout, then capturing that output in a while read loop and sending it back, or to another file.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#7 2022-07-03 17:24:50

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 812

Re: when ~/.config/autostart stuff runs

KBar wrote:

Perhaps you could try duplicating stderr from stdout, then capturing that output in a while read loop and sending it back, or to another file.

you mean in a script the runs in place of Xfce, sets up the file descriptors, launches a script to read stdin lines coming from stderr over a pipe, add the timestamp, and exec the real XFce?  won't that affect stderr in everything run from there?

edit:
Skaperen notices his posts count reached 666.

Last edited by Skaperen (2022-07-03 17:27:25)

Offline

#8 2022-07-04 18:33:59

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: when ~/.config/autostart stuff runs

Skaperen wrote:

you mean in a script the runs in place of Xfce, sets up the file descriptors, launches a script to read stdin lines coming from stderr over a pipe, add the timestamp, and exec the real XFce?  won't that affect stderr in everything run from there?

You make it sound incredibly complex. Here, try this working example:

  # start xfce4-session normally
  (sleep 2s; while read -r line; do printf "[%s] %s\n" "$(date '+%T.%N')" "$line"; done < /home/sid/.xfce4-session.verbose-log > $(mktemp) ) &
  XFSM_VERBOSE=1 exec xfce4-session

Add it to your ~/.config/xfce4/xinitrc. The temporary log will live in /tmp/tmp.* for the duration of the session.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#9 2022-07-06 01:13:41

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 812

Re: when ~/.config/autostart stuff runs

i was trying to describe the steps in running a program (script, binary, whatever) that becomes the other end of of a pipe that gets written to whenever stderr is written to.  i would avoid having processes be started just to get a timestamp.  i would do this in Python or C.

Offline

#10 2022-07-08 16:59:45

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: when ~/.config/autostart stuff runs

Skaperen wrote:

i would avoid having processes be started just to get a timestamp.

How do you think programs run?

i would do this in Python or C.

Please do and share the result! smile


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

Board footer

Powered by FluxBB