#!/bin/bash # jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP) # Copyright (C) 2020-2024 napcok #TODO recognize rule-based configs (since picom v12) and don't show link to picom-conf . "$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)" _COLORIZER_ROOT="Colorizer - menu główne" _LEFTSIDEPANEL="Lewy panel boczny" ;; 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)" _COLORIZER_ROOT="Colorizer rootmenu" _LEFTSIDEPANEL="Left Sidepanel" ;; *) 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 dir" RENDERER="Rendering Backend" GLX="glx (recommended)" XRENDER="xrender (for older hardware)" _COLORIZER_ROOT="Colorizer rootmenu" _LEFTSIDEPANEL="Left Sidepanel" ;; esac me="jgpicom-pipe -s" out+=("^sep(Picom)") if ! pidof picom > /dev/null; then out+=(" $ENABLE,mabox-compositor --start;${me}") else out+=(" $RESTART,mabox-compositor --restart;${me}") out+=(" $DISABLE,mabox-compositor --stop;${me}") fi out+=("^sep($RENDERER)") [[ "$backend" == "glx" ]] && out+=(" $GLX" " $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart;${me}") || out+=(" $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart;${me}" " $XRENDER") out+=("^sep($CHOOSE)") if [ "$(readlink $CONFFILE)" -ef "/dev/null" ];then out+=(" $DEVNULL") else out+=(" $DEVNULL,ln -sf /dev/null $CONFFILE;mabox-compositor --restart;${me}") 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;${me}") 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>/dev/null then if [[ "$(readlink $CONFFILE)" != *jaskier.conf ]];then out+=(" $CONFIG_GUI,picom-conf") fi else out+=(" $INSTALL_GUI,pamac-installer picom-conf-git") fi fi fi out+=(" $OPENDIR,exo-open --launch FileManager $CONFDIR") if [[ "$1" == "-s" ]]; then . /usr/share/mb-jgtools/pipemenu-standalone.cfg CNF_DIR="$HOME/.config/colorizer" CNF_FILE="$CNF_DIR/colorizer.conf" source "$CNF_FILE" out+=("^sep()") out+=(" ${arrow_string_left} $_COLORIZER_ROOT,colorizer -s") out+=(" ${arrow_string_left} ${arrow_string_left} $_LEFTSIDEPANEL,mb-jgtools places") if [[ "$colorizer_size" == "full" ]];then eval $(xdotool getdisplaygeometry --shell) MENU_HEIGHT_MIN="$HEIGHT" MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN jgtools_radius=0 menu_margin_x="0" else MENU_VALIGN="center" menu_margin_x=${submenu_spacing:-0} fi MENU_HALIGN="left" jgmenu_icon_size=0 [ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius [ -z $jgmenu_use_borders ] && menu_border=0 JGWIDTH=$((jgtools_padding + 270 + jgtools_padding)) MENU_PADDING_TOP=$((jgtools_padding + 150)) #WALLPAPER read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | tail -1 | cut -d'=' -f2) THUMBDIR="$HOME/.cache/colorizer/thumbs" mkdir -p ${THUMBDIR} NAME=${WALLPATH////_} if [[ "${NAME}" =~ ^_home_.* ]]; then n=${#HOME} ((n++)) NAME=${NAME:${n}} fi THUMB="${THUMBDIR}/${NAME}.png" if [[ ! -f "$THUMB" ]] then convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} fi mkconfigfile [[ "$GR" == "1" ]] && clr=${GR_FROM} || clr=${FG} cat < ${MENU_ITEMS} @icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB} @rect,,$((jgtools_padding)),$((jgtools_padding + 116)),270,28,0,left,top,#222222 20,#222222 70, @icon,,$((jgtools_padding+4)),$((jgtools_padding+82)),64,64,4,left,top,,,/usr/share/icons/hicolor/scalable/apps/compton.svg #@text,,$((jgtools_padding + 10)),$((jgtools_padding + 106)),100,28,0,left,top,#FFFFFF ,${WINCLR}, @text,,$((jgtools_padding + 88)),$((jgtools_padding + 116)),180,28,0,left,top,#FFFFFF ,${WINCLR},Mabox Compositor settings $(printf '%s\n' "${out[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null exit 0 fi printf '%s\n' "${out[@]}"