#!/bin/bash
# composite level selector
# arpinux 2021 <https://arpinux.org>

# options - see 'man picom'
LIGHT="--inactive-opacity .9"
FULL="--fading \
    --active-opacity 1 \
    --inactive-opacity .8 \
    --menu-opacity .9 \
    --frame-opacity .9 \
    --no-fading-destroyed-argb"

# with args > just exec
if [ "$1" == "-s" ]; then
    pkill -9 picom; exit 0
elif [ "$1" == "-l" ]; then
    pkill -9 picom; sleep 1s; picom $LIGHT; exit 0
elif [ "$1" == "-f" ]; then
    pkill -9 picom; sleep 1s; picom $FULL; exit 0
else
    # no args or wrong args > show menu
    choice=$(echo -e "\n\n\n" | \
        rofi -theme /usr/share/nakedrasi/eyecandy.rasi -dmenu \
        -p "")
    case "$choice" in
        ) pkill -9 picom; sleep 1s; picom $LIGHT & ;;
        ) pkill -9 picom; sleep 1s; picom $FULL & ;;
        ) pkill -9 picom & ;;
        ) exit 0 ;;
    esac
fi
exit 0
