menu 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh -e
  2. #
  3. # menu: display the menu text
  4. #
  5. # Copyright (C) 2008 Canonical Ltd.
  6. # Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
  7. #
  8. # Authors: Dustin Kirkland <kirkland@byobu.org>
  9. #
  10. # This program is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation, version 3 of the License.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. __menu_detail() {
  22. return
  23. }
  24. __menu() {
  25. local bindings esc key text
  26. [ -r "$BYOBU_CONFIG_DIR/keybindings" ] && bindings="$BYOBU_CONFIG_DIR/keybindings" || bindings="$BYOBU_CONFIG_DIR/.screenrc"
  27. if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || grep -qs "^source.*f-keys.screen.disable$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then
  28. # Get the second to last byte from the "escape" option
  29. esc=`grep "^escape" $bindings | tail -c 3 | head -c 1`
  30. [ -n "$esc" ] && key="^$esc-@" || key="^a-@"
  31. elif grep -qs "^source.*none$" $bindings 2>/dev/null; then
  32. key="byobu-config"
  33. else
  34. key="F9"
  35. fi
  36. text=$(gettext "Menu" 2>/dev/null) || text="Menu"
  37. color k w; printf "%s:<" "$text"; color -; color b k w; printf "%s" "$key"; color k w; printf ">"
  38. }
  39. # vi: syntax=sh ts=4 noexpandtab