85 lines
2.1 KiB
Bash
Executable File
85 lines
2.1 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"
|
|
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"
|
|
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"
|
|
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")
|
|
else
|
|
out+=("$RESTART,compton_toggle;compton_toggle")
|
|
out+=("$DISABLE,compton_toggle")
|
|
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 [ "$(readlink $CONFFILE)" -ef "$item" ];then
|
|
out+=("<u><b>${item##*/}</b></u>")
|
|
else
|
|
out+=("${item##*/},ln -sf $item $CONFFILE")
|
|
fi
|
|
done
|
|
|
|
out+=("^sep($EDIT_TITLE)")
|
|
if [ ! "$(readlink $CONFFILE)" -ef "/dev/null" ];then
|
|
out+=("$EDIT,geany $CONFFILE")
|
|
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
|