529 lines
21 KiB
Bash
Executable File
529 lines
21 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# colorizer - set of tools for Mabox (auto)theming
|
|
# Copyright (C) 2022-2025 Daniel Napora <danieln@maboxlinux.org>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
CNF_DIR="$HOME/.config/colorizer"
|
|
mkdir -p "$CNF_DIR"
|
|
CNF_FILE="$CNF_DIR/colorizer.conf"
|
|
CUSTOM_COMMANDS_FILE="$CNF_DIR/custom.csv"
|
|
|
|
if [ ! -f $CNF_FILE ]; then
|
|
cat <<EOF > ${CNF_FILE}
|
|
# User wallpaper dir
|
|
user_wallpapers_dir=~/wallpapers
|
|
# Show related tools (show or hide)
|
|
related_tools=hide
|
|
# Colorizer size: full or compact
|
|
colorizer_size=full
|
|
# Gradients: change openbox theme? (active window titlebar)
|
|
gradient_obtheme=yes
|
|
# Gradients: change menu/panels background?
|
|
gradient_menu=no
|
|
EOF
|
|
fi
|
|
|
|
source "$CNF_FILE"
|
|
|
|
me="colorizer -s"
|
|
|
|
case "$LANG" in
|
|
pl*)
|
|
REGENERATE="(Re)Generuj z kolorów tapety..."
|
|
REGENERATEALL="Regeneruj wszystko"
|
|
ASCONFIGURED="wg konfiguracji"
|
|
REVERSE="odwrotnie"
|
|
CURRENTCONF="Obecna konfiguracja"
|
|
MODULES="Moduły"
|
|
FONTS="Konfiguruj <b>Czcionki</b>"
|
|
_PICOM="Ustawienia <b>Kompozytora (Picom)</b>"
|
|
OBTHEME="Motyw <b>Openbox</b>"
|
|
MENUPANELS="<b>Menu</b> i Panele boczne"
|
|
COLORIZER_CONKY="<b>Menadżer</b> Widżetów <b>Conky</b>"
|
|
CAVA="Cava - wizualizacja dźwięku"
|
|
TERMINALTHEME="Motyw terminala"
|
|
EDIT_PALETTE="Edytuj paletę kolorów"
|
|
RANDWALL="Ustaw losową tapetę"
|
|
SYSWALLPAPER="Tapety <b>systemowe</b>"
|
|
USERWALLPAPER="Tapety <b>użytkownika</b>"
|
|
GRADIENTS="Gradienty"
|
|
PRE_GRADIENTS="Gradienty"
|
|
GRAD_OB="Stosować do motywu OpenBox?"
|
|
GRAD_MENU="Stosować do Menu/Paneli?"
|
|
GRAD_CONKY="Stosować do Conky?"
|
|
SETTINGS_AND_HELP="Pomoc i Ustawienia"
|
|
SETTINGS="Ustawienia"
|
|
COLORIZER_SETTINGS="Ustawienia Colorizera"
|
|
GRADIENTS_ACT="Działanie gradientów w menu gł."
|
|
EDITCONF="Edytuj plik konfiguracyjny"
|
|
RESET="Resetuj ustawienia Colorizera"
|
|
YES="Tak"
|
|
NO="Nie"
|
|
LIGHTBG="<b>light</b> - jasne tło"
|
|
DARKBG="<b>dark</b> - ciemne tło"
|
|
OTHERTOOLS="Powiązane narzędzia"
|
|
ADDLAUNCHER="Dodaj uruchamiacz Colorizera do panelu"
|
|
DELETELAUNCHER="Usuń uruchamiacz Colorizera z panelu"
|
|
HEIGHT="Wysokość Colorizera"
|
|
FULL="<b>full</b> - pełna wysokość"
|
|
COMPACT="<b>compact</b> - kompaktowa"
|
|
OTHER_SETTINGS="Inne ustawienia"
|
|
SHOW_RELATED="Pokazuj powiązane?"
|
|
SHOW="<b>show</b> - pokaż"
|
|
HIDE="<b>hide</b> - ukryj"
|
|
EDIT_RELATED="Edytuj powiązane"
|
|
RESET_RELATED="Resetuj powiązane"
|
|
LXAPPEARANCE="Motyw GTK i ikony"
|
|
THEMEMANAGER="Zarządzaj motywami"
|
|
WALLPAPERS="Katalogi z tapetami"
|
|
OPENDIR="Otwórz katalog w menadżerze plików"
|
|
OPENDIR_VIEWNIOR="Otwórz katalog w przeglądarce obrazków"
|
|
SETRANDOM="Ustaw losową"
|
|
CHANGE="Zmień"
|
|
USERDIR_NOT_EXIST="kalalog nie istnieje"
|
|
CREATE_USERDIR="Utwórz katalog"
|
|
HELP="Okno główne i Pomoc"
|
|
RESET_COLORS="Resetuj kolory"
|
|
RESET_CHOOSE="Resetuj..."
|
|
RESET_SEP="Resetuj kolory dla"
|
|
RES_OB_WD="Dekoracje okien OpenBox"
|
|
RES_CONKY="Conky"
|
|
RES_MENU="Menu i Paneli"
|
|
RES_ALL="Wszystko <i>(OB, menu, conky)</i>"
|
|
COLORIZE="Szybko Pokoloruj lub Resetuj..."
|
|
_LEFTSIDEPANEL="Lewy panel boczny"
|
|
_WALL_DESK_MENU="Tapety oraz <b>stylizacja</b> pulpitu"
|
|
|
|
_AUTOTHEMING="Auto theming (beta)"
|
|
_ON_WP_CHANGE="(po zmianie tapety)"
|
|
_AUTOTH_SETTINGS="Ustawienia Auto theming"
|
|
_APPLY_COLORSCHEME_TO="Zastosuj kolory tapety do..."
|
|
_APPLY_TO_ALL="<b>Wszystko</b>"
|
|
_APPLY_REVERSE="<b>Wszystko</b> odwrotnie (jasny 易 ciemny)"
|
|
_APPLY_ONLY_TO="Zastosuj tylko do..."
|
|
_RESET_WP_THEMES="Reset tapety i motywów"
|
|
_ENABLED="włączony"
|
|
_DISABLED="wyłączony"
|
|
_LIGHTBG="<b>jasny</b> wariant"
|
|
_DARKBG="<b>ciemny</b> wariant"
|
|
_NONE="<b>none</b> wyłączone"
|
|
;;
|
|
*)
|
|
REGENERATE="(Re)Generate from wallpaper colors..."
|
|
REGENERATEALL="Regenerate all"
|
|
ASCONFIGURED="as configured"
|
|
REVERSE="reverse"
|
|
CURRENTCONF="Current configuration"
|
|
MODULES="Modules"
|
|
FONTS="Configure <b>Fonts</b>"
|
|
_PICOM="<b>Compositor</b> settings <b>(Picom)</b>"
|
|
OBTHEME="<b>Openbox</b> Theme"
|
|
MENUPANELS="<b>Menus/SidePanels</b>"
|
|
COLORIZER_CONKY="<b>Conky</b> Widget <b>Manager</b>"
|
|
CAVA="Cava - Audio Visualizer"
|
|
TERMINALTHEME="Terminal color scheme"
|
|
RANDWALL="Set random wallpaper"
|
|
SYSWALLPAPER="<b>System</b> Wallpapers"
|
|
USERWALLPAPER="<b>User</b> Wallpapers"
|
|
GRADIENTS="Gradients"
|
|
PRE_GRADIENTS="Gradients"
|
|
GRAD_OB="Apply to OpenBox theme?"
|
|
GRAD_MENU="Apply to Menu/Panels?"
|
|
GRAD_CONKY="Apply to Conkies?"
|
|
SETTINGS_AND_HELP="Settings and Help"
|
|
SETTINGS="Settings"
|
|
COLORIZER_SETTINGS="Colorizer Settings"
|
|
GRADIENTS_ACT="Gradients in Rootmenu actions"
|
|
EDITCONF="Edit config file"
|
|
RESET="Reset to defaults"
|
|
YES="Yes"
|
|
NO="No"
|
|
LIGHTBG="with <b>light</b> background"
|
|
DARKBG="with <b>dark</b> background"
|
|
OTHERTOOLS="Related tools"
|
|
ADDLAUNCHER="Add Colorizer launcher to panel"
|
|
DELETELAUNCHER="Delete Colorizer from panel"
|
|
HEIGHT="Height of Colorizer"
|
|
FULL="full"
|
|
COMPACT="compact"
|
|
OTHER_SETTINGS="Other settings"
|
|
SHOW_RELATED="Show related tools?"
|
|
SHOW="show"
|
|
HIDE="hide"
|
|
EDIT_RELATED="Edit related tools"
|
|
RESET_RELATED="Reset related tools"
|
|
LXAPPEARANCE="GTK theme and icons"
|
|
THEMEMANAGER="Theme manager"
|
|
WALLPAPERS="Wallpapers directories"
|
|
OPENDIR="Open directory in file manager"
|
|
OPENDIR_VIEWNIOR="Open directory in Image viewer"
|
|
SETRANDOM="Set random"
|
|
CHANGE="Change"
|
|
USERDIR_NOT_EXIST="directory does not exist"
|
|
CREATE_USERDIR="Create directory"
|
|
DIFF_CONKY_COLORS="Different colors for each Conky"
|
|
HELP="Main Window and Help"
|
|
RESET_COLORS="Reset Colors"
|
|
RESET_CHOOSE="Reset..."
|
|
RESET_SEP="Reset Colors of ..."
|
|
RES_OB_WD="OpenBox Window Decorations"
|
|
RES_CONKY="Conkies"
|
|
RES_MENU="Menus / Panels"
|
|
RES_ALL="All <i>(OB, menus, conky)</i>"
|
|
COLORIZE="Quickly Colorize or Reset..."
|
|
_LEFTSIDEPANEL="Left Sidepanel"
|
|
_WALL_DESK_MENU="Wallpaper & Desktop <b>styling</b> menu"
|
|
|
|
_AUTOTHEMING="Auto theming (beta)"
|
|
_ON_WP_CHANGE="(on wallpaper change)"
|
|
_AUTOTH_SETTINGS="Auto theming settings"
|
|
_APPLY_COLORSCHEME_TO="Apply wallpaper colors to..."
|
|
_APPLY_TO_ALL="<b>All</b> elements"
|
|
_APPLY_REVERSE="<b>All</b> elements inversely (dark 易 light)"
|
|
_APPLY_ONLY_TO="Apply only to..."
|
|
_RESET_WP_THEMES="Reset (wallpaper and themes)"
|
|
_ENABLED="enabled"
|
|
_DISABLED="disabled"
|
|
_LIGHTBG="<b>light</b> variant"
|
|
_DARKBG="<b>dark</b> variant"
|
|
_NONE="<b>none</b> (disabled)"
|
|
;;
|
|
esac
|
|
|
|
if [ ! -f $CUSTOM_COMMANDS_FILE ]; then
|
|
cat <<EOF > ${CUSTOM_COMMANDS_FILE}
|
|
^sep($OTHERTOOLS)
|
|
Tint2 Menu,^pipe(jgtint2-pipe)
|
|
#$WALLPAPERS,^pipe(jgwallpaperchanger)
|
|
$TERMINALTHEME,^term(theme.sh -i2;/bin/bash)
|
|
$LXAPPEARANCE,lxappearance
|
|
$THEMEMANAGER,mb-obthemes
|
|
Color Menu,colormenu
|
|
EOF
|
|
fi
|
|
|
|
WALLPALDIR="$HOME/.cache/colorizer/palettes"
|
|
mkdir -p "$WALLPALDIR"
|
|
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | tail -1 | cut -d'=' -f2)
|
|
|
|
NAME=${WALLPATH////_}
|
|
if [[ "${NAME}" =~ ^_home_.* ]]; then
|
|
n=${#HOME}
|
|
((n++))
|
|
NAME=${NAME:${n}}
|
|
fi
|
|
ext="${WALLPATH##*.}"
|
|
|
|
if [ ! -f "$WALLPALDIR/$NAME.clr" ]; then
|
|
if [ "$ext" == "avif" ];then
|
|
magick ${WALLPATH} -resize 25% /tmp/out.jpg
|
|
magick /tmp/out.jpg -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
|
|
else
|
|
magick ${WALLPATH} -resize 25% -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
|
|
fi
|
|
fi
|
|
mapfile -t w < "$WALLPALDIR/$NAME.clr"
|
|
|
|
|
|
if [[ "${#w[@]}" -lt 8 ]]; then
|
|
w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
|
|
fi
|
|
|
|
#Accent colors
|
|
plasma=("#e93a9a" "#e93d58" "#e9643a" "#e8cb2d" "#3dd425" "#00d3b8" "#3daee9" "#b875dc" "#926ee4" "#686b6f")
|
|
ubuntu=("#E95420" "#18b0b0" "#3584e4" "#0e8420" "#c748ba" "#77216f" "#c7162b" "#f4a100")
|
|
mint+=("#6cabcd" "#5b73c4" "#aa876a" "#9d9d9d" "#db9d61" "#c76199" "#8c6ec9" "#c15b58" "#c8ac69" "#5aaa9a")
|
|
|
|
|
|
out+=("^sep(Mabox Colorizer)")
|
|
out+=(" $COLORIZE,^pipe(randomizer c)")
|
|
out+=("^sep($MODULES)")
|
|
out+=("$OBTHEME,colorizer-ob -s")
|
|
|
|
#out+=("TINT2,colorizer-tint2 -s")
|
|
out+=("$MENUPANELS,colorizer-menus -s")
|
|
out+=("$COLORIZER_CONKY,colorizer-conky -s")
|
|
out+=("^sep()")
|
|
#out+=("Systray HW monitor,^pipe(colorizer-phwmon)")
|
|
|
|
#if pgrep -f pyradio >/dev/null ;then
|
|
# out+=("^sep()")
|
|
out+=("PyRadio,colorizer-pyradio -s")
|
|
#fi
|
|
|
|
#if pgrep -f cava >/dev/null ;then
|
|
# out+=("^sep()")
|
|
out+=("$CAVA,colorizer-cava -s")
|
|
#fi
|
|
|
|
out+=("^sep()")
|
|
out+=("<big></big> $FONTS,colorizer-fonts -s")
|
|
out+=("$_PICOM,jgpicom-pipe -s")
|
|
|
|
|
|
### TODO Rework below as submenu(edit palette and present palette with HTML helper- to keep it on desktop, allowing to copy colors from it)
|
|
|
|
##out+=("^sep()")
|
|
##out+=(" $EDIT_PALETTE,xdg-open $WALLPALDIR/$WALLPAPER.clr")
|
|
|
|
### AUTOTHEMING
|
|
COLORIZER_CONF="$HOME/.config/colorizer/colorizer.conf"
|
|
source ${COLORIZER_CONF}
|
|
|
|
out+=("^sep($_AUTOTHEMING)")
|
|
out+=("^sep(<i><small>$_ON_WP_CHANGE</small></i>)")
|
|
|
|
out+=("<big></big> $_APPLY_COLORSCHEME_TO,^checkout(applyto)")
|
|
out2+=("^tag(applyto)")
|
|
out2+=("^sep($_APPLY_COLORSCHEME_TO)")
|
|
out2+=("<big></big> $_APPLY_TO_ALL,w2theme colorize;$me applyto")
|
|
out2+=("<big>敏</big> $_APPLY_REVERSE,w2theme reverse;$me applyto")
|
|
out2+=("^sep($_APPLY_ONLY_TO)")
|
|
out2+=("^sep(Menu)")
|
|
out2+=(" $_LIGHTBG,w2theme menu light;$me applyto")
|
|
out2+=(" $_LIGHTBG 2,w2theme menu light2;$me applyto")
|
|
out2+=(" $_DARKBG,w2theme menu dark;$me applyto")
|
|
out2+=(" $_DARKBG 2,w2theme menu dark2;$me applyto")
|
|
out2+=("^sep(Conky)")
|
|
out2+=(" $_LIGHTBG,w2theme conky light;$me applyto")
|
|
out2+=(" $_DARKBG,w2theme conky dark;$me applyto")
|
|
out2+=("^sep(OpenBox)")
|
|
out2+=(" $_LIGHTBG,w2theme ob light;$me applyto")
|
|
out2+=(" $_DARKBG,w2theme ob dark;$me applyto")
|
|
|
|
|
|
out+=("^sep()")
|
|
|
|
|
|
[[ "$wall2themes" == "yes" ]] && out+=("<big></big> $_AUTOTH_SETTINGS,^checkout(autotheming)") || out+=("<big></big> $_AUTOTH_SETTINGS,^checkout(autotheming)")
|
|
|
|
out2+=("^tag(autotheming)")
|
|
out2+=("^sep($_AUTOTH_SETTINGS (beta))")
|
|
[[ "$wall2themes" == "yes" ]] && out2+=("<big>綠</big> $_ENABLED") || out2+=("<big>祿</big> $_ENABLED,mb-setvar wall2themes=yes $COLORIZER_CONF;$me")
|
|
[[ "$wall2themes" != "yes" ]] && out2+=("<big>綠</big> $_DISABLED") || out2+=("<big>祿</big> $_DISABLED,mb-setvar wall2themes=no $COLORIZER_CONF;$me")
|
|
|
|
out2+=("^sep(<i>OpenBox</i>)")
|
|
[[ "$wall2themes_ob" == "light" ]] && out2+=("<big>綠</big> $_LIGHTBG") || out2+=("<big>祿</big> $_LIGHTBG,mb-setvar wall2themes_ob=light $COLORIZER_CONF;$me autoth")
|
|
[[ "$wall2themes_ob" == "dark" ]] && out2+=("<big>綠</big> $_DARKBG") || out2+=("<big>祿</big> $_DARKBG,mb-setvar wall2themes_ob=dark $COLORIZER_CONF;$me autoth")
|
|
out2+=("^sep()")
|
|
[[ "$wall2themes_ob" == "none" ]] && out2+=("<big>綠</big> $_NONE") || out2+=("<big>祿</big> $_NONE,mb-setvar wall2themes_ob=none $COLORIZER_CONF;$me autoth")
|
|
out2+=("^sep(<i>Menu</i>)")
|
|
[[ "$wall2themes_menu" == "light" ]] && out2+=("<big>綠</big> $_LIGHTBG") || out2+=("<big>祿</big> $_LIGHTBG,mb-setvar wall2themes_menu=light $COLORIZER_CONF;$me autoth")
|
|
[[ "$wall2themes_menu" == "dark" ]] && out2+=("<big>綠</big> $_DARKBG") || out2+=("<big>祿</big> $_DARKBG,mb-setvar wall2themes_menu=dark $COLORIZER_CONF;$me autoth")
|
|
out2+=("^sep()")
|
|
[[ "$wall2themes_menu" == "none" ]] && out2+=("<big>綠</big> $_NONE") || out2+=("<big>祿</big> $_NONE,mb-setvar wall2themes_menu=none $COLORIZER_CONF;$me autoth")
|
|
out2+=("^sep(<i>Conky</i>)")
|
|
[[ "$wall2themes_conky" == "light" ]] && out2+=("<big>綠</big> $_LIGHTBG") || out2+=("<big>祿</big> $_LIGHTBG,mb-setvar wall2themes_conky=light $COLORIZER_CONF;$me autoth")
|
|
[[ "$wall2themes_conky" == "dark" ]] && out2+=("<big>綠</big> $_DARKBG") || out2+=("<big>祿</big> $_DARKBG,mb-setvar wall2themes_conky=dark $COLORIZER_CONF;$me autoth")
|
|
out2+=("^sep()")
|
|
[[ "$wall2themes_conky" == "none" ]] && out2+=("<big>綠</big> $_NONE") || out2+=("<big>祿</big> $_NONE,mb-setvar wall2themes_conky=none $COLORIZER_CONF;$me autoth")
|
|
|
|
out2+=("^sep(PyRadio / Cava)")
|
|
out2+=("PyRadio and Cava,^checkout(pycava)")
|
|
out3+=("^tag(pycava)")
|
|
out3+=("^sep(Pyradio)")
|
|
[[ "$wall2themes_pyradio" == "light" ]] && out3+=("<big>綠</big> $_LIGHTBG") || out3+=("<big>祿</big> $_LIGHTBG,mb-setvar wall2themes_pyradio=light $COLORIZER_CONF;$me autoth")
|
|
[[ "$wall2themes_pyradio" == "dark" ]] && out3+=("<big>綠</big> $_DARKBG") || out3+=("<big>祿</big> $_DARKBG,mb-setvar wall2themes_pyradio=dark $COLORIZER_CONF;$me autoth")
|
|
out3+=("^sep()")
|
|
[[ "$wall2themes_pyradio" == "none" ]] && out3+=("<big>綠</big> $_NONE") || out3+=("<big>祿</big> $_NONE,mb-setvar wall2themes_pyradio=none $COLORIZER_CONF;$me autoth")
|
|
out3+=("^sep(Cava)")
|
|
out3+=("^sep(<small><i>not implemented yet</i></small>)")
|
|
out3+=("Use Colorizer Cava,colorizer-cava -s")
|
|
|
|
|
|
palettes=$(shopt -s nullglob ; set -- $WALLPALDIR/*.clr ; echo $#)
|
|
if [[ "$palettes" -gt "1" ]];then
|
|
out2+=("^sep()")
|
|
out2+=("<big></big> Remove cached palletes (<b>$palettes</b>),rm $WALLPALDIR/*.clr;$me")
|
|
fi
|
|
|
|
|
|
|
|
out+=("^sep()")
|
|
out+=("<big></big> $_RESET_WP_THEMES,w2theme resetall;$me")
|
|
|
|
|
|
|
|
out+=("^sep()")
|
|
out+=("<big></big> $RANDWALL,mbwallpaper -o;colorizer -s")
|
|
out+=("<big></big> $_WALL_DESK_MENU,jgwallpaperchanger -s")
|
|
|
|
if [[ "$gradient_obtheme" == "yes" || "$gradient_menu" == "yes" ]];then
|
|
[[ "$gradient_obtheme" == "yes" ]] && OBGRAD="OB" || OBGRAD=""
|
|
[[ "$gradient_menu" == "yes" ]] && MENUGRAD="menus" || MENUGRAD=""
|
|
out+=("^sep($GRADIENTS <small>$OBGRAD $MENUGRAD</small>)")
|
|
out+=("<tt><span bgcolor='#16a084'> </span><span bgcolor='#43a480'> </span><span bgcolor='#5da97b'> </span><span bgcolor='#72ad77'> </span><span bgcolor='#84b171'> </span><span bgcolor='#95b66c'> </span><span bgcolor='#a5ba66'> </span><span bgcolor='#b5be61'> </span><span bgcolor='#c3c15a'> </span><span bgcolor='#d1c753'> </span><span bgcolor='#dfc94c'> </span><span bgcolor='#edce44'> </span><span bgcolor='#f4d03f'> </span></tt> $PRE_GRADIENTS,^pipe(mbgrad)")
|
|
fi
|
|
|
|
out+=("^sep($SETTINGS)")
|
|
out+=(" $SETTINGS,^checkout(settings)")
|
|
LNG=${LANG:0:2}
|
|
if [[ -f "/usr/share/mabox-colorizer/help/$LNG.html" ]];then
|
|
out+=(" $HELP,yhtml /usr/share/mabox-colorizer/help/$LNG.html 'Mabox Colorizer'")
|
|
else
|
|
out+=(" $HELP,yhtml /usr/share/mabox-colorizer/help/en.html 'Mabox Colorizer'")
|
|
fi
|
|
out+=("^sep()")
|
|
out+=(" ${arrow_string_left} ${arrow_string_left} $_LEFTSIDEPANEL,mb-jgtools places")
|
|
|
|
|
|
### RESET ACTIONS (replaced by Randomizer)
|
|
#out+=("^sep($RESET_COLORS)")
|
|
#out+=("$RESET_CHOOSE,^checkout(resetroot)")
|
|
#out2+=("^tag(resetroot)")
|
|
#out2+=("^sep($RESET_SEP)")
|
|
#out2+=("$RES_OB_WD,obtctl resetMBcolors;colorizer -s")
|
|
#out2+=("$RES_MENU,jgctl reset;colorizer -s")
|
|
#out2+=("$RES_CONKY,conkyctl resetcolorsall;colorizer -s")
|
|
#out2+=("^sep()")
|
|
#out2+=("\"\"\"$RES_ALL\"\"\",obtctl resetMBcolors;conkyctl resetcolorsall;jgctl reset;colorizer -s")
|
|
|
|
if [[ "$related_tools" == "show" ]];then
|
|
out+=(". $CUSTOM_COMMANDS_FILE")
|
|
fi
|
|
### FUTURE: SAVE AND RESTORE
|
|
#out+=("^sep()")
|
|
#out+=("Pin current colors to wallpaper")
|
|
###
|
|
|
|
out2+=("^tag(settings)")
|
|
|
|
|
|
out2+=("^sep($GRADIENTS_ACT)")
|
|
[[ "$gradient_obtheme" == "yes" ]] && out2+=("<big></big> $GRAD_OB,mb-setvar gradient_obtheme=no $CNF_FILE;colorizer -s") || out2+=("<big></big> $GRAD_OB,mb-setvar gradient_obtheme=yes $CNF_FILE;colorizer -s")
|
|
#out2+=("$GRAD_OB [ <b>${gradient_obtheme}</b> ],^checkout(grad_ob)")
|
|
#out3+=("^tag(grad_ob")
|
|
#out3+=("^sep($GRAD_OB)")
|
|
#out3+=("$YES,mb-setvar gradient_obtheme=yes $CNF_FILE;colorizer -s")
|
|
#out3+=("$NO,mb-setvar gradient_obtheme=no $CNF_FILE;colorizer -s")
|
|
|
|
[[ "$gradient_menu" == "yes" ]] && out2+=("<big></big> $GRAD_MENU,mb-setvar gradient_menu=no $CNF_FILE;colorizer -s") || out2+=("<big></big> $GRAD_MENU,mb-setvar gradient_menu=yes $CNF_FILE;colorizer -s")
|
|
#out2+=("$GRAD_MENU [ <b>${gradient_menu}</b> ],^checkout(grad_menu)")
|
|
#out3+=("^tag(grad_menu")
|
|
#out3+=("^sep($GRAD_MENU)")
|
|
#out3+=("$YES,mb-setvar gradient_menu=yes $CNF_FILE;colorizer -s")
|
|
#out3+=("$NO,mb-setvar gradient_menu=no $CNF_FILE;colorizer -s")
|
|
#out2+=("$GRAD_CONKY [ <b>${gradient_conkies}</b> ],^checkout(grad_conky)")
|
|
#out3+=("^tag(grad_conky")
|
|
#out3+=("^sep($GRAD_CONKY)")
|
|
#out3+=("$YES,mb-setvar gradient_conkies=yes $CNF_FILE;colorizer -s")
|
|
#out3+=("$NO,mb-setvar gradient_conkies=no $CNF_FILE;colorizer -s")
|
|
|
|
out2+=("^sep($OTHER_SETTINGS)")
|
|
#out2+=("^sep($COLORIZER_SETTINGS)")
|
|
#if [[ -f "$HOME/.config/tint2/launcherapps/colorizer.desktop" ]]; then
|
|
#out2+=("$DELETELAUNCHER,rm ~/.config/tint2/launcherapps/colorizer.desktop;killall -SIGUSR1 tint2;colorizer -s")
|
|
#else
|
|
#out2+=("$ADDLAUNCHER,cp /usr/share/applications/colorizer.desktop ~/.config/tint2/launcherapps/;killall -SIGUSR1 tint2;colorizer -s")
|
|
#fi
|
|
|
|
out2+=("$HEIGHT [ <b>${colorizer_size}</b> ],^checkout(csize)")
|
|
out3+=("^tag(csize)")
|
|
out3+=("^sep($HEIGHT)")
|
|
out3+=("$FULL,mb-setvar colorizer_size=full $CNF_FILE;colorizer -s")
|
|
out3+=("$COMPACT,mb-setvar colorizer_size=compact $CNF_FILE;colorizer -s")
|
|
[[ "$related_tools" == "show" ]] && out2+=("<big></big> $SHOW_RELATED,^checkout(related)") || out2+=("<big></big> $SHOW_RELATED,^checkout(related)")
|
|
out3+=("^tag(related)")
|
|
out3+=("^sep($SHOW_RELATED)")
|
|
[[ "$related_tools" == "show" ]] && out3+=("<big>綠</big> $SHOW,colorizer -s" "<big>祿</big> $HIDE,mb-setvar related_tools=hide $CNF_FILE;colorizer -s") || out3+=("<big>祿</big> $SHOW,mb-setvar related_tools=show $CNF_FILE;colorizer -s" "<big>綠</big> $HIDE,colorizer -s")
|
|
out3+=("^sep()")
|
|
out3+=(" $EDIT_RELATED,xdg-open $CUSTOM_COMMANDS_FILE")
|
|
out3+=(" $RESET_RELATED,rm $CUSTOM_COMMANDS_FILE;colorizer -s")
|
|
out2+=("^sep()")
|
|
out2+=(" $EDITCONF,xdg-open $CNF_FILE")
|
|
out2+=(" $RESET,rm $CNF_FILE;colorizer -s")
|
|
|
|
|
|
### RUN
|
|
if [[ "$1" == "-s" ]]; then
|
|
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
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_PADDING_TOP=${jgtools_padding:-0}
|
|
MENU_HALIGN="left"
|
|
jgmenu_icon_size=0
|
|
TABS=180
|
|
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
[ -z $jgmenu_use_borders ] && menu_border=0
|
|
JGWIDTH=$((jgtools_padding + 270 + jgtools_padding))
|
|
MENU_PADDING_TOP=$((jgtools_padding + 152))
|
|
|
|
THUMBDIR="$HOME/.cache/colorizer/thumbs"
|
|
mkdir -p ${THUMBDIR}
|
|
THUMB="${THUMBDIR}/${NAME}.png"
|
|
if [[ ! -f "$THUMB" ]]
|
|
then
|
|
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
|
|
fi
|
|
# colors on image
|
|
n=0
|
|
m=0
|
|
X=$((jgtools_padding + 3))
|
|
Y=$((jgtools_padding + 122))
|
|
for i in "${w[@]}"
|
|
do
|
|
if [[ "$n" -lt "12" ]];then
|
|
dots+=("@rect,,$((X + 22*n)),$((Y)),21,21,10,left,top,#CCCCCC 100,${i} 100,")
|
|
else
|
|
dots+=("@rect,,$((X + 7 + 21*m)),$((Y+20)),26,26,13,left,top,#CCCCCC 100,${i} 100,")
|
|
((m=m+1))
|
|
fi
|
|
((n=n+1))
|
|
done
|
|
|
|
mkconfigfile
|
|
#THUMB="$(DISPLAY=:0 scrot -t 220x100 -o $HOME/.config/mabox/colorizer.png -e 'echo $m')"
|
|
|
|
if [[ "$wall2themes" == "yes" ]]; then
|
|
AUTOTHEME_IND="
|
|
@rect,,$((jgtools_padding+4)),$((jgtools_padding + 6)),262,20,0,left,top,#222222 20,#222222 70,
|
|
@text,,$((jgtools_padding+8)),$((jgtools_padding + 6)),262,22,0,left,top,#FFFFFF,#222222 70, <span fgcolor='white'><big></big> </span> Auto theming <b><i>$_ENABLED</i></b> !
|
|
"
|
|
fi
|
|
|
|
cat <<EOF > ${MENU_ITEMS}
|
|
@icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
|
|
${AUTOTHEME_IND}
|
|
@rect,,$((jgtools_padding+2)),$((jgtools_padding + 100)),266,34,0,left,top,#222222 20,#222222 70,
|
|
@text,,$((jgtools_padding + 12)),$((jgtools_padding + 96)),120,30,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'>Mabox <b>Colorizer</b></span>
|
|
$(printf '%s\n' "${dots[@]}")
|
|
#@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 34)),270,120,4,left,top,,,/usr/share/mabox-colorizer/img/colorizer.png
|
|
$(printf '%s\n' "${out[@]}")
|
|
$(printf '%s\n' "${out2[@]}")
|
|
$(printf '%s\n' "${out3[@]}")
|
|
EOF
|
|
|
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} ${options} 2>/dev/null
|
|
exit 0
|
|
fi
|
|
printf '%s\n' "${out[@]}"
|
|
printf '%s\n' "${out2[@]}"
|
|
printf '%s\n' "${out3[@]}"
|