#!/usr/bin/env bash

# Launch the CLI else the GUI
[ "--cli" = "$1" ] && shift && exec /usr/lib64/noson/noson-cli $@

# Migrate the GUI settings
if [ -f "$HOME/.config/janbar/noson.conf" ]; then
  mv "$HOME/.config/janbar/noson.conf" "$HOME/.config/janbar/io.github.janbar.noson.conf"
  [ -d "$HOME/.local/share/janbar/noson" ] && mv "$HOME/.local/share/janbar/noson" "$HOME/.local/share/janbar/io.github.janbar.noson"
  [ -d "$HOME/.cache/janbar/noson" ] && mv "$HOME/.cache/janbar/noson" "$HOME/.cache/janbar/io.github.janbar.noson"
fi

# Launch the GUI
export QML2_IMPORT_PATH=/usr/lib64/noson
exec /usr/lib64/noson/noson-gui $@
