You are not logged in.
Pages: 1
In the past I had the idea to save all xfce settings like this:
#!/bin/sh
xfconf-query -c displays -lv > $(pwd)/displays.txt
xfconf-query -c keyboard-layout -lv > $(pwd)/keyboard-layout.txt
xfconf-query -c keyboards -lv > $(pwd)/keyboards.txt
xfconf-query -c pointers -lv > $(pwd)/pointers.txt
xfconf-query -c ristretto -lv > $(pwd)/ristretto.txt
xfconf-query -c thunar -lv > $(pwd)/thunar.txt
xfconf-query -c thunar-volman -lv > $(pwd)/thunar-volman.txt
xfconf-query -c xfce4-appfinder -lv > $(pwd)/xfce4-appfinder.txt
xfconf-query -c xfce4-desktop -lv > $(pwd)/xfce4-desktop.txt
xfconf-query -c xfce4-keyboard-shortcuts -lv > $(pwd)/xfce4-keyboard-shortcuts.txt
xfconf-query -c xfce4-notifyd -lv | grep -v known > $(pwd)/xfce4-notifyd.txt
xfconf-query -c xfce4-panel -lv | grep -v known > $(pwd)/xfce4-panel.txt
xfconf-query -c xfce4-power-manager -lv > $(pwd)/xfce4-power-manager.txt
xfconf-query -c xfce4-screensaver -lv > $(pwd)/xfce4-screensaver.txt
xfconf-query -c xfce4-session -lv > $(pwd)/xfce4-session.txt
xfconf-query -c xfce4-settings-editor -lv > $(pwd)/xfce4-settings-editor.txt
xfconf-query -c xfce4-settings-manager -lv > $(pwd)/xfce4-settings-manager.txt
xfconf-query -c xfce4-taskmanager -lv > $(pwd)/xfce4-taskmanager.txt
xfconf-query -c xfce4-terminal -lv > $(pwd)/xfce4-terminal.txt
xfconf-query -c xfwm4 -lv > $(pwd)/xfwm4.txt
xfconf-query -c xsettings -lv > $(pwd)/xsettings.txt
The idea was to make it more readable then the files in ~/.config/xfce4 and make it easier to see changes in git.
If I needed to restore a setting, I could view the old value there.
But now I needed to restore all values and I didn't save ~/.config/xfce4....
I created a restore script for this. I just share it here if someone else needs it, but only use this if really needed and at your own risk.
#!/bin/bash
# remove custom shortcuts and panels
xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom -Rr
xfconf-query -c xfce4-panels -p /panels -Rr
xfconf-query -c xfce4-panels -p /plugins -Rr
channels="displays keyboard-layout keyboards pointers ristretto thunar thunar-volman \
xfce4-appfinder xfce4-desktop xfce4-keyboard-shortcuts xfce4-notifyd xfce4-panel \
xfce4-power-manager xfce4-screensaver xfce4-session xfce4-settings-editor \
xfce4-settings-manager xfce4-taskmanager xfce4-terminal xfwm4 xsettings"
detect_type() {
local val="$1"
if [[ "$val" =~ ^(true|false)$ ]]; then
echo "bool"
elif [[ "$val" =~ ^-?[0-9]+$ ]]; then
echo "int"
elif [[ "$val" =~ ^-?[0-9]*\.[0-9]+$ ]]; then
echo "double"
else
echo "string"
fi
}
for channel in $channels; do
config_file="$channel.txt"
if [ -f "$config_file" ]; then
echo "Applying settings from $config_file to channel $channel"
while IFS= read -r line || [ -n "$line" ]; do
# Skip empty lines and comments
[ -z "$line" ] && continue
echo "$line" | grep -qE '^\s*#' && continue
prop=$(echo "$line" | awk '{print $1}')
value=$(echo "$line" | cut -d' ' -f2- | sed 's/^[[:space:]]*//')
# Check if it's an array (starts with [ and ends with ])
if echo "$value" | grep -q '^\[.*\]$'; then
# Strip square brackets
array_content=$(echo "$value" | sed -e 's/^\[//' -e 's/\]$//')
IFS=',' read -r -a elements <<< "$array_content"
# Prepare type flags and values
args=()
for element in "${elements[@]}"; do
element=$(echo "$element" | xargs) # trim
vtype=$(detect_type "$element")
args+=("-t" "$vtype" "-s" "$element")
done
xfconf-query -c "$channel" -p "$prop" -a -n "${args[@]}"
else
vtype=$(detect_type "$value")
xfconf-query -c "$channel" -p "$prop" -t "$vtype" -s "$value" -n
fi
done < "$config_file"
else
echo "Config file '$config_file' does not exist."
fi
done
Offline
Pages: 1
[ Generated in 0.004 seconds, 7 queries executed - Memory usage: 532.31 KiB (Peak: 541.56 KiB) ]