#!/bin/bash

case $ROFI_RETV in
1)
  wl-copy "$@"
  ;;
2)

  result=$(rink "$@" | grep -v '^>')
  NUMBERS=$(echo "$result "tr '\n' ' ' | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g')

  IFS=' '

  for number in $NUMBERS; do
    echo -en "$number\\0icon\\x1fnum-lock-on\\n"
  done
  echo -en "$result\\0non-selectable\\x1ftrue\\x1ficon\\x1fcalc\n"
  ;;

esac
