mabox-pipemenus/usr/bin/jgpicom-pipe

98 lines
2.4 KiB
Plaintext
Raw Permalink Normal View History

2020-09-30 23:38:29 +02:00
#!/bin/bash
# jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP)
# Copyright (C) 2020 napcok <napcok@gmail.com>
CONFDIR="$HOME/.config/picom/configs"
CONFFILE="$HOME/.config/picom.conf"
RESTART_ATTEMPTS=20
mkdir -p "$CONFDIR"
menu() {
case $LANG in
pl*)
ENABLE="Włącz Kompozytora"
2021-10-23 14:33:21 +02:00
GREYSCALE="Skala szarości"
2020-09-30 23:38:29 +02:00
RESTART="Restartuj Kompozytora"
DISABLE="Wyłącz Kompozytora"
CHOOSE="Wybierz plik konfiguracyjny"
DEVNULL="/dev/null <i>(brak)</i>"
EDIT_TITLE="Edytuj..."
EDIT="Edytuj plik ustawień Kompozytora"
OPENDIR="Otwórz katalog <i>~/.config/picom/configs</i>"
;;
es*)
ENABLE="Activar Compositor"
2021-10-23 14:33:21 +02:00
GREYSCALE="Greyscale"
2020-09-30 23:38:29 +02:00
RESTART="Reiniciar Compositor"
DISABLE="Desactivar Compositor"
CHOOSE="Elegir el archivo de configuración"
DEVNULL="/dev/null"
EDIT_TITLE="Editar..."
EDIT="Editar archivo de ajustes del Compositor"
OPENDIR="Abrir la carpeta <i>~/.config/picom/configs</i>"
;;
*)
ENABLE="Enable Compositor"
2021-10-23 14:33:21 +02:00
GREYSCALE="Greyscale"
2020-09-30 23:38:29 +02:00
RESTART="Restart Compositor"
DISABLE="Disable Compositor"
CHOOSE="Choose config file"
DEVNULL="/dev/null <i>(none)</i>"
EDIT_TITLE="Edit..."
EDIT="Edit Compositor settings file"
OPENDIR="Open <i>~/.config/picom/configs</i> directory"
;;
esac
out+=("^sep(Picom)")
if ! pidof picom > /dev/null; then
out+=("$ENABLE,compton_toggle")
2021-10-23 14:33:21 +02:00
out+=("^sep()")
out+=("$GREYSCALE,greyscale")
2020-09-30 23:38:29 +02:00
else
out+=("$RESTART,compton_toggle;compton_toggle")
out+=("$DISABLE,compton_toggle")
2021-10-23 14:33:21 +02:00
out+=("^sep()")
out+=("$GREYSCALE,greyscale")
2020-09-30 23:38:29 +02:00
fi
out+=("^sep($CHOOSE)")
if [ "$(readlink $CONFFILE)" -ef "/dev/null" ];then
out+=("<u><b>$DEVNULL</b></u>")
else
out+=("$DEVNULL,ln -sf /dev/null $CONFFILE")
fi
for item in "$CONFDIR"/*.conf; do
2020-10-01 15:04:46 +02:00
if [ -f "$item" ];then
2020-09-30 23:38:29 +02:00
if [ "$(readlink $CONFFILE)" -ef "$item" ];then
out+=("<u><b>${item##*/}</b></u>")
else
2022-12-06 21:55:05 +01:00
out+=("${item##*/},ln -sf $item $CONFFILE;compton_toggle;compton_toggle")
2020-09-30 23:38:29 +02:00
fi
2020-10-01 15:04:46 +02:00
fi
2020-09-30 23:38:29 +02:00
done
out+=("^sep($EDIT_TITLE)")
2020-10-01 15:04:46 +02:00
if [ -f "$CONFFFILE" ];then
2020-09-30 23:38:29 +02:00
if [ ! "$(readlink $CONFFILE)" -ef "/dev/null" ];then
2022-08-17 14:19:31 +02:00
out+=("$EDIT,xdg-open $CONFFILE")
2020-09-30 23:38:29 +02:00
fi
2020-10-01 15:04:46 +02:00
fi
2020-09-30 23:38:29 +02:00
out+=("$OPENDIR,exo-open --launch FileManager $CONFDIR")
printf '%s\n' "${out[@]}"
}
case "$1" in
start) start;;
stop) stop;;
restart) restart;;
menu) menu "$2";;
esac