Advertisement
Guest User

Obmenu desktop pipe

a guest
Mar 6th, 2016
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. IFS=$(echo -en "\n\b")
  4. DESKTOP=$(xdg-user-dir DESKTOP)
  5.  
  6. echo "    <openbox_pipe_menu>"
  7.  
  8. for FILENAME in `find $DESKTOP -type f -name *.desktop`
  9. do
  10.     NAME=$(grep '^Name' $FILENAME | head -1 | sed 's/^Name=//' | sed 's/%.//')
  11.     EXEC=$(grep '^Exec' $FILENAME | head -1 | sed 's/^Exec=//' | sed 's/%.//')
  12.     ICON=$(grep '^Icon' $FILENAME | head -1 | sed 's/^Icon=//' | sed 's/%.//')
  13.  
  14.     # if [ ! -f $ICON ]; then
  15.     #     ICON=$(locate $ICON | tail -1)
  16.     # fi
  17.  
  18.     cat << _menu_
  19.       <item icon="$ICON" label="$NAME">
  20.         <action name="Execute">
  21.           <command>
  22.             $EXEC
  23.           </command>
  24.         </action>
  25.       </item>
  26. _menu_
  27. done
  28.  
  29. echo "    </openbox_pipe_menu>"
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement