mabox-tools/bin/compton_toggle

45 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-02-18 17:24:18 +01:00
#!/bin/bash
2024-12-08 22:28:23 +01:00
. "$HOME/.config/mabox/mabox.conf"
backend=${picom_renderer:-glx}
2021-10-13 12:20:43 +02:00
case "$LANG" in
pl*)
2024-12-17 00:30:47 +01:00
_DISABLED="Kompozytor Picom zastał WYŁĄCZONY"
_ENABLED="Kompozytor Picom został URUCHOMIONY"
_RENDERER="Sposób renderowania"
_WITHOUT="Bez pliku konfiguracyjnego (/dev/null)"
_MENU="Menu Konfiguracji..."
2021-10-13 12:20:43 +02:00
;;
*)
2024-12-17 00:30:47 +01:00
_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"
2021-10-13 12:20:43 +02:00
;;
esac
2020-02-18 17:24:18 +01:00
2024-12-08 22:28:23 +01:00
if [ $(pgrep -u $USER picom) ]; then
2023-08-19 16:23:51 +02:00
killall -u $USER picom
2024-12-17 00:30:47 +01:00
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 5000 "Compositor" "$_DISABLED" -o "$_MENU:jgpicom-pipe -s"
2020-02-18 17:24:18 +01:00
else
2020-09-30 22:56:54 +02:00
CONFIGFILE="$HOME/.config/picom.conf"
if [ -f "$CONFIGFILE" ];then
2024-12-08 22:28:23 +01:00
picom --backend "$backend" --config "$CONFIGFILE" &
2024-12-17 00:30:47 +01:00
sleep .25
if [ $(pgrep -u $USER picom) ]; then
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 8000 "$_ENABLED" "\n$_RENDERER: <b>$backend</b>" -o "$_MENU:jgpicom-pipe -s"
else
notify-send.sh --replace-file=/tmp/comptontgl -i error -t 8000 "$_ERROR" "\n$_NOT_STARTED\n$_RENDERER: <b>$backend</b>" -o "$_MENU:jgpicom-pipe -s"
fi
2020-09-30 22:56:54 +02:00
else
2024-12-10 20:57:56 +01:00
picom --backend "$backend" --config /dev/null &
2024-12-17 00:30:47 +01:00
sleep .25
notify-send.sh --replace-file=/tmp/comptontgl -i compton -t 8000 "$_ENABLED" "\n$_WITHOUT\n$_RENDERER <b>$backend</b>" -o "$_MENU:jgpicom-pipe -s"
2020-09-30 22:56:54 +02:00
fi
2020-02-18 17:24:18 +01:00
fi
exit