[Evolution] Setting evolution personalized configuration from the terminal (gsettings)



All:

I hope this is not too off-topic, but I am struggling to make a specific
Evolution Mail configuration via the terminal.
More specifically, because I once in a while distro hop or change
machines, it is relatively common for me to have to setup my evolution
manually via the GUI and/or dconf. To automate this process I am
creating a script that, among other things, set the fields I want to
personalize in org.gnome.evolution.mail (as well as calendar and
addressbook). All runs well, except for the fields with lists, which
give me a syntax error.

The personalized configuration is stored in a bash vector and a for loop
is used to feed each item to a gsettings command. A simplified version
of the script is:

#!/bin/bash
#.... comments
#.... initial setup, initialization, etc.
#....large vector with my personalized settings for evolution mail
declare -A MailSettings=(
['junk-check-custom-header']='true'
#...zillions of personalized items
['show-headers']="[('From', true), ('Reply-To', false), ('To', true),
('Cc', true), ('Bcc', true), ('Subject', true), ('Date', true),
('Newsgroups', true), ('Face', true), ('x-evolution-mailer', false)]"
)
# for loop checking the previous settings, applying the new ones, and
then showing what it did
for i in "${!MailSettings[@]}"
do
oldkey="$(gsettings get org.gnome.evolution.mail $i)" # checks the
current settings for each setting in the vector
gsettings set org.gnome.evolution.mail $i  ${MailSettings[$i]} # applies
each setting
newkey="$(gsettings get org.gnome.evolution.mail $i)"   # checks the
modified settings
printf "\e[1;34m%-6s\e[m" "$i"  # prints Key-oldValue-newValue
printf ": %s" "$oldkey"
printf " -> \e[1;33m%-6s\e[m\n" "$newkey"
done

The above works beautifully to setup any configuration in evolution,
except for 'show-headers', 'labels' and others that require a list as
parameter.
If I copy and paste the command gsettings set or.gnome.evolution.mail
show-headers VALUE it works ok, but none of the many syntax variations I
tried within this script worked, including creating another vector for
each setting (e.g. LABELS or ShowHEADERS).
My best guess is that the for loop is not substituting the vector
element in away that bash understands, but after searching and reading a
lot on this I was not able to find out how to do it.
Any directions would be greatly appreciated.

Thanks,
Paulo
evolution 3.36.1,
kernel 5.6.3.2, bash 5.0.16,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]