#!/bin/bash # jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP) # Copyright (C) 2020-2024 napcok . "$HOME/.config/mabox/mabox.conf" backend=${picom_renderer:-glx} CONFDIR="$HOME/.config/picom/configs" CONFFILE="$HOME/.config/picom.conf" mkdir -p "$CONFDIR" case $LANG in pl*) ENABLE="Włącz Kompozytora" RESTART="Restartuj Kompozytora" DISABLE="Wyłącz Kompozytora" CHOOSE="Wybierz plik konfiguracyjny" DEVNULL="/dev/null (brak)" EDIT_TITLE="Edytuj ustawienia Picom" EDIT="Edytuj plik ustawień Kompozytora" CONFIG_GUI="Konfiguruj (picom-conf)" INSTALL_GUI="Zainstaluj picom-conf" OPENDIR="Otwórz katalog ~/.config/picom/configs" RENDERER="Rendering Backend" GLX="glx (zalecany)" XRENDER="xrender (dla starszego sprzętu)" ;; es*) ENABLE="Activar Compositor" RESTART="Reiniciar Compositor" DISABLE="Desactivar Compositor" CHOOSE="Elegir el archivo de configuración" DEVNULL="/dev/null" EDIT_TITLE="Editar..." CONFIG_GUI="Configure with GUI (picom-conf)" INSTALL_GUI="Install picom-conf (GUI)" EDIT="Editar archivo de ajustes del Compositor" OPENDIR="Abrir la carpeta ~/.config/picom/configs" RENDERER="Rendering Backend" GLX="glx (recommended)" XRENDER="xrender (for older hardware)" ;; *) ENABLE="Start Compositor" RESTART="Restart Compositor" DISABLE="Stop Compositor" CHOOSE="Choose config file" DEVNULL="/dev/null (none)" EDIT_TITLE="Edit Compositor settings" EDIT="Edit Compositor settings file" CONFIG_GUI="Configure with GUI (picom-conf)" INSTALL_GUI="Install picom-conf (GUI)" OPENDIR="Open ~/.config/picom/configs directory" RENDERER="Rendering Backend" GLX="glx (recommended)" XRENDER="xrender (for older hardware)" ;; esac menu() { 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+=("$DEVNULL") 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+=("${item##*/}") 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") if hash picom-conf 2>&1 >/dev/null then out+=("$CONFIG_GUI,picom-conf") else out+=("$INSTALL_GUI,pamac-installer picom-conf-git") fi fi fi out+=("$OPENDIR,exo-open --launch FileManager $CONFDIR") out+=("^sep($RENDERER)") [[ "$backend" == "glx" ]] && out+=(" $GLX" " $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart") || out+=(" $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart" " $XRENDER") printf '%s\n' "${out[@]}" } case "$1" in start) start;; menu) menu "$2";; esac