You are not logged in.

#1 2013-12-15 05:47:50

spiritech
Member
Registered: 2013-11-27
Posts: 63

[SOLVED] Openbox Script

Does anyone know which script runs last when running openboox. i would like to add a final piece of code to the end of the script. also is there a program that displays all the files that run when a program is run?

reason being that i am trying to run some scripts once openbox has finished loading i have tried the methods explained including adding lines to ~/.config/openbox/autostart. i have tried adding lines to usr/lib/openbox/openbox-autostart. i will keep trying. maybe it needs to go into the etc/xdg/openbox/autostart file for it to work?

also for trying to understand a little more, is usr/lib/openbox/openbox-autostart the part of the source code that tells etc/xdg/openbox/autostart to run on completion of openbox?

spiritech

Last edited by spiritech (2013-12-22 09:37:55)

Offline

#2 2013-12-15 06:53:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Openbox Script

Post the scripts you wanted to run.

Offline

#3 2013-12-15 07:30:57

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

karol wrote:

Post the scripts you wanted to run.

They are very simple bash scripts.

#!/bin/bash

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg"

and

#!/bin/bash

cairo-dock -o &
setxkbmap gb
pulseaudio --start

Offline

#4 2013-12-15 07:31:25

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED] Openbox Script

I don't use openbox, but /usr/lib/openbox/openbox-autostart sounds like the default location of the autostart file. Like a lot of other applications, you make a copy and place it in your home directory, where you don't need root access to run it.

Does placing your commands at the end of the openbox autostart not work?

Offline

#5 2013-12-15 07:34:19

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

cris9288 wrote:

I don't use openbox, but /usr/lib/openbox/openbox-autostart sounds like the default location of the autostart file. Like a lot of other applications, you make a copy and place it in your home directory, where you don't need root access to run it.

Does placing your commands at the end of the openbox autostart not work?

i place the path to the file i want to run at the end of the file.

/home/user/file.01
/home/user/file.02

Offline

#6 2013-12-15 07:36:46

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Openbox Script

If you execute them manually, do they work?

Offline

#7 2013-12-15 07:41:51

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] Openbox Script

spiritech wrote:
karol wrote:

Post the scripts you wanted to run.

They are very simple bash scripts.

#!/bin/bash

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg"

and

#!/bin/bash

cairo-dock -o &
setxkbmap gb
pulseaudio --start

Pulseaudio should start on it's own through xdg I believe (  /etc/xdg/autostart ), the rest of the commands you should be able to just put directly into your autostart file without needing to call on external scripts (the autostart file is bash / sh anyways (that is the interpreter called for it)).

.config/openbox/autostart

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg &
cairo-dock -o &
setxkbmap gb &

What exactly is going wrong when you put these commands in your sutostart file? They just don't start? Are you remembering to put "&" at the end of each line? If you must runa  script and it's not working try doing "bash /path/to/script &" may work

Last edited by dodo3773 (2013-12-15 07:43:58)

Offline

#8 2013-12-15 08:15:54

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

karol wrote:

If you execute them manually, do they work?

yes.

Offline

#9 2013-12-15 08:18:18

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

dodo3773 wrote:
spiritech wrote:
karol wrote:

Post the scripts you wanted to run.

They are very simple bash scripts.

#!/bin/bash

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg"

and

#!/bin/bash

cairo-dock -o &
setxkbmap gb
pulseaudio --start

Pulseaudio should start on it's own through xdg I believe (  /etc/xdg/autostart ), the rest of the commands you should be able to just put directly into your autostart file without needing to call on external scripts (the autostart file is bash / sh anyways (that is the interpreter called for it)).

.config/openbox/autostart

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg &
cairo-dock -o &
setxkbmap gb &

What exactly is going wrong when you put these commands in your sutostart file? They just don't start? Are you remembering to put "&" at the end of each line? If you must runa  script and it's not working try doing "bash /path/to/script &" may work

i will try the bash prefix as i would like to keep them as scripts so that i can modify them later on.


thank you.

Offline

#10 2013-12-15 09:05:16

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

dodo3773 wrote:

.config/openbox/autostart

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg &
cairo-dock -o &
setxkbmap gb &

What exactly is going wrong when you put these commands in your sutostart file? They just don't start? Are you remembering to put "&" at the end of each line? If you must runa  script and it's not working try doing "bash /path/to/script &" may work

i have added the lines

bash /path/to/script &
bash /path/to/another/script &

