7

I want to reset all keys in the GSettings to their default values; preferably using a single command, or a simple bash script. How can I get that done?

rusty
  • 15,770
  • 11
  • 65
  • 92

3 Answers3

8

Generally you can reset one key to its default value with

gsettings reset SCHEMA [:PATH]  KEY

So you might use a bash script to do for all available keys.
Something like (pseudocode):

for i in /dir/of/keys
do
    gsettings reset <key-path>
done

Look at its man-page for more information: man gsettings

Volker Siegel
  • 12,820
  • 5
  • 48
  • 65
Raja G
  • 100,643
  • 105
  • 254
  • 328
4

The following will reset all those settings which are "non-relocatable". That is, the ones that are stored at a standard location and hence do not need an extra path specified after them. For example it will reset all keys of org.gnome.eog.fullscreen, but none of org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/. It only does so for the user executing it.

gsettings list-schemas | xargs -n 1 gsettings reset-recursively

noname
  • 41
  • 1
1

I had the same problem with some media keys,they just worked sometimes so i needed to reboot or reset them manually with dconf-editor or gsettings.

maybe you could do a bash script like this

#!/bin/bash
#To get in a list all the keys of that directory
list=$(gsettings list-keys <keys-path-directory>); 
for i in $list; do
    echo "resetting $i";
    gsettings reset <keys-path-directory> $i;
done
cshjsc
  • 11
  • 2