From 0bbc0fab238b87307cfe8de16a36c454ddcbbe09 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 19 Jan 2023 01:32:14 +0100 Subject: [PATCH] thumbdir --- bin/mb-jgtools | 53 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/bin/mb-jgtools b/bin/mb-jgtools index bb973fd..cadeb8f 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -1,7 +1,7 @@ #!/bin/bash # # mb-jgtools: Menu, Sidepanels, Screenshot Tool and Exit Dialog for Mabox -# Copyright (C) 2019-2022 Daniel Napora +# Copyright (C) 2019-2023 Daniel Napora . $HOME/.config/mabox/mabox.conf jgmenu_theme=${jgmenu_theme:-obtheme} @@ -25,7 +25,7 @@ item_height_factor=${item_height_factor:-200} gtkbookmarks() { if [ $places_bookmarks == true ]; then - BOOKMARKS="$HOME/.gtk-bookmarks" + BOOKMARKS="$HOME/.config/gtk-3.0/bookmarks" if [[ -s "$BOOKMARKS" ]]; then case $LANG in pl*) GTK_BOOKMARKS="Zakładki";; @@ -443,17 +443,23 @@ esac if [ $panels_heightpos == "full" ]; then -WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" -mkdir -p "$WALLPALDIR" + read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) -WALLPAPER=${WALLPATH##*/} -THUMBDIR="$HOME/.config/mabox/wallthumbs" -mkdir -p ${THUMBDIR} -THUMB="${THUMBDIR}/${WALLPAPER}.png" -if [[ ! -f "$THUMB" ]] -then - convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} -fi +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 + + JGWIDTH=$((jgtools_padding + 270 + jgtools_padding)) MENU_PADDING_TOP=$((jgtools_padding + 152)) cat < ${RHEAD} @@ -724,17 +730,20 @@ if [[ -x "$(command -v VBoxManage)" ]]; then [[ $places_vboxes == true ]] && vboxes=". $HOME/.config/mabox/vboxes.csv" || vboxes="" fi if [ $panels_heightpos == "full" ]; then -WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" -mkdir -p "$WALLPALDIR" read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) -WALLPAPER=${WALLPATH##*/} -THUMBDIR="$HOME/.config/mabox/wallthumbs" -mkdir -p ${THUMBDIR} -THUMB="${THUMBDIR}/${WALLPAPER}.png" -if [[ ! -f "$THUMB" ]] -then - convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} -fi +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 JGWIDTH=$((jgtools_padding + 270 + jgtools_padding)) MENU_PADDING_TOP=$((jgtools_padding + 152)) cat < ${LHEAD}