[Software] How can I run a script just before xfce4 starts and just before it quits?
-
- Posts: 148
- Joined: 2014-01-31 21:32
- Has thanked: 7 times
- Been thanked: 2 times
[Software] How can I run a script just before xfce4 starts and just before it quits?
I have a few things I want to get done before xfce4 starts. And a few more things I want to do before it quits. Is there some point at which I can add a script to the chain of execution?
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
Research the following files and their differences
/etc/bash.bashrc
/etc/profile
/etc/bash.bash_logout
You can even use systemd-run
/etc/bash.bashrc
/etc/profile
/etc/bash.bash_logout
You can even use systemd-run
-
- Posts: 148
- Joined: 2014-01-31 21:32
- Has thanked: 7 times
- Been thanked: 2 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
Sorry, what does shell configuration have to do with it? I'd love to use systemd-run is someone answers my question as to how systemd-run might do the job.
- wizard10000
- Global Moderator
- Posts: 996
- Joined: 2019-04-16 23:15
- Location: southeastern us
- Has thanked: 112 times
- Been thanked: 161 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
.profile and .bashrc can both run scripts, the difference is that .profile is run once, .bashrc is sourced every time you run a script or open a terminal window so .bashrc wouldn't be a great choice for startup scripts but .profile should work just fine.
On logout? .bash_logout executes every time a shell terminates so that probably wouldn't be the place to run your scripts either.
Probably better to create systemd units to run your scripts.
Hope this helps -
we see things not as they are, but as we are.
-- anais nin
-- anais nin
-
- Posts: 148
- Joined: 2014-01-31 21:32
- Has thanked: 7 times
- Been thanked: 2 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
> Probably better to create systemd units to run your scripts.
I tried that. Seems the 'shutdown' scripts have a sequence problem, I try to save a session but by the time the unit is reached dbus is too far gone to save anything. I need to run the script prior to dbus quitting.
I tried that. Seems the 'shutdown' scripts have a sequence problem, I try to save a session but by the time the unit is reached dbus is too far gone to save anything. I need to run the script prior to dbus quitting.
- wizard10000
- Global Moderator
- Posts: 996
- Joined: 2019-04-16 23:15
- Location: southeastern us
- Has thanked: 112 times
- Been thanked: 161 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
dbus relies on a GUI session. There are tons of people who know more about XFCE than I do but I did find this, which sounds promising - https://forum.xfce.org/viewtopic.php?id=16176
Hope this helps -If you add a new Autostart item under Settings --> Session and Startup --> tab "Autostart Applications", you can specify at which time you want it to run--this includes logout and restart, among others.
we see things not as they are, but as we are.
-- anais nin
-- anais nin
-
- Posts: 148
- Joined: 2014-01-31 21:32
- Has thanked: 7 times
- Been thanked: 2 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
Thanks wiz, but it doesn't work. Damn, why not?
- wizard10000
- Global Moderator
- Posts: 996
- Joined: 2019-04-16 23:15
- Location: southeastern us
- Has thanked: 112 times
- Been thanked: 161 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
Sorry, but I'm afraid I don't know why - and can't be sure whether it's XFCE or the script. Maybe try putting together a script that does something simple like creating a text file and see if XFCE runs that? If that runs successfully the issue is most likely either the script or how the script is called. If it fails it's most likely an XFCE thing.
We should probably open this up to our studio audience, though - as I haven't run XFCE in a whole bunch of years
we see things not as they are, but as we are.
-- anais nin
-- anais nin
-
- Global Moderator
- Posts: 3001
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 60 times
- Been thanked: 243 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
Not intuitive, there is the autostart dialograyandrews wrote: ↑2024-06-03 01:43 Is there some point at which I can add a script to the chain of execution?
Settings>Session and Startup>Application Autostart
Create a new item and you will see there is an option for when to execute, on shutdown and on logout are options. This is the session manager doing the job.
Oh wait, wizard10000 already said that...
Mottainai
-
- Posts: 148
- Joined: 2014-01-31 21:32
- Has thanked: 7 times
- Been thanked: 2 times
Re: [Software] How can I run a script just before xfce4 starts and just before it quits?
"Oh wait, wizard10000 already said that..."
Doesn't work. Very strange. Identical command at CLI in a terminal works perfectly.
Doesn't work. Very strange. Identical command at CLI in a terminal works perfectly.