105 lines
2.9 KiB
Bash
Executable File
105 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP)
|
|
# Copyright (C) 2020-2024 napcok <napcok@gmail.com>
|
|
|
|
. "$HOME/.config/mabox/mabox.conf"
|
|
backend=${picom_renderer:-glx}
|
|
|
|
CONFDIR="$HOME/.config/picom/configs"
|
|
CONFFILE="$HOME/.config/picom.conf"
|
|
|
|
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>"
|
|
RENDERER="Rendering Backend"
|
|
GLX="<b>glx</b> <i>(zalecany)</i>"
|
|
XRENDER="<b>xrender</b> <i>(dla starszego sprzętu)</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>"
|
|
RENDERER="Rendering Backend"
|
|
GLX="<b>glx</b> <i>(recommended)</i>"
|
|
XRENDER="<b>xrender</b> <i>(for older hardware)</i>"
|
|
;;
|
|
*)
|
|
ENABLE="Start Compositor"
|
|
RESTART="Restart Compositor"
|
|
DISABLE="Stop 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"
|
|
RENDERER="Rendering Backend"
|
|
GLX="<b>glx</b> <i>(recommended)</i>"
|
|
XRENDER="<b>xrender</b> <i>(for older hardware)</i>"
|
|
;;
|
|
esac
|
|
|
|
out+=("^sep(Picom)")
|
|
if ! pidof picom > /dev/null; then
|
|
out+=("$ENABLE,mabox-compositor --start")
|
|
|
|
else
|
|
out+=("$RESTART,mabox-compositor --restart")
|
|
out+=("$DISABLE,mabox-compositor --stop")
|
|
|
|
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;mabox-compositor --restart")
|
|
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;mabox-compositor --restart")
|
|
fi
|
|
fi
|
|
done
|
|
|
|
out+=("^sep($EDIT_TITLE)")
|
|
if [ -f "$CONFFILE" ];then
|
|
if [ ! "$(readlink $CONFFILE)" -ef "/dev/null" ];then
|
|
out+=("$EDIT,xdg-open $CONFFILE")
|
|
fi
|
|
fi
|
|
out+=("$OPENDIR,exo-open --launch FileManager $CONFDIR")
|
|
|
|
out+=("^sep($RENDERER)")
|
|
[[ "$backend" == "glx" ]] && out+=("<big>綠</big> $GLX" "<big>祿</big> $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart") || out+=("<big>祿</big> $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart" "<big>綠</big> $XRENDER")
|
|
|
|
printf '%s\n' "${out[@]}"
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
start) start;;
|
|
stop) stop;;
|
|
restart) restart;;
|
|
menu) menu "$2";;
|
|
esac
|