Openbox - multiple commands separated with & for one keypress
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am trying to configure Openbox's rc.xml file in order to manipulate my soundcards with one keypress. Because I have multiple sound cards on my system I have to manipulate multiple sinks at once so I use multiple commands separated with & like this:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% & pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% & pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
For some reason this won't work in rc.xml. Can anyone help me?
openbox rc
add a comment |Â
up vote
0
down vote
favorite
I am trying to configure Openbox's rc.xml file in order to manipulate my soundcards with one keypress. Because I have multiple sound cards on my system I have to manipulate multiple sinks at once so I use multiple commands separated with & like this:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% & pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% & pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
For some reason this won't work in rc.xml. Can anyone help me?
openbox rc
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to configure Openbox's rc.xml file in order to manipulate my soundcards with one keypress. Because I have multiple sound cards on my system I have to manipulate multiple sinks at once so I use multiple commands separated with & like this:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% & pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% & pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
For some reason this won't work in rc.xml. Can anyone help me?
openbox rc
I am trying to configure Openbox's rc.xml file in order to manipulate my soundcards with one keypress. Because I have multiple sound cards on my system I have to manipulate multiple sinks at once so I use multiple commands separated with & like this:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% & pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% & pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
For some reason this won't work in rc.xml. Can anyone help me?
openbox rc
openbox rc
asked Sep 3 '16 at 8:50
71GA
43311024
43311024
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
You need to put the commands into a shell script, make that script executable and then uses this script as the command.
<command>/usr/local/bin/volume_up</command>
The contents of /usr/local/bin/volume_up
#!/bin/sh
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% &
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% &
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%
and make it executable
chmod +x /usr/local/bin/volume_up
The reason is that Openbox is not executing the contents of the command element in a shell instead it tries to execute it directly.
From the documentation for <command>
:
A string which is the command to be executed, along with any arguments
to be passed to it. The "~" tilde character will be expanded to your
home directory, but no other shell expansions or scripting syntax may
be used in the command unless they are passed to the sh command. Also,
the & character must be written as & in order to be parsed
correctly. is a deprecated name for .
Another benefit is that you can rewrite the script to also be able lower the volume
#!/bin/sh
change_volume()
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output "$1"
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo "$1"
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 "$1"
main()
case "$1" in
up)
change_volume +5%
;;
down)
change_volume -5%
;;
*)
printf "volume <command>n"
printf " up n"
printf " downn"
esac
main "$@"
This would be saved under /usr/local/bin/volume
and would be use like this
<command>/usr/local/bin/volume up</command>
<command>/usr/local/bin/volume down</command>
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for<command>
and the quote. It mentioned that you can callsh -c
to do such a thing.
â Raphael Ahrens
Sep 21 '16 at 14:48
add a comment |Â
up vote
0
down vote
If you do not mind the order and the fact that all of these will be executed more or less at once you can do:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
New contributor
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You need to put the commands into a shell script, make that script executable and then uses this script as the command.
<command>/usr/local/bin/volume_up</command>
The contents of /usr/local/bin/volume_up
#!/bin/sh
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% &
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% &
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%
and make it executable
chmod +x /usr/local/bin/volume_up
The reason is that Openbox is not executing the contents of the command element in a shell instead it tries to execute it directly.
From the documentation for <command>
:
A string which is the command to be executed, along with any arguments
to be passed to it. The "~" tilde character will be expanded to your
home directory, but no other shell expansions or scripting syntax may
be used in the command unless they are passed to the sh command. Also,
the & character must be written as & in order to be parsed
correctly. is a deprecated name for .
Another benefit is that you can rewrite the script to also be able lower the volume
#!/bin/sh
change_volume()
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output "$1"
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo "$1"
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 "$1"
main()
case "$1" in
up)
change_volume +5%
;;
down)
change_volume -5%
;;
*)
printf "volume <command>n"
printf " up n"
printf " downn"
esac
main "$@"
This would be saved under /usr/local/bin/volume
and would be use like this
<command>/usr/local/bin/volume up</command>
<command>/usr/local/bin/volume down</command>
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for<command>
and the quote. It mentioned that you can callsh -c
to do such a thing.
â Raphael Ahrens
Sep 21 '16 at 14:48
add a comment |Â
up vote
2
down vote
You need to put the commands into a shell script, make that script executable and then uses this script as the command.
<command>/usr/local/bin/volume_up</command>
The contents of /usr/local/bin/volume_up
#!/bin/sh
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% &
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% &
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%
and make it executable
chmod +x /usr/local/bin/volume_up
The reason is that Openbox is not executing the contents of the command element in a shell instead it tries to execute it directly.
From the documentation for <command>
:
A string which is the command to be executed, along with any arguments
to be passed to it. The "~" tilde character will be expanded to your
home directory, but no other shell expansions or scripting syntax may
be used in the command unless they are passed to the sh command. Also,
the & character must be written as & in order to be parsed
correctly. is a deprecated name for .
Another benefit is that you can rewrite the script to also be able lower the volume
#!/bin/sh
change_volume()
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output "$1"
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo "$1"
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 "$1"
main()
case "$1" in
up)
change_volume +5%
;;
down)
change_volume -5%
;;
*)
printf "volume <command>n"
printf " up n"
printf " downn"
esac
main "$@"
This would be saved under /usr/local/bin/volume
and would be use like this
<command>/usr/local/bin/volume up</command>
<command>/usr/local/bin/volume down</command>
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for<command>
and the quote. It mentioned that you can callsh -c
to do such a thing.
â Raphael Ahrens
Sep 21 '16 at 14:48
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You need to put the commands into a shell script, make that script executable and then uses this script as the command.
<command>/usr/local/bin/volume_up</command>
The contents of /usr/local/bin/volume_up
#!/bin/sh
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% &
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% &
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%
and make it executable
chmod +x /usr/local/bin/volume_up
The reason is that Openbox is not executing the contents of the command element in a shell instead it tries to execute it directly.
From the documentation for <command>
:
A string which is the command to be executed, along with any arguments
to be passed to it. The "~" tilde character will be expanded to your
home directory, but no other shell expansions or scripting syntax may
be used in the command unless they are passed to the sh command. Also,
the & character must be written as & in order to be parsed
correctly. is a deprecated name for .
Another benefit is that you can rewrite the script to also be able lower the volume
#!/bin/sh
change_volume()
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output "$1"
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo "$1"
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 "$1"
main()
case "$1" in
up)
change_volume +5%
;;
down)
change_volume -5%
;;
*)
printf "volume <command>n"
printf " up n"
printf " downn"
esac
main "$@"
This would be saved under /usr/local/bin/volume
and would be use like this
<command>/usr/local/bin/volume up</command>
<command>/usr/local/bin/volume down</command>
You need to put the commands into a shell script, make that script executable and then uses this script as the command.
<command>/usr/local/bin/volume_up</command>
The contents of /usr/local/bin/volume_up
#!/bin/sh
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5% &
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5% &
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%
and make it executable
chmod +x /usr/local/bin/volume_up
The reason is that Openbox is not executing the contents of the command element in a shell instead it tries to execute it directly.
From the documentation for <command>
:
A string which is the command to be executed, along with any arguments
to be passed to it. The "~" tilde character will be expanded to your
home directory, but no other shell expansions or scripting syntax may
be used in the command unless they are passed to the sh command. Also,
the & character must be written as & in order to be parsed
correctly. is a deprecated name for .
Another benefit is that you can rewrite the script to also be able lower the volume
#!/bin/sh
change_volume()
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output "$1"
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo "$1"
pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 "$1"
main()
case "$1" in
up)
change_volume +5%
;;
down)
change_volume -5%
;;
*)
printf "volume <command>n"
printf " up n"
printf " downn"
esac
main "$@"
This would be saved under /usr/local/bin/volume
and would be use like this
<command>/usr/local/bin/volume up</command>
<command>/usr/local/bin/volume down</command>
edited Sep 21 '16 at 14:45
answered Sep 20 '16 at 9:42
Raphael Ahrens
6,74252845
6,74252845
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for<command>
and the quote. It mentioned that you can callsh -c
to do such a thing.
â Raphael Ahrens
Sep 21 '16 at 14:48
add a comment |Â
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for<command>
and the quote. It mentioned that you can callsh -c
to do such a thing.
â Raphael Ahrens
Sep 21 '16 at 14:48
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
This is a possible fix, but not exactly what I need.
â 71GA
Sep 21 '16 at 14:10
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA What is it that you need?
â Raphael Ahrens
Sep 21 '16 at 14:41
@71GA I added the link to the documentation for
<command>
and the quote. It mentioned that you can call sh -c
to do such a thing.â Raphael Ahrens
Sep 21 '16 at 14:48
@71GA I added the link to the documentation for
<command>
and the quote. It mentioned that you can call sh -c
to do such a thing.â Raphael Ahrens
Sep 21 '16 at 14:48
add a comment |Â
up vote
0
down vote
If you do not mind the order and the fact that all of these will be executed more or less at once you can do:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
New contributor
add a comment |Â
up vote
0
down vote
If you do not mind the order and the fact that all of these will be executed more or less at once you can do:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
New contributor
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If you do not mind the order and the fact that all of these will be executed more or less at once you can do:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
New contributor
If you do not mind the order and the fact that all of these will be executed more or less at once you can do:
<keybind key="XF86AudioRaiseVolumen">
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.multichannel-output +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%</command>
</action>
<action name="Execute">
<command>pactl set-sink-volume alsa_output.usb-Focusrite_Scarlett_2i4_USB-00.analog-surround-40 +5%</command>
</action>
</keybind>
New contributor
New contributor
answered 1 min ago
Michal Ambroz
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f307611%2fopenbox-multiple-commands-separated-with-for-one-keypress%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password