#!/bin/bash

# Find the launcher.sh location
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do
  DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
  SOURCE=$(readlink "$SOURCE")
  [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )

# Assure that the images folder is symlinked to tmp 
TMP_PATH=/tmp/kolinux-themer
if [[ ! -e $TMP_PATH/pictures ]]; then
  mkdir -p $TMP_PATH
  ln -s "${DIR}/pictures" "${TMP_PATH}/pictures"
fi

# Run the rofi menu
rofi \
    -modes drun,run,window,calc \
    -show drun \
    -theme ${DIR}/theme.rasi
