logo 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #!/bin/sh -e
  2. #
  3. # logo: determine which logo to use
  4. #
  5. # Copyright (C) 2008 Canonical Ltd.
  6. # Copyright (C) 2011-2014 Dustin Kirkland
  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. __logo_detail() {
  22. MARKUP="false"
  23. __logo
  24. }
  25. __logo() {
  26. local logo=
  27. if [ -n "$LOGO" ]; then
  28. # Allow users to define their own logo in $BYOBU_CONFIG_DIR/status
  29. printf "%s" "$LOGO"
  30. return
  31. fi
  32. local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
  33. case "$distro" in
  34. *ubuntu*)
  35. if $MARKUP; then
  36. if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
  37. if [ ! "$VTE_CJK_WIDTH" = "1" ] && [ ! "$VTE_CJK_WIDTH" = "wide" ] ; then
  38. # color "colour202" "colour255" ; printf " u "; color -
  39. # Ubuntu's logo doesn't display anywhere, except for on Ubuntu itself, which has the Ubuntu font with the logo
  40. # which breaks when you ssh into Ubuntu from elsewhere (Windows, Debian, Mac)
  41. color "colour202" "colour255" ; printf " u "; color -
  42. else
  43. color m W; printf " u "; color -
  44. fi
  45. else
  46. color m W; printf " u "; color -
  47. fi
  48. else
  49. printf " u "
  50. fi
  51. ;;
  52. *alpine*)
  53. logo=" /\\\\\\\\ "
  54. $MARKUP && printf "$(color b b W)%s$(color -)" "$logo" || printf "$logo"
  55. ;;
  56. *altlinux*)
  57. logo="alt"
  58. $MARKUP && printf "$(color Y k)%s$(color -)" "$logo" || printf "$logo"
  59. ;;
  60. *arch*)
  61. logo=" A "
  62. $MARKUP && printf "$(color b w b)%s$(color -)" "$logo" || printf "$logo"
  63. ;;
  64. *centos*)
  65. if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
  66. logo="※ "
  67. $MARKUP && printf "$(color w m)※ $(color -)" || printf "$logo"
  68. else
  69. $MARKUP && printf "$(color g w)*$(color -)$(color m w)*$(color -)$(color y w)*$(color -)$(color b w)*$(color -)" || printf "$logo"
  70. fi
  71. ;;
  72. *debian*)
  73. logo=" @ "
  74. $MARKUP && printf "$(color w r)%s$(color -)" "$logo" || printf "$logo"
  75. ;;
  76. *fedora*)
  77. logo=" f "
  78. $MARKUP && printf "$(color b w)%s$(color -)" "$logo" || printf "$logo"
  79. ;;
  80. *foresight*)
  81. logo="<@>"
  82. $MARKUP && printf "$(color b W g)%s$(color -)" "$logo" || printf "$logo"
  83. ;;
  84. *gentoo*)
  85. logo=" > "
  86. $MARKUP && printf "$(color b c w)%s$(color -)" "$logo" || printf "$logo"
  87. ;;
  88. *glinux*)
  89. logo=" G "
  90. # Green: 3cba54=71, Yellow: f4c20d=214, Red: db3236=167, Blue: 4885ed=69
  91. $MARKUP && printf "$(color colour0 colour69)██$(color colour0 colour167)■$(color colour0 colour214)■$(color colour0 colour69)▄$(color colour0 colour71)█$(color colour0 colour167)■$(color -)" || printf "$logo"
  92. ;;
  93. *mac*|*darwin*)
  94. if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
  95. # The Apple option character
  96. #logo=" ⌘ "
  97. # The Apple logo -- only visible from Mac terminals
  98. logo="  "
  99. else
  100. logo=" X "
  101. fi
  102. $MARKUP && printf "$(color w k)%s$(color -)" "$logo" || printf "$logo"
  103. ;;
  104. *mandriva*)
  105. logo=" (* "
  106. $MARKUP && printf "$(color b k c) ($(color -)$(color b k y)*$(color -) " || printf "$logo"
  107. ;;
  108. *mint*)
  109. logo=" lm "
  110. $MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
  111. ;;
  112. *openwrt*)
  113. logo="OWrt"
  114. $MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
  115. ;;
  116. *raspbian*)
  117. logo=" @ "
  118. $MARKUP && printf "$(color colour125 colour15)%s$(color -)" "$logo" || printf "$logo"
  119. ;;
  120. *red*hat*|*rhel*)
  121. logo=" RH "
  122. $MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
  123. ;;
  124. *rockhopper*)
  125. logo="palm"
  126. $MARKUP && printf "$(color k w)%s$(color -)" "$logo" || printf "$logo"
  127. ;;
  128. *slackware*)
  129. logo=".S "
  130. $MARKUP && printf "$(color u B k)%s$(color -)" "$logo" || printf "$logo"
  131. ;;
  132. *suse*)
  133. logo="SUSE"
  134. $MARKUP && printf "$(color W g)%s$(color -)" "$logo" || printf "$logo"
  135. ;;
  136. *xandros*)
  137. logo=" X "
  138. $MARKUP && printf "$(color W r)%s$(color -)" "$logo" || printf "$logo"
  139. ;;
  140. *)
  141. if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
  142. logo="〣"
  143. else
  144. logo="[B]"
  145. fi
  146. $MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
  147. ;;
  148. esac
  149. printf " "
  150. }
  151. # vi: syntax=sh ts=4 noexpandtab