Xfce Forum

Sub domains
 

You are not logged in.

#1 2010-10-31 00:35:56

Eschatokyrios
Member
Registered: 2010-10-30
Posts: 1

how do I run an arbitrary shell script on startup?

I've been pouring over the documentation, and I can't seem to find an answer to this question (I'm running xfce 4.6.2)

What I ultimately want to do is run xmodmap on my custom rules every time xfce starts. I understand that there's some bugginess with xfce and xmodmap, which makes putting a simple xmodmap ~/.Xmodmap line in .xinitrc problematic. I can throw together a short shell script like #!/bin/sh xmodmap ~/.Xmodmap or #!/bin/sh sleep 10; xmodmap ~/.Xmodmap or whatever ends up being necessary to force xmodmap to run after whatever xfce does with the keyboard, but I can't figure out how to make that script itself execute on  startup. Putting an entry to run a script in the Application Autostart screen doesn't do anything, and I've tried it with other shell scripts that I know work without any success either. In fact I'm not really sure *why* the application autostart screen works for certain little utility programs but won't load my bash scripts.

Offline

#2 2010-11-03 00:20:56

Brinson
Member
Registered: 2009-10-19
Posts: 4

Re: how do I run an arbitrary shell script on startup?

Create a .desktop file in ~/.config/autostart

Folder might not exist by default. If not, create it.

The file can be named any as long as the extension is .desktop.

It should look like this:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Script
Type=Application
Exec=/usr/local/share/script.sh
Icon=
Terminal=false
StartupNotify=false
Hidden=false
GenericName=
GenericName[en_US]=

Where I bolded is the path to your script.

Offline

#3 2010-11-11 12:16:01

jeromeg
Member
From: France
Registered: 2010-11-11
Posts: 131
Website

Re: how do I run an arbitrary shell script on startup?

Hello,

Just a few notes:
- the encoding line is deprecated, just remove it
- lines with nothing after the "=" can be removed, like "Icon=", "GenericName=" and "GenericName="

Cheers,

Jérôme

Offline

#4 2010-11-19 15:23:06

etnlWings
Member
Registered: 2007-10-30
Posts: 218

Re: how do I run an arbitrary shell script on startup?

Should also mention that you can auto-generate the autostart file by going into Settings>Session and Startup>Application Autostart and clicking, "Add".

Offline

#5 2024-05-15 16:00:24

Oberlin
Member
Registered: 2024-05-15
Posts: 1

Re: how do I run an arbitrary shell script on startup?

Brinson wrote:

Create a .desktop file in ~/.config/autostart

Do I really need to bother with desktop files for simple things like "unclutter &" or personal scripts? In icewm there is a script called "startup" where you can put any startup command you wish, which is useful since .xinitrc does not seem to be loaded as long as I currently still use lightdm along with xfce.

Last edited by Oberlin (2024-05-15 16:01:54)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 532.03 KiB (Peak: 532.66 KiB) ]