CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Posted by EndlessDissent on Mon 6th Aug 21:58 (modification of post by view diff)
download | new post

  1. #!/bin/bash
  2. # cb-compton
  3. # Openbox Pipe Menu for use with compton compositor
  4. # Written for CrunchBang Linux <http://crunchbang.org/>
  5. # by Philip Newborough <corenominal@corenominal.org>
  6.  
  7.  
  8. # ------------- Set xcompmgr command options -----------------------------------
  9. if [ -f /home/$USER/.config/compton/comptonrc ]; then
  10.     . /home/$USER/.config/compton/comptonrc
  11. else
  12.     EXECXCOMP='compton -cC -fF -I 0.065 -O 0.065 -D 6 -m 0.8 -G -b'
  13. fi
  14.  
  15. # Edit xcompmgr settings
  16. if [ "$1" = "--edit" ]; then
  17.     if [ ! -d /home/$USER/.config/compton ]; then
  18.         mkdir /home/$USER/.config/compton
  19.     fi
  20.     if [ ! -f /home/$USER/.config/compton/comptonrc ]; then
  21.         touch /home/$USER/.config/compton/comptonrc
  22.         echo "# compton start-up command used by CrunchBang's compositing pipemenu." > /home/$USER/.config/compton/comptonrc
  23.         echo "# See 'man compton' for details about how to modify these settings." >> /home/$USER/.config/compton/comptonrc
  24.         echo "EXECXCOMP='compton -cC -fF -I 0.065 -O 0.065 -D 6 -m 0.8 -G -b'" >> /home/$USER/.config/compton/comptonrc
  25.     fi
  26.     if [ -x "/usr/bin/geany" ]; then
  27.         geany /home/$USER/.config/compton/comptonrc &
  28.     else
  29.         terminator --command="nano /home/$USER/.config/compton/comptonrc"
  30.     fi
  31.     exit 0
  32. fi
  33.  
  34. # Toggle compositing with compton. Called with "cb-compositor --toggle"
  35. if [ "$1" = "--toggle" ] || [ "$1" = "--start" ]; then
  36.     if [ ! "$(pidof compton)" ]; then
  37.       $EXECXCOMP &
  38.     else
  39.       killall compton
  40.     fi
  41.     exit 0
  42. fi
  43.  
  44. if [ "$1" = "--restart" ]; then
  45.     if [ "$(pidof compton)" ]; then
  46.         killall compton && sleep 2s
  47.         cb-compositor --start
  48.     fi
  49.     exit 0
  50. fi
  51. # Output Openbox menu
  52. if [ ! "$(pidof compton)" ]; then
  53.     cat << _EOF_
  54.     <openbox_pipe_menu>
  55.             <item label="Enable Compositing">
  56.             <action name="Execute">
  57.                                 <execute>
  58.                                         cb-compositor --start
  59.                                 </execute>
  60.                         </action>
  61.                 </item>
  62.                 <item label="Edit Compositing Settings">
  63.             <action name="Execute">
  64.                                 <execute>
  65.                                         cb-compositor --edit
  66.                                 </execute>
  67.                         </action>
  68.                 </item>
  69.     </openbox_pipe_menu>
  70. _EOF_
  71. else
  72.     cat << _EOF_
  73.     <openbox_pipe_menu>
  74.                                 <item label="Restart Compositing">
  75.                                         <action name="Execute">
  76.                                                 <execute>
  77.                                                         cb-compositor --restart
  78.                                                 </execute>
  79.                                         </action>
  80.                                 </item>
  81.                                 <item label="Disable Compositing">
  82.                                         <action name="Execute">
  83.                                                 <execute>
  84.                                                         cb-compositor --toggle
  85.                                                 </execute>
  86.                                         </action>
  87.                                 </item>
  88.     </openbox_pipe_menu>
  89. _EOF_
  90. fi
  91. exit 0

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me