You are not logged in.

#1 2014-10-23 21:20:01

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED]How to run a script after xfce4 start?

I have custom settings for the keyboard which I apply by automatically running the 'setxkbmap' command on each desktop environment (XFCE) start. If I place the command into the 'Application autostart' list, then it is always run before the 'Xfsettingsd' daemon is started (this is a system XFCE daemon that cannot be turned off) and this daemon overrides the changes just made by my 'setxkbmap' command. How a script or command can be run automatically *after* the XFCE initialization (namely after the aforementioned daemon has started)?

Thanks.

EDIT: A couple months ago (when this question was first asked) the problem was solved by renaming the startup file for my command in the autostart directory. But after a recent system upgrade, that solution doesn't work anymore. So, the question is actual.

Last edited by nbd (2015-01-19 18:22:05)


bing different

Offline

#2 2014-10-23 21:35:58

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: [SOLVED]How to run a script after xfce4 start?

$HOME/.config/autostart/mystarter.desktop
?

Last edited by Moo-Crumpus (2014-10-23 21:36:48)


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#3 2014-10-24 02:25:10

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

Moo-Crumpus:

I have the file for my command in that directory (it's automacally placed there when a command is added to autostart list?). But my file is always executed before another program in the autostart list: Xfsettingsd, which overwrites the xfce settings that are written by '$HOME/.config/autostart/mystarter.desktop'. I need to run my command somehow after that Xfsettingsd.


bing different

Offline

#4 2014-10-24 05:12:59

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: [SOLVED]How to run a script after xfce4 start?

Both are starters in the autostart folder? I guess they start in alphabetical order. Maybe renaming the files will give an ordered start, like 10-stater.desktop, 20-starter.desktop, ... .


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#5 2014-10-24 06:50:34

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

Moo-Crumpus

thanks for the tip, it worked.


bing different

Offline

#6 2014-12-24 00:36:28

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

Unfortunally, after a recent system upgrade, the solution with file renaming doesn't work anymore. So, the question is actual again.


bing different

Offline

#7 2014-12-24 01:15:48

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,535

Re: [SOLVED]How to run a script after xfce4 start?

You might put only one which will run the scripts in the sequent subdirectory in alphabetical order. like

if [ -d / $HOME/.config/autostart/autostart.d/] ; then
 for f in $(ls $HOME/.config/autostart/autostart.d/?*.desktop |sort) ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

Obviously you need $HOME/.config/autostart/autostart.d/ (not tested)

EDIT
Ehm, the script has some flaw, like listing names with spaces.

Last edited by TheSaint (2014-12-24 02:18:40)


do it good first, it will be faster than do it twice the saint wink

Offline

#8 2014-12-24 01:38:34

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

TheSaint,

I deleted the 'Xfsettingsd' startup file from the autostart directory ($HOME/.config/autostart/) at all,  but the daemon starts even without that file automatically and overrides the settings made by my autostart script. Notably, the autostart scripts seem to be run in the random order because sometimes the settings made by my autostart script are not overriden, and sometimes they are. Aren't there a reliable way to ensure that a script runs at the end of the startup process?


bing different

Offline

#9 2014-12-24 02:08:06

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,535

Re: [SOLVED]How to run a script after xfce4 start?

I suggest you put only one script in the directory that will manage to execute the other files in a sorted manner. Unfortunately any update may vary the expected order, but you may take it in account and verify it.
The Xfsettingsd might be call by dbus or polkit or maybe the session manager is involved. We can see the changelog. There was a bug on version 4.6 . Maybe that has changed something.
You may grep files in your /home or /etc to see which program is calling it in. Try renaming the ~/.cache/sessions (to anything else), while not logged in to Xfce. Probably something still memorized in the cache.
Unfortunately I don't use xfce, at the moment.


do it good first, it will be faster than do it twice the saint wink

Offline

#10 2014-12-24 02:20:39

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

TheSaint,

thanks for suggestions. If I remember correctly, systemd has an option of automatically running a user script once after a specified amount of time after the system boot. I think I'll try to use that option. Xfsettingsd seems to be a runtime dependency for XFCE and certainly should not be turned off.


bing different

Offline

#11 2014-12-24 04:39:01

toz
Member
Registered: 2011-10-28
Posts: 507

Re: [SOLVED]How to run a script after xfce4 start?

How about a script like this one:

#!/bin/bash

until p=$(pidof xfsettingsd)
do
        sleep 1
done

sleep 1
setxkbmap ..... &

...and add it to your autostart? It will wait for xfsettingsd to start before executing the command.

Offline

#12 2014-12-24 16:29:45

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED]How to run a script after xfce4 start?

toz,

seems like a good solution. I'll try it. Thanks.


bing different

Offline

Board footer

Powered by FluxBB