#!/bin/bash
. "$HOME/.config/mabox/mabox.conf"
backend=${picom_renderer:-glx}
case "$LANG" in
pl*)
_DISABLED="Kompozytor Picom zastał WYŁĄCZONY"
_ENABLED="Kompozytor Picom został URUCHOMIONY"
_RENDERER="Sposób renderowania"
_WITHOUT="Bez pliku konfiguracyjnego (/dev/null)"
_MENU="Menu Konfiguracji..."
;;
*)
_DISABLED="Picom compositor DISABLED"
_ENABLED="Picom compositor ENABLED"
_RENDERER="Renderer backend"
_WITHOUT="Running without config file (/dev/null)"
_ERROR="Something went wrong"
_NOT_STARTED="Picom not started\nCheck your configuration"
_MENU="Configure Picom"
;;
esac
if [ $(pgrep -u $USER picom) ]; then
killall -u $USER picom
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 5000 "Compositor" "$_DISABLED" -o "$_MENU:jgpicom-pipe -s"
else
CONFIGFILE="$HOME/.config/picom.conf"
if [ -f "$CONFIGFILE" ];then
picom --backend "$backend" --config "$CONFIGFILE" &
sleep .25
if [ $(pgrep -u $USER picom) ]; then
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 8000 "$_ENABLED" "\n$_RENDERER: $backend" -o "$_MENU:jgpicom-pipe -s"
else
notify-send.sh --replace-file=/tmp/comptontgl -i error -t 8000 "$_ERROR" "\n$_NOT_STARTED\n$_RENDERER: $backend" -o "$_MENU:jgpicom-pipe -s"
fi
else
picom --backend "$backend" --config /dev/null &
sleep .25
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 8000 "$_ENABLED" "\n$_WITHOUT\n$_RENDERER $backend" -o "$_MENU:jgpicom-pipe -s"
fi
fi
exit