mb-obthemes take care of menu/sidepanels settings

master
Daniel Napora 2020-09-21 12:23:52 +02:00
parent 83e8e48944
commit eb8b75e395
2 changed files with 17 additions and 5 deletions

View File

@ -613,7 +613,10 @@ function getGTKname(){ # get GTK theme name
echo -e "\n Zapisano $TXT" echo -e "\n Zapisano $TXT"
echo "$TXT" >> "$LISTMSG" echo "$TXT" >> "$LISTMSG"
} }
function getMenuPanel() {
echo "configdir: $CONFIGDIR"
cp "$HOME"/.config/mabox/mabox.conf "$CONFIGDIR"/
}
function checkTint2(){ # kill or restart tint2s for screenshot, if necessary function checkTint2(){ # kill or restart tint2s for screenshot, if necessary
if [[ $1 = stop ]];then if [[ $1 = stop ]];then
if ! cat "$SETTINGS" | grep "TINT2" &>/dev/null;then if ! cat "$SETTINGS" | grep "TINT2" &>/dev/null;then
@ -737,7 +740,9 @@ function restoreGTK(){ # $1 is chosen saved config dir
i=$(($i+1)) i=$(($i+1))
done done
} }
function restoreMenuPanel() {
cp -a $1/mabox.conf $HOME/.config/mabox/mabox.conf
}
function restoreOBrc(){ function restoreOBrc(){
RCFILE="$OBPATH/rc.xml" RCFILE="$OBPATH/rc.xml"
THEMEFILE="$1/obtheme.txt" THEMEFILE="$1/obtheme.txt"
@ -887,6 +892,8 @@ function saveSettings(){
;; ;;
esac esac
done done
#save menu/panel settings
getMenuPanel
SLOOP=0 SLOOP=0
fi fi
fi fi
@ -1091,6 +1098,7 @@ function restoreSettings(){
done < "$SETCFG" done < "$SETCFG"
openbox --reconfigure openbox --reconfigure
#mb-regenerate-menu #mb-regenerate-menu
restoreMenuPanel "$FPATH"
restoreSettings restoreSettings
} }

View File

@ -6,6 +6,8 @@
if [[ $# < 1 ]]; then if [[ $# < 1 ]]; then
self=$(basename $0) self=$(basename $0)
echo "Usage: $self variable=value [/PATH/TO/CONFIG_FILE]" echo "Usage: $self variable=value [/PATH/TO/CONFIG_FILE]"
echo "Current configuration:"
cat $HOME/.config/mabox/mabox.conf
exit 2 exit 2
fi fi
if [[ $1 != *"="* ]]; then if [[ $1 != *"="* ]]; then
@ -15,13 +17,15 @@ if [[ $1 != *"="* ]]; then
fi fi
FILE=${2:-$HOME/.config/mabox/mabox.conf} FILE=${2:-$HOME/.config/mabox/mabox.conf}
echo $1
search=$(echo $1|cut -d= -f1) search=$(echo $1|cut -d= -f1)
if [[ $search =~ "bottom_img" ]]; then
sed -i /^"$search="/d $FILE
fi
if grep -Rq $search $FILE if grep -Rq $search $FILE
then #found then #found
sed -i s/^"$search=".*$/"$1"/ $FILE sed -i s/^"$search=".*$/"$1"/ $FILE
else #not found else #not found
echo $1 >> $FILE echo $1 >> $FILE
fi fi
cat $FILE