upload
This commit is contained in:
178
usr/bin/jgpicom-pipe
Executable file
178
usr/bin/jgpicom-pipe
Executable file
@@ -0,0 +1,178 @@
|
||||
#!/bin/bash
|
||||
# jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP)
|
||||
# Copyright (C) 2020-2026 Daniel Napora <danieln@maboxlinux.org>
|
||||
|
||||
|
||||
|
||||
. "$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 <i>(brak)</i>"
|
||||
EDIT_TITLE="Edytuj ustawienia Picom"
|
||||
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>"
|
||||
_COLORIZER_ROOT="<b>Colorizer</b> - 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..."
|
||||
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>"
|
||||
_COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
|
||||
_LEFTSIDEPANEL="Left Sidepanel"
|
||||
;;
|
||||
*)
|
||||
ENABLE="Start Compositor"
|
||||
RESTART="Restart Compositor"
|
||||
DISABLE="Stop Compositor"
|
||||
CHOOSE="Choose config file"
|
||||
DEVNULL="/dev/null <i>(none)</i>"
|
||||
EDIT_TITLE="Edit Compositor settings"
|
||||
EDIT="Edit Compositor settings file"
|
||||
OPENDIR="Open <i>~/.config/picom/configs</i> dir"
|
||||
RENDERER="Rendering Backend"
|
||||
GLX="<b>glx</b> <i>(recommended)</i>"
|
||||
XRENDER="<b>xrender</b> <i>(for older hardware)</i>"
|
||||
_COLORIZER_ROOT="<b>Colorizer</b> 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+=("<big>綠</big> $GLX" "<big>祿</big> $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart;${me}") || out+=("<big>祿</big> $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart;${me}" "<big>綠</big> $XRENDER")
|
||||
|
||||
out+=("^sep($CHOOSE)")
|
||||
|
||||
if [ "$(readlink $CONFFILE)" -ef "/dev/null" ];then
|
||||
out+=("<big>綠</big> <u><b>$DEVNULL</b></u>")
|
||||
else
|
||||
out+=("<big>祿</big> $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+=("<big>綠</big> <u><b>${item##*/}</b></u>")
|
||||
else
|
||||
out+=("<big>祿</big> ${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")
|
||||
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 <<EOF > ${MENU_ITEMS}
|
||||
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
|
||||
@rect,,$((jgtools_padding+4)),$((jgtools_padding + 116)),262,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},<span size='41600' font_family='Ubuntu'><big></big></span>
|
||||
@text,,$((jgtools_padding + 88)),$((jgtools_padding + 116)),180,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'>Mabox <b>Compositor</b> settings</span>
|
||||
|
||||
|
||||
$(printf '%s\n' "${out[@]}")
|
||||
|
||||
EOF
|
||||
|
||||
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
printf '%s\n' "${out[@]}"
|
||||
|
||||
Reference in New Issue
Block a user