into the file  .config/openbox/autostart  sill nothing happens. i will try adding to etc/xdg/openbox/autostart.

Offline

#11 2013-12-15 09:33:26

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

i have now tried adding the command

feh --bg-scale "/media/sdb/Backgrounds/Neon/abstract-blue-smoke-light.jpg" &

manually to both ~/.config/openbox/autostart and /etc/xdg/openbox/autostart files and it still does not work.

Offline

#12 2013-12-15 10:15:13

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [SOLVED] Openbox Script

For feh to set the background, I have the executable file ~/.config/openbox/autostart, which contains the line:

sh ~/.config/feh/themes/fehbg &

~/.config/feh/themes/fehbg is not set executable so I need the 'sh', above. This file is a single line:

feh  --bg-center '/home/casey/pictures/walker-evans_church-interior.jpg'

Offline

#13 2013-12-15 10:30:13

sonoran
Member
From: sonoran desert
Registered: 2009-01-12
Posts: 192

Re: [SOLVED] Openbox Script

How are you launching openbox?

When you run the openbox command on its own, the autostart scripts will not run. They are run by openbox-session or when you log in graphically with the "Openbox" session type.

http://openbox.org/wiki/Help:Autostart

Offline

#14 2013-12-15 10:33:08

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Openbox Script

you probably messed up your openbox default setup completely by now.
all the autostart files in your system should be left untouched, except for the one in $HOME/.config/openbox.
and there's no need for a "default" autostart file. it's a simple shell script where you put what you want executed after login, like setting the background, starting a panel...

that said, if you have openbox as part of a desktop environment like lxde, things are a bit different.

please check http://openbox.org/wiki/Help:Autostart

Offline

#15 2013-12-15 11:25:05

sonoran
Member
From: sonoran desert
Registered: 2009-01-12
Posts: 192

Re: [SOLVED] Openbox Script

ondoho wrote:

all the autostart files in your system should be left untouched, except for the one in $HOME/.config/openbox.

My understanding is that if you want to make per-user configurations you do it in  ~/.config/openbox/autostart. To configure openbox in some way for all users you would do it in /etc/xdg/openbox/autostart, which is run before the autostart in the user's $HOME.

The docs contradict each other on several points. The man page says the openbox command runs openbox-session, while the openbox wiki says "openbox" alone will not run the autostart script.

The man page says if there is a ~/.config/openbox/autostart then that will be used instead of /etc/xdg/openbox autostart, but the wiki says the /etc... autostart is run first, then ~/.config...

EDIT: The openbox wiki is correct, the manual page for openbox is wrong.

If "exec openbox" is run from .xinitrc no autostart file is run either from ~/.config/openbox or /etc/xdg.
Using "exec openbox-session" in .xinitrc runs autostart files in both locations.

Last edited by sonoran (2013-12-15 14:41:33)

Offline

#16 2013-12-15 23:07:11

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Openbox Script

i wrote "should", not "must".

agreed, on a multi-user setup it's abit different. somehow i don't think that that is op's situation.

sonoran wrote:

If "exec openbox" is run from .xinitrc no autostart file is run either from ~/.config/openbox or /etc/xdg.
Using "exec openbox-session" in .xinitrc runs autostart files in both locations.

this is an interesting detail. thanks.

but i think it's up to op now.

Offline

#17 2013-12-16 09:56:21

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

here are all the autostart files associated with openbox


usr/lib/openbox/openbox-autostart
usr/lib/openbox/openbox-xdg-autostart

etc/xdg/openbox/autostart

~/.config/openbox/autostart

i assume the two usr/lib files are something to do with the actual openbox prgram. the etc/xdg file is the main global file for autostart, and the ~/.config file is the user file.

sonoran wrote:

If "exec openbox" is run from .xinitrc no autostart file is run either from ~/.config/openbox or /etc/xdg.
Using "exec openbox-session" in .xinitrc runs autostart files in both locations.

if this is the case for the .xinitrc file then there lies my problem. i start openbox with exec openbox-session from the .xinitrc file. and seeing as some of the scripts i want to run are window dependent i cannot use any of the .xinitrc options to run those scripts as .xinitrc runs before openbox/window managers.

so my question is this how can i run a bash script when openbox has finished loaded?

Offline

#18 2013-12-16 10:19:15

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: [SOLVED] Openbox Script

Any "customisations" to the openbox scripts in /etc/xdg and /usr/lib will be overwritten on update of the packages and are there as a set of (working until messed with) sane defaults. Startup scripts should be called (or one-liners written to) ~/.config/openbox

