dce052dac00f83dae364358cdc6c24ed3486e9ea

Author
Alexis Hildebrandt <afh@surryhill.net>
Committer
Alexis Hildebrandt <afh@surryhill.net>
Date

Message

Add emotty plugin

which displays an emoji for the current $TTY.

Diff

  1diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..b32dd1a4c52b0a76ec21b6b7a5485db6f6a5af5a
  4--- /dev/null
  5+++ b/plugins/emotty/emotty.plugin.zsh
  6@@ -0,0 +1,43 @@
  7+# ------------------------------------------------------------------------------
  8+#          FILE: emotty.plugin.zsh
  9+#   DESCRIPTION: Return an emoji for the current $TTY number.
 10+#        AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
 11+#       VERSION: 1.0.0
 12+#       DEPENDS: emoji plugin
 13+#       
 14+# There are different sets of emoji characters available, to choose a different
 15+# set export emotty_set to the name of the set you would like to use, e.g.:
 16+# % export emotty_set=nature
 17+# ------------------------------------------------------------------------------
 18+
 19+typeset -gAH _emotty_sets
 20+local _emotty_plugin_dir="${0:h}"
 21+source "$_emotty_plugin_dir/emotty_stellar_set.zsh"
 22+source "$_emotty_plugin_dir/emotty_floral_set.zsh"
 23+source "$_emotty_plugin_dir/emotty_zodiac_set.zsh"
 24+source "$_emotty_plugin_dir/emotty_nature_set.zsh"
 25+source "$_emotty_plugin_dir/emotty_emoji_set.zsh"
 26+source "$_emotty_plugin_dir/emotty_love_set.zsh"
 27+unset _emotty_plugin_dir
 28+
 29+emotty_default_set=emoji
 30+
 31+function emotty() {
 32+  # Use emotty set defined by user, fallback to default
 33+  local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
 34+  # Parse $TTY number, normalizing it to an emotty set index
 35+  (( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 ))
 36+  local character_name=${${=emotty}[tty]}
 37+  echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
 38+}
 39+
 40+function display_emotty() {
 41+  local name=$1
 42+  for i in ${=_emotty_sets[$name]}; do
 43+    printf "${emoji[$i]}${emoji2[emoji_style]}  "
 44+  done
 45+  print
 46+  for i in ${=_emotty_sets[$name]}; do
 47+    print "${emoji[$i]}${emoji2[emoji_style]}  = $i"
 48+  done
 49+}
 50diff --git a/plugins/emotty/emotty_emoji_set.zsh b/plugins/emotty/emotty_emoji_set.zsh
 51new file mode 100644
 52index 0000000000000000000000000000000000000000..00e3171312aa7da12ba138f19904d2184e58b0e7
 53--- /dev/null
 54+++ b/plugins/emotty/emotty_emoji_set.zsh
 55@@ -0,0 +1,24 @@
 56+#!/usr/bin/env zsh
 57+# vim:ft=zsh ts=2 sw=2 sts=2
 58+
 59+_emotty_sets[emoji]="
 60+  crystal_ball
 61+  ghost
 62+  jack_o_lantern
 63+  see_no_evil_monkey
 64+  hear_no_evil_monkey
 65+  speak_no_evil_monkey
 66+  smiling_cat_face_with_open_mouth
 67+  extraterrestrial_alien
 68+  rocket
 69+  billiards
 70+  bomb
 71+  pill
 72+  japanese_symbol_for_beginner
 73+  direct_hit
 74+  cyclone
 75+  diamond_shape_with_a_dot_inside
 76+  sparkle
 77+  eight_spoked_asterisk
 78+  eight_pointed_black_star
 79+  "
 80diff --git a/plugins/emotty/emotty_floral_set.zsh b/plugins/emotty/emotty_floral_set.zsh
 81new file mode 100644
 82index 0000000000000000000000000000000000000000..f761feae6de186cf83e68f8398d535472dc1fd82
 83--- /dev/null
 84+++ b/plugins/emotty/emotty_floral_set.zsh
 85@@ -0,0 +1,18 @@
 86+#!/usr/bin/env zsh
 87+# vim:ft=zsh ts=2 sw=2 sts=2
 88+
 89+_emotty_sets[floral]="
 90+  hibiscus
 91+  cherry_blossom
 92+  blossom
 93+  sunflower
 94+  bouquet
 95+  tulip
 96+  rose
 97+  four_leaf_clover
 98+  seedling
 99+  herb
