#!/usr/bin/env bash

# rofi theme
DIR_THEME="$HOME/.config/rofi/compact_without_icons.rasi"

DIR="/usr/local/bin/themes"

get_options_theme_polybar() {
  echo "polybar-square"
  echo "polybar-rounded"
}

main() {

  # Get THEME_POLYBAR from rofi
  THEME_POLYBAR=$( (get_options_theme_polybar) | rofi -dmenu -i -fuzzy -p "" -theme "$DIR_THEME")

    # If user has not picked anything, exit
  if [[ -z "${THEME_POLYBAR// /}" ]]; then
    exit 1
  fi
  cp -f $DIR/$THEME_POLYBAR/launch.sh ~/.config/polybar

  # done
  set -e

  i3-msg restart
}

main &

exit 0