Writing standalone one-liners for autostart is pretty redundant IMHO and would be better left in ~/.config/openbox/autostart

/etc/xdg/openbox/autostart sets up the environment to fire the /etc or $HOME autostart scripts - so if you have mangled those in anyway (permissions? killed -x bit?)you can hardly be surprised they are not working... retain any snippets of code that may be useful and reinstalling a clean openbox with the default scripts inplace may be your best solution and will only take 10 minutes...

Offline

#19 2013-12-16 13:08:40

sonoran
Member
From: sonoran desert
Registered: 2009-01-12
Posts: 192

Re: [SOLVED] Openbox Script

spiritech wrote:

i assume the two usr/lib files are something to do with the actual openbox prgram. the etc/xdg file is the main global file for autostart, and the ~/.config file is the user file.

Right. The two scripts in /usr/lib/openbox actually look for the other configuration scripts so you shouldn't change them. Configuration should be done in ~/.config/openbox/autostart for a single user or /etc/xdg/openbox/autostart for all users. Pacman will put a .pacnew file there if you have made changes - it shouldn't overwrite a config file on an update.


so my question is this how can i run a bash script when openbox has finished loaded?

Check this section of the Arch Wiki: https://wiki.archlinux.org/index.php/Op … g_commands
I don't need any sleep delays in my autostart commands, one of which is feh --bg-tile, but your programs might.

Once you get everything working you can play with running the commands as bash scripts, if you insist. wink

Offline

#20 2013-12-16 19:04:42

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Openbox Script

ok, i think the "don't mess around" part is covered good.

spiritech wrote:

if this is the case for the .xinitrc file then there lies my problem. i start openbox with exec openbox-session from the .xinitrc file. and seeing as some of the scripts i want to run are window dependent i cannot use any of the .xinitrc options to run those scripts as .xinitrc runs before openbox/window managers.

NO. i also have "exec openbox-session" in there. and it parses ~/.config/openbox/autostart.
so for gods sake, after you have cleaned your system, put your scripts in autostart.

BUT
i'll just point out again what i've written before:
if you installed openbox as part of a desktop environment like lxde, things are a bit different.
i know this for a fact, i just don't know how exactly different.

Last edited by ondoho (2013-12-16 19:06:45)

Offline

#21 2013-12-17 09:33:36

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: [SOLVED] Openbox Script

ondoho wrote:

f you installed openbox as part of a desktop environment like lxde, things are a bit different.
i know this for a fact, i just don't know how exactly different.

LXDE [and possibly other DE when utilising openbox as WM] create their own "profile" and read their own config files eg ~/.config/openbox/lxde-rc.xml instead of a vanilla ~/.config/openbox/rc.xml. It is all covered in the wiki quite comprehensively. Likewise when combined with a session manager (LXDM, LightDM etc) other startup options, locations and scripts come available - again covered in the wiki.

Offline

#22 2013-12-22 09:36:31

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

changing exec openbox to exec openbox-session in ~/.xinitrc and installing pyxdg solved the problem.

thank you all for your help.

Last edited by spiritech (2013-12-25 06:56:46)

Offline

#23 2013-12-22 09:50:01

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Openbox Script

Ehmm... glad you got it working, but that's definitely not what did it. ~/.config/openbox/autostart runs after openbox starts, so putting exec openbox-session in there makes no sense at all.

Offline

#24 2013-12-25 06:59:42

spiritech
Member
Registered: 2013-11-27
Posts: 63

Re: [SOLVED] Openbox Script

tomk wrote:

Ehmm... glad you got it working, but that's definitely not what did it. ~/.config/openbox/autostart runs after openbox starts, so putting exec openbox-session in there makes no sense at all.

yes your right no sense at all. exec openbox-session in ~/.xinitrc not ~/.config/openbox/autostart.

post corrected ty.

i now have my script "~/path/to/script" in "~/.config/openbox/autostart"

[random chat]the actuall script contains

#!/bin/bash

~/spiritech-desktop/set-key-map.sh
~/spiritech-desktop/audio.sh
~/spiritech-desktop/background-changer.sh
~/spiritech-desktop/cairo-dock.sh
~/spiritech-desktop/x-composite-manager.sh
~/spiritech-desktop/printer.sh

the reason i have the script in my home folder is that i find it easier to access than having the commands, or paths to scripts in the ~/.config/openbox/autostart.[/random chat]

Last edited by spiritech (2013-12-25 07:09:15)

Offline

Board footer

Powered by FluxBB