98 lines
2.4 KiB
Bash
Executable File
98 lines
2.4 KiB
Bash
Executable File
#!/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"
|
|
GREYSCALE="Skala szarości"
|
|
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"
|
|
GREYSCALE="Greyscale"
|
|
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"
|
|
GREYSCALE="Greyscale"
|
|
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")
|
|
out+=("^sep()")
|
|
out+=("$GREYSCALE,greyscale")
|
|
|
|
else
|
|
out+=("$RESTART,compton_toggle;compton_toggle")
|
|
out+=("$DISABLE,compton_toggle")
|
|
out+=("^sep()")
|
|
out+=("$GREYSCALE,greyscale")
|
|
|
|
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
|
|
if [ -f "$item" ];then
|
|
if [ "$(readlink $CONFFILE)" -ef "$item" ];then
|
|
out+=("<u><b>${item##*/}</b></u>")
|
|
else
|
|
out+=("${item##*/},ln -sf $item $CONFFILE;compton_toggle;compton_toggle")
|
|
fi
|
|
fi
|
|
done
|
|
|
|
out+=("^sep($EDIT_TITLE)")
|
|
if [ -f "$CONFFFILE" ];then
|
|
if [ ! "$(readlink $CONFFILE)" -ef "/dev/null" ];then
|
|
out+=("$EDIT,xdg-open $CONFFILE")
|
|
fi
|
|
fi
|
|
out+=("$OPENDIR,exo-open --launch FileManager $CONFDIR")
|
|
|
|
printf '%s\n' "${out[@]}"
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
start) start;;
|
|
stop) stop;;
|
|
restart) restart;;
|
|
menu) menu "$2";;
|
|
esac
|