Openbox Pipe Menu for xcompmgr
I have been playing around with and writing a Bash script pipe menu for xcompmgr under Openbox. The script has dual functionality; firstly, it acts as on/off toggle for xcompmgr; secondly, it produces a conditional menu depending on whether or not xcompmgr is running — if xcompmgr is not running, an "Enable Compositing" menu item will appear; if xcompmgr is running, a "Disable Compositing" menu item will be offered along with a list of "Set Target Window Transparency to XX%" items.
It is a simple Bash script, but quite effective. Please feel free to modify/improve as you see fit.
#!/bin/bash
# Openbox Pipe Menu for xcompmgr
################################
# Set xcompmgr command options
EXEC='xcompmgr -c -t-5 -l-5 -r4.2 -o.55' #basic compositing
#EXEC='xcompmgr -cCfF -t-5 -l-5 -r4.2 -o.55 -D6' #more effects
# Toggle compositing. Call with "myxcompmgr --startstop"
if [ "$1" = "--startstop" ]; then
if [ ! "$(pidof xcompmgr)" ]; then
$EXEC
else
killall xcompmgr
fi
exit 0
fi
# Output Openbox menu
if [ ! "$(pidof xcompmgr)" ]; then
cat << _EOF_
<openbox_pipe_menu>
<item label="Enable Compositing">
<action name="Execute">
<execute>myxcompmgr --startstop</execute>
</action>
</item>
</openbox_pipe_menu>
_EOF_
else
cat << _EOF_
<openbox_pipe_menu>
<item label="Remove Transparency from Target Window">
<action name="Execute">
<execute>transset 1</execute>
</action>
</item>
<item label="Set Target Window Transparency to 10%">
<action name="Execute">
<execute>transset .90</execute>
</action>
</item>
<item label="Set Target Window Transparency to 20%">
<action name="Execute">
<execute>transset .80</execute>
</action>
</item>
<item label="Set Target Window Transparency to 30%">
<action name="Execute">
<execute>transset .70</execute>
</action>
</item>
<item label="Set Target Window Transparency to 40%">
<action name="Execute">
<execute>transset .60</execute>
</action>
</item>
<item label="Set Target Window Transparency to 50%">
<action name="Execute">
<execute>transset .50</execute>
</action>
</item>
<item label="Set Target Window Transparency to 60%">
<action name="Execute">
<execute>transset .40</execute>
</action>
</item>
<item label="Set Target Window Transparency to 70%">
<action name="Execute">
<execute>transset .30</execute>
</action>
</item>
<item label="Set Target Window Transparency to 80%">
<action name="Execute">
<execute>transset .20</execute>
</action>
</item>
<item label="Set Target Window Transparency to 90%">
<action name="Execute">
<execute>transset .10</execute>
</action>
</item>
<separator/>
<item label="Disable Compositing">
<action name="Execute">
<execute>myxcompmgr --startstop</execute>
</action>
</item>
</openbox_pipe_menu>
_EOF_
fi
exit 0
How to use the script
Follow the instructions below to install the script and set-up the Openbox pipe menu:
1. Open a terminal and download the script with the following command:
wget http://crunchbang.org/misc/myxcompmgr
2. Move the script to your "bin" directory and make executable:
mv myxcompmgr ~/bin/myxcompmgr && chmod +x ~/bin/myxcompmgr
3. Open your Openbox menu.xml file for editing:
gedit ~/.config/openbox/menu.xml
4. Insert the following code where you would like the menu to appear, save and exit:
<menu execute="myxcompmgr" id="CompositingPipeMenu" label="Compositing"/>
5. Issue the following command to update/reconfigure Openbox:
openbox --reconfigure
Optional: You could also place the following entry in ~/.config/openbox/autostart.sh to start xcompmgr on boot:
# Enable Eyecandy, see ~/bin/myxcompmgr for more info
myxcompmgr --startstop &
