I want to write a script that translates devilspie
's window rules into compiz' rules. Compiz settings can be changed by gsettings
keys in path org.compiz.profiles.unity.plugins.place
. There are three keys: viewport-matches
, viewport-x-values
and viewport-y-values
. Unfortunately each key is an array, and the index of the elements matters.
Gsettings
lacks any support of array
types other than rewriting whole array at once, and I need to place item in the array at the specific location (say, at the beginning, index '1').
I know, that if I don't care about the index, I can use
gsettings set ${schema} ${key} \"`gsettings get ${schema} ${key} | sed s/.$//`, ${value}]\"
The question complements How to remove element from gsettings array in script?
The following python3 script will insert new element(s) at a given index:
You can also do this via a bash script: