You are not logged in.

#1 2026-09-15 22:43:08

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

[Solved] OpenBox menus

[Solved] -> using a bash script.

It is possible to have and OpenBox "action" open two applications?

Example idea #1:

<item label="One - Two">
	<action name="Execute">
		<execute>one</execute>
		<execute>two</execute>
	</action>
</item>

OR maybe example idea #1:

<item label="One - Two">
	<action name="Execute">
		<execute>one</execute>
	</action>
	<action name="Execute">
		<execute>two</execute>
	</action>
</item>

Asking before, read: in case, I really mess up my menu.
Cannot seen to find anything on the net so I'm leaning to
NOT POSSIBLE!

I'm interested in opening a spreadsheet and a PDF file with one click.

Last edited by Sector11 (2026-09-16 02:36:05)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#2 2026-09-15 23:32:33

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 3,045

Re: [Solved] OpenBox menus

Are you looking to open a blank spreadsheet and a separate pdf file, or do you want to open the pdf file with the spreadsheet application?

Libreoffice for the spreadsheet ?

Which app for the pdf?


You must unlearn what you have learned.
    -- yoda

Offline

#3 2026-09-15 23:42:43

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 3,045

Re: [Solved] OpenBox menus

Try this. I use xreader for pdf, adjust for your system.

<keybind key="W-space">
  <action name="Execute">
    <startupnotify>
      <enabled>yes</enabled>
      <name>Some_Name</name>
      <icon>Some_Icon</icon>
    </startupnotify>
    <command>xreader some.pdf & libreoffice --calc</command>
  </action>

Another option would be to write a bash script to open the pdf and spreadsheet and launch the script from the menu.


You must unlearn what you have learned.
    -- yoda

Offline

#4 2026-09-16 01:14:06

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

PackRat wrote:

Try this. I use xreader for pdf, adjust for your system.

<keybind key="W-space">
  <action name="Execute">
    <startupnotify>
      <enabled>yes</enabled>
      <name>Some_Name</name>
      <icon>Some_Icon</icon>
    </startupnotify>
    <command>xreader some.pdf & libreoffice --calc</command>
  </action>

Another option would be to write a bash script to open the pdf and spreadsheet and launch the script from the menu.

OH!  Never thought of the rc.xml file.

localc /path/to/calc.ods & atril /path/to/the.pdf

Nope my rc.xml did not like the " & "

And I'm locked out of OB.  sad
No right click no shortcut keys.

Time to reboot and X fingers


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#5 2026-09-16 01:56:54

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

Time to reboot and X fingers

OK [Ctrl]+[z] brought the rc.xml file bact to it's original state and shutting down everything and powering off / on brought OB back to life.

@PackRat - Yours:

<keybind key="W-space">
  <action name="Execute">
    <startupnotify>
      <enabled>yes</enabled>
      <name>Some_Name</name>
      <icon>Some_Icon</icon>
    </startupnotify>
    <command>xreader some.pdf & libreoffice --calc</command>
  </action>

My keyboard section looks like this:

    <keybind key="A-1">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>AYSA</name>
        </startupnotify>
        <command>localc /media/5/Documents/Aysa/aysa.2026.ods & thunar /media/5/Documents/Aysa/2026.PDF/</command>
      </action>
    </keybind>

Opens a window: Openbox Syntax Error

One or more XML syntax errors were found
while parsing the Openbox configuration
files. See stdout for more information.
The last error was in file "home/
sector11/,config/openbox/rc.xml" line 443,
with message: xmlParseEntityRef: no name

The " & " has a red background!

localc - opens a yearlly spreadsheet
thinar opens the foolder where the monthly AYSA bills are kept


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2026-09-16 02:07:49

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 3,045

Re: [Solved] OpenBox menus

My bad. Gave you a key binding not a menu entry.

	<item label="Some name">
		<action name="Execute">
			<command>xreader pdf-file.pdf & libreoffice --calc</command>
		</action>
	</item>

If the openbox xml syntax doesn't like the "&", then create a bash script and launch the script from the menu.

Over simplified, but should work. Save to somewhere on your $PATH and make it executable.

#!/bin/sh

localc /path/to/calc.ods &

sleep 2s ; atril /path/to/the.pdf &

what's "localc"? Bash alias?
Those don't always work, use the actual command.


You must unlearn what you have learned.
    -- yoda

Offline

#7 2026-09-16 02:34:40

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

PackRat wrote:

My bad. Gave you a key binding not a menu entry.

	<item label="Some name">
		<action name="Execute">
			<command>xreader pdf-file.pdf & libreoffice --calc</command>
		</action>
	</item>

If the openbox xml syntax doesn't like the "&", then create a bash script and launch the script from the menu.

Over simplified, but should work. Save to somewhere on your $PATH and make it executable.

#!/bin/sh

sleep 2s ; atril /path/to/the.pdf &

what's "localc"? Bash alias?
Those don't always work, use the actual command.

Yes, I realized it was a keybind, I use them a lot.
I was talking about the " & " not working in the rc.xml keyboard section - better for me than in menu.xml
HOWEVER my OpenBox decided elsewise.

/home/sector11/.config/openbox/rc.xml

    <!-- Keybindings for running applications -->
    <!-- <keybind key="A-1">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>Aysa</name>
        </startupnotify>
        <command>localc /media/5/Documents/Aysa/aysa.2026.ods thunar /media/5/Documents/Aysa/2026.PDF/</command>
      </action>
    </keybind> -->
    <keybind key="A-d">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Discord</name>
        </startupnotify>
        <command>firefox https://discord.com/channels/@me /media/5/Documents/Discord-markdown-text-101.txt</command>
      </action>
    </keybind>

localc is NOT a bash alias ... but a short form of "libreoffice --calc" its in the man page:

Name
libreoffice − LibreOffice office suite
SYNOPSIS
libreoffice [−−accept=accept−string] [−−base] [−−calc] [−−convert−to output_file_extension[:output_fil-
ter_name] [−−outdir output_dir] file]... [−−display display] [−−draw] [−−global] [−−headless]
[−−help|−h|−?] [−−impress] [−−invisible] [−−infilter="<filter>"] [−−math] [−−minimized] [−n file]...
[−−nodefault] [−−nolockcheck] [−−nologo] [−−norestore] [−o file]... [−p file...] [−−print−to−file
[−−printer−name printer_name] [−−outdir output_dir] file]... [−−pt printername file...] [−−show Im-
press file]... [−−unaccept=accept−string] [−−terminate_after_init] [−−view file]... [−−web] [−−writer]
[file...]
lobase
localc
lodraw
lofromtemplate
loimpress
lomath
loweb
lowriter

DESCRIPTION
LibreOffice (LO for short) is a multi-platform office productivity suite. It was derived from OpenOffice.org
3.3 Beta on September 28, 2010.

They all just work:

lobase
localc
lodraw
lofromtemplate
loimpress
lomath
loweb
lowriter


Bash script it is.
Thanks


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#8 2026-09-16 06:26:50

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 13,459
Website

Re: [Solved] OpenBox menus

It comes down to openbox menu entry commands not allowing shell stuff like "&" or much else. What is allowed is a one-word command and some optional arguments. That's all. So yes a bash script is probably the best way to go. This applies to a lot of other situations like yad buttons, not only openbox menus.

Another trickier option which also works if the shell stuff you want to run isn't too complicated is to make "bash" the command and "-c" "shell stuff" the two arguments. Try this in a terminal:

bash -c 'echo "press Enter to continue"; read; echo "Bye..."; sleep 2'

Everything inside the single quotes is considered to be a single argument and passed on to bash.

But it's usually easier to make a separate script.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky and Mastodon, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#9 2026-09-16 13:02:03

hhh
Hercule Poirot
From: Belgium
Registered: 2015-09-17
Posts: 17,479
Website

Re: [Solved] OpenBox menus

The script to open 2 programs with one keybind is the easiest script you could make though, right? In bin (on BL) or .local/bin (on Debian and BL)...

#!/usr/bin/env bash

evince
libreoffice-calc

Name it something ('name)', make it excecutable and add a keybind to 'name' in your config.

Scripting n00b here, I just did this for a bind I needed on my niri setup, this is a nice opportunity to check that I did it right. It works and I don't see errors running it from a terminal, I think I did it right. A script for a delayed screenshot with grim, first switching to the directory I want the scrot to be saved in and also specifying which display to capture, I bound it to the PrtSc key...

#!/usr/bin/env bash

cd Pictures/Screenshots
sleep 6
grim -o eDP-1 scrot.png

Why why why why?!!???

Offline

#10 2026-09-16 13:43:31

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

I went the simple way of zen:

OB Menu

		<item label="Aysa-W">
			<action name="Execute">
				<execute>bash aysa</execute>
			</action>
		</item>

aysa

#!/bin/sh
## AYSA water

localc /media/5/Documents/Aysa/aysa.2026.ods &
## sleep 2s ;
thunar /media/5/Documents/Aysa/2026.PDF/ &

spreadsheet is yearly and the pdf is monthly so I just need thunar to take me to the folder.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#11 2026-09-16 13:54:41

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

@hhh - yup went the way of bash file and zen simple

johnraff wrote:

{snip}

Everything inside the single quotes is considered to be a single argument and passed on to bash.

But it's usually easier to make a separate script.

bash -c 'localc /media/5/Documents/Aysa/aysa.2026.ods & thunar /media/5/Documents/Aysa/2026.PDF/ &'

That works as well, and would probably work in the rc.xml file

TESTED:  NOPE!!!   It still does not like the & even though it's in the " bash -c 'comand' "


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#12 Yesterday 04:24:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 13,459
Website

Re: [Solved] OpenBox menus

Sorry, I forgot that openbox xml files don't like unescaped ampersands, even if they're inside single quotes.
Replace those two '&' with '&amp;' and it works in rc.xml (just tested).


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky and Mastodon, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#13 Yesterday 04:40:59

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,384

Re: [Solved] OpenBox menus

I knew that &amp thing, I forgot I knew that, but I did know it.
See it all the time in scripts and such.

Thanks for the reminder John ... totally forgot that.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB