#!/bin/bash

export PATH=$PATH:$HOME/bin/:$HOME/bin/scripts/

SCREEN_SHARE_OPTION="Start screen share"
if [ -f "/tmp/$USER.screen-share" ]; then
	SCREEN_SHARE_OPTION="Stop screen share"
fi
WEBCAM_OPTION="Start good webcam"
if [ -f "/tmp/$USER.webcam" ]; then
	WEBCAM_OPTION="Stop good webcam"
fi
DUNST_PAUSE_OPTION="Pause dunst notifications"
if [[ $(dunstctl is-paused) == "true" ]]; then
	DUNST_PAUSE_OPTION="Resume dunst notifications"
fi

options="Power menu\nTimer\n$SCREEN_SHARE_OPTION\n$WEBCAM_OPTION\n$DUNST_PAUSE_OPTION"

selected=$(echo -e $options | rofi -p Utility -dmenu -theme appsmenu)

case $selected in
	"Timer")
		timer-launcher
		;;
	"$SCREEN_SHARE_OPTION")
		screen-share-toggle
		;;
	"$WEBCAM_OPTION")
		webcam-toggle
		;;
	"Power menu")
		power-menu
		;;
	"$DUNST_PAUSE_OPTION")
		dunstctl set-paused toggle
		;;
esac