#!/bin/bash
# Toggles the calendar. If $1=x $2=y, the calendar bottom-right corner is
# placed at x,y.

if ! ps -Ao "%c %u" | grep "orage" | grep -q "$(whoami)"; then
	# Orage non lancé
	orage > /dev/null 2>/dev/null &
	sleep 0.42
fi

orage --toggle

if (( $# >= 2 )); then
#	sleep 0.2
	i3-msg [class='Orage'] move absolute position "$(($1 - 290))px" \
		"$(($2 - 215))px" > /dev/null
fi
