#!/bin/bash

## Files and cmd
FILE="$HOME/.cache/eww_launch.xyz"
EWW="/usr/bin/eww"

## Run eww daemon if not running already
if [[ ! `pidof eww` ]]; then
	${EWW} daemon
	sleep 1
fi

## Open widgets 
run_eww() {
	${EWW} open-many \
		   background \
		   profile \
		   system \
		   clock \
		   music \
		   github \
		   reddit \
		   twitter \
		   youtube \
		   apps \
		   workspaces \
		   logout \
		   mail \
		   sleep \
		   reboot \
		   poweroff \
		   weather_info \
		   weather_quotes \
		   roundedc \
		   roundedd \
		   roundede \
		   roundedf \
		   folders \ 
}

## Launch or close widgets accordingly
if [[ ! -f "$FILE" ]]; then
	touch "$FILE"
	run_eww
else
	${EWW} close-all
	rm "$FILE"
fi
