#!/bin/sh
# redshiftgui_tray - Part of wrapper for RedshiftGUI (redshiftgui)
# Automatic minimized startup only if a location other than 0:0 specified.
# To prevent automatic start-up but retain a location, remove
# execute permissions for this file (chmod -x /root/Startup/redshiftgui_tray).

[ -f ~/.redshiftgrc ] || exit
! grep 'latlon=' ~/.redshiftgrc | grep -q '0.000000:0.000000' ~/.redshiftgrc || exit

grep -q '|' ~/.redshiftgrc \
  && sed -i -e '/^min/d' -e '/map=/ s/|/,/g' ~/.redshiftgrc

vercmp $(readlink /usr/lib/libcurl.so.4 | grep -o '[0-9][0-9.]*') gt 4.4.0 \
  && [ -f /usr/lib/redshiftgui/libcurl.so.4.4.0 ] \
  && export LD_LIBRARY_PATH=/usr/lib/redshiftgui:$LD_LIBRARY_PATH
exec redshiftgui.sh  --min
