cache_dir for thumbs and palletes changed

master 0.9.29
Daniel Napora 2023-01-18 23:58:47 +01:00
parent d6d5c85b29
commit 0fa2536dac
7 changed files with 200 additions and 38 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# colorizer - set of tools for Mabox theming # colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022 Daniel Napora <napcok@gmail.com> # Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -50,8 +50,6 @@ gradient_obtheme=yes
# Gradients: change menu/panels background? # Gradients: change menu/panels background?
gradient_menu=no gradient_menu=no
EOF EOF
# Copy new nitrogen wrapper
cp -a /usr/share/mabox/common/wrappers/nitrogen ~/.local/bin/
fi fi
source "$CNF_FILE" source "$CNF_FILE"
@ -258,14 +256,24 @@ Color Menu,colormenu
EOF EOF
fi fi
WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR" mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then NAME=${WALLPATH////_}
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr" if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi fi
mapfile -t w < "$WALLPALDIR/$WALLPAPER.clr"
if [ ! -f "$WALLPALDIR/$NAME.clr" ]; then
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
fi
mapfile -t w < "$WALLPALDIR/$NAME.clr"
if [[ "${#w[@]}" -lt 8 ]]; then if [[ "${#w[@]}" -lt 8 ]]; then
w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4") w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
fi fi
@ -684,9 +692,9 @@ if [[ "$1" == "-s" ]]; then
JGWIDTH=$((jgtools_padding + 278 + jgtools_padding)) JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158)) MENU_PADDING_TOP=$((jgtools_padding + 158))
THUMBDIR="$HOME/.config/mabox/wallthumbs" THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR} mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png" THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]] if [[ ! -f "$THUMB" ]]
then then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}

View File

@ -1,4 +1,21 @@
#!/bin/bash #!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
me="colorizer-conky -s" me="colorizer-conky -s"
CONKYDIR="$HOME/.config/conky" CONKYDIR="$HOME/.config/conky"
@ -368,13 +385,18 @@ if [[ "$1" == "-s" ]]; then
#WALLPAPER #WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/} THUMBDIR="$HOME/.cache/colorizer/thumbs"
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR} mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png" NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]] if [[ ! -f "$THUMB" ]]
then then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi fi
mkconfigfile mkconfigfile

View File

@ -1,4 +1,24 @@
#!/bin/bash #!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
me="colorizer-menus -s" me="colorizer-menus -s"
. $HOME/.config/mabox/mabox.conf . $HOME/.config/mabox/mabox.conf
case "$jgmenu_theme" in case "$jgmenu_theme" in
@ -255,13 +275,18 @@ JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158)) MENU_PADDING_TOP=$((jgtools_padding + 158))
#WALLPAPER #WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/} THUMBDIR="$HOME/.cache/colorizer/thumbs"
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR} mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png" NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]] if [[ ! -f "$THUMB" ]]
then then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi fi
mkconfigfile mkconfigfile

View File

@ -1,4 +1,20 @@
#!/bin/bash #!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
MBCOLORSDIR="$HOME"/.themes/MBcolors/openbox-3/ MBCOLORSDIR="$HOME"/.themes/MBcolors/openbox-3/
GRADIENT_FILE="$HOME"/.config/colorizer/gradients_all.inc GRADIENT_FILE="$HOME"/.config/colorizer/gradients_all.inc
@ -388,16 +404,21 @@ JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158)) MENU_PADDING_TOP=$((jgtools_padding + 158))
# WALLPAPER IMAGE # WALLPAPER IMAGE
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/} THUMBDIR="$HOME/.cache/colorizer/thumbs"
THUMBDIR="$HOME/.config/mabox/wallthumbs" mkdir -p ${THUMBDIR}
mkdir -p ${THUMBDIR} NAME=${WALLPATH////_}
THUMB="${THUMBDIR}/${WALLPAPER}.png" if [[ "${NAME}" =~ ^_home_.* ]]; then
if [[ ! -f "$THUMB" ]] n=${#HOME}
then ((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi fi
mkconfigfile mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}

View File

@ -1,4 +1,20 @@
#!/bin/bash #!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
# TODO Start Pyradio if not started # TODO Start Pyradio if not started
# TODO check if theme is writeable (users themes) # TODO check if theme is writeable (users themes)
@ -156,13 +172,18 @@ if [[ "$1" == "-s" ]]; then
#WALLPAPER #WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/} THUMBDIR="$HOME/.cache/colorizer/thumbs"
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR} mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png" NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]] if [[ ! -f "$THUMB" ]]
then then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi fi
mkconfigfile mkconfigfile

View File

@ -1,5 +1,21 @@
#!/bin/bash #!/bin/bash
# #
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
# mbclr current polecenie funkcja argument backprg [config_file] # mbclr current polecenie funkcja argument backprg [config_file]
# mbclr # mbclr
#notify-send.sh "mbclr" "${1}\n${2}\n${3}\n${4}\n${5}\n${6}" #notify-send.sh "mbclr" "${1}\n${2}\n${3}\n${4}\n${5}\n${6}"
@ -33,14 +49,22 @@ esac
main () { main () {
#read WALLPAPER<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) #read WALLPAPER<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR" mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then NAME=${WALLPATH////_}
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr" if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi fi
mapfile -t wallcolors < "$WALLPALDIR/$WALLPAPER.clr"
if [ ! -f "$WALLPALDIR/$NAME.clr" ]; then
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
fi
mapfile -t wallcolors < "$WALLPALDIR/$NAME.clr"
if [[ "${#wallcolors[@]}" -lt 8 ]]; then if [[ "${#wallcolors[@]}" -lt 8 ]]; then
wallcolors+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4") wallcolors+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
fi fi
@ -154,6 +178,14 @@ out2+=("<tt><small>$clr</small> <span bgcolor='$clr'> </span></tt
fi fi
done done
# NOWE
out2+=("^sep(SAT)")
for i in 1 2 3 4 5 6 7 8 9; do
clr=$(pastel saturate 0.$i "${1}" | pastel format hex)
out2+=("<tt><small>$clr</small> <span bgcolor='$clr'> </span></tt>,$2 $3 '${clr}' ${6};${5}")
done
# NOWE
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"
} }

View File

@ -1,6 +1,22 @@
#!/bin/bash #!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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/>.
# w2theme - generate themes from wallpaper colors # w2theme - generate themes from wallpaper colors
WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" WALLPALDIR="$HOME/.config/colormenu/palettes/wallp"
mkdir -p "$WALLPALDIR" mkdir -p "$WALLPALDIR"
@ -330,6 +346,22 @@ reverse () {
esac esac
} }
genthumb () {
#$1 - filename with full path
NAME=${1////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
# GENERATE THUMBNAIL
THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]; then
convert ${1} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
}
pin () { pin () {
#get wallpaper path and filename without ext #get wallpaper path and filename without ext
@ -353,6 +385,7 @@ case "$1" in
gradient) gradient "$2" "$3";; gradient) gradient "$2" "$3";;
colorize) colorize;; colorize) colorize;;
reverse) reverse;; reverse) reverse;;
genthumb)genthumb "$2";;
pin) pin;; pin) pin;;
*) ;; *) ;;
esac esac