ob_clipboard_pipe_menu.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env python2
  2. # OpenBox pipe menu clipboard manager. Show parcellite clipboard, and inserts selected clip.
  3. #
  4. # Copyright 2013 Joe Bloggs (vapniks@yahoo.com)
  5. #
  6. # These scripts: ob_clipboard_manager.py, ob_clipboard_pipe_menu.py & ob_paste_clip.py
  7. # create a pipe menu for openbox which will display the history of clippings stored by parcellite
  8. # or clipit, and allow you to paste one of them by selecting it.
  9. # Obviously either parcellite or clipit needs to be installed for this to work, and they should not
  10. # be run in daemon mode.
  11. # parcellite should be available from the usual repositories, and clipit can be
  12. # obtained from here: http://clipit.rspwn.com/
  13. # If clipit is used then any static clippings will also be displayed in the pipe menu.
  14. # You may need to alter some of the following variables in ob_clipboard_manager.py:
  15. # clipit_history_file, parcellite_history_file, max_displayed_items
  16. # Installation: copy ob_clipboard_manager.py, ob_clipboard_pipe_menu.py & ob_paste_clip.py to your openbox
  17. # config directory (on Ubuntu its ~/.config/openbox), then add an item to your openbox menu.xml file
  18. # (also in the config dir) in the form:
  19. #
  20. # <menu execute="~/.config/openbox/ob_clipboard_pipe_menu.py" id="clipboard" label="Clipboard"/>
  21. #
  22. # This program is free software: you can redistribute it and/or modify
  23. # it under the terms of the GNU General Public License as published by
  24. # the Free Software Foundation, either version 3 of the License, or
  25. # (at your option) any later version.
  26. #
  27. # This program is distributed in the hope that it will be useful,
  28. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. # GNU General Public License for more details.
  31. #
  32. # You should have received a copy of the GNU General Public License
  33. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  34. #
  35. from ob_clipboard_manager import ob_cb_manager
  36. from os.path import expanduser
  37. import subprocess
  38. if __name__ == '__main__':
  39. manager = ob_cb_manager()
  40. print '<?xml version="1.0" encoding="UTF-8"?>' # header
  41. print '<openbox_pipe_menu>' # main pipe menu element
  42. # print the menu items
  43. manager.print_menu_items()
  44. print '</openbox_pipe_menu>\n' # end pipe menu element