100+  palm_tree
101+  evergreen_tree
102+  deciduous_tree
103+  "
104diff --git a/plugins/emotty/emotty_love_set.zsh b/plugins/emotty/emotty_love_set.zsh
105new file mode 100644
106index 0000000000000000000000000000000000000000..8f19e6902e2e5842eba4ed2dfb53e36ef619b391
107--- /dev/null
108+++ b/plugins/emotty/emotty_love_set.zsh
109@@ -0,0 +1,34 @@
110+#!/usr/bin/env zsh
111+# vim:ft=zsh ts=2 sw=2 sts=2
112+
113+# Note: The heavy_black_heart emoji requires $emoji2[emoji_style]
114+# to be rendered as the emoji red heart.
115+_emotty_sets[love]="
116+  green_heart
117+  blue_heart
118+  purple_heart
119+  yellow_heart
120+  heavy_black_heart
121+  broken_heart
122+  heart_with_arrow
123+  heart_with_ribbon
124+  sparkling_heart
125+  two_hearts
126+  revolving_hearts
127+  growing_heart
128+  beating_heart
129+  heart_decoration
130+  couple_with_heart
131+  kiss
132+  man_and_woman_holding_hands
133+  two_women_holding_hands
134+  two_men_holding_hands
135+  kiss_mark
136+  smiling_face_with_heart_shaped_eyes
137+  kissing_face
138+  face_throwing_a_kiss
139+  kissing_face_with_smiling_eyes
140+  kissing_face_with_closed_eyes
141+  smiling_cat_face_with_heart_shaped_eyes
142+  kissing_cat_face_with_closed_eyes
143+  "
144diff --git a/plugins/emotty/emotty_nature_set.zsh b/plugins/emotty/emotty_nature_set.zsh
145new file mode 100644
146index 0000000000000000000000000000000000000000..8dab4c1ba2eee2ad59bb8335dea79aabb007dadd
147--- /dev/null
148+++ b/plugins/emotty/emotty_nature_set.zsh
149@@ -0,0 +1,58 @@
150+#!/usr/bin/env zsh
151+# vim:ft=zsh ts=2 sw=2 sts=2
152+
153+_emotty_sets[nature]="
154+  mouse_face
155+  hamster_face
156+  rabbit_face
157+  dog_face
158+  cat_face
159+  tiger_face
160+  bear_face
161+  monkey_face
162+  koala
163+  panda_face
164+  chicken
165+  baby_chick
166+  bird
167+  penguin
168+  cow_face
169+  pig_face
170+  frog_face
171+  boar
172+  wolf_face
173+  horse_face
174+  snail
175+  bug
176+  ant
177+  honeybee
178+  lady_beetle
179+  spouting_whale
180+  dolphin
181+  octopus
182+  fish
183+  tropical_fish
184+  snake
185+  turtle
186+  lemon
187+  tangerine
188+  peach
189+  mushroom
190+  tomato
191+  strawberry
192+  red_apple
193+  cherries
194+  grapes
195+  aubergine
196+  watermelon
197+  banana
198+  pineapple
199+  melon
200+  pear
201+  green_apple
202+  ear_of_maize
203+  sunflower
204+  seedling
205+  herb
206+  four_leaf_clover
207+  "
208diff --git a/plugins/emotty/emotty_stellar_set.zsh b/plugins/emotty/emotty_stellar_set.zsh
209new file mode 100644
210index 0000000000000000000000000000000000000000..8e7e61068a523461cd1dbd4b5d0e8e023a35ce6c
211--- /dev/null
212+++ b/plugins/emotty/emotty_stellar_set.zsh
213@@ -0,0 +1,25 @@
214+#!/usr/bin/env zsh
215+# vim:ft=zsh ts=2 sw=2 sts=2
216+
217+# NOTE: The following emoji show as $'character' in the title
218+#  white_medium_star
219+#  sparkles
220+#  dizzy_symbol
221+
222+_emotty_sets[stellar]="
223+  full_moon_symbol
224+  waning_gibbous_moon_symbol
225+  waning_crescent_moon_symbol
226+  last_quarter_moon_symbol
227+  new_moon_symbol
228+  new_moon_with_face
229+  waxing_crescent_moon_symbol
230+  first_quarter_moon_symbol
231+  waxing_gibbous_moon_symbol
232+  full_moon_with_face
233+  sun_with_face
234+  glowing_star
235+  crescent_moon
236+  first_quarter_moon_with_face
237+  last_quarter_moon_with_face
238+  "
239diff --git a/plugins/emotty/emotty_zodiac_set.zsh b/plugins/emotty/emotty_zodiac_set.zsh
240new file mode 100644
241index 0000000000000000000000000000000000000000..bde6e3d2e764477ce3ed0e3a0186d02a09ed6bff
242--- /dev/null
243+++ b/plugins/emotty/emotty_zodiac_set.zsh
244@@ -0,0 +1,29 @@
245+#!/usr/bin/env zsh
246+# vim:ft=zsh ts=2 sw=2 sts=2
247+
248+_emotty_sets[zodiac]="
249+  aries
250+  taurus
251+  gemini
252+  cancer
253+  leo
254+  virgo
255+  libra
256+  scorpius
257+  sagittarius
258+  capricorn
259+  aquarius
260+  pisces
261+  rat
262+  ox
263+  tiger
264+  rabbit
265+  dragon
266+  snake
267+  horse
268+  goat
269+  monkey
270+  rooster
271+  dog
272+  pig
273+  "