Where does Mate store the positions of desktop icons?
by RockDoctor from LinuxQuestions.org on (#50VYH)
I've got a multi-boot system (Fedora, Ubuntu, Manjaro), all running the Mate DE and all sharing the same ~/Desktop directory (but not the same home directory). I have caja set to display desktop icons. What I find is that if I add a file to my Desktop, and position it while running Fedora, if I boot up one of the other distros, the icon is no longer where I placed it. I found a script called Happy Desktop at http://https://www.gnome-look.org/p/1195331/ that apparently saves and restores everything in ~/Desktop to/from a temporary file. Bottom line - I don't understand the restore process or how to adapt it to my situation. I've can grab the filenames and icon positions using the code below. Saving that information is easy enough. At that point, I'm stuck. I don't know where that information needs to go to restore my desktop's configuration. Pointers appreciated
Thanks.
Code:#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys, subprocess
# get names
names = []
my_cmd = 'gio info ./* | grep standard::name | sed -e s/\ \ standard::name:\ //g'
p = subprocess.Popen(my_cmd, shell=True, bufsize=4096, stdout=subprocess.PIPE).stdout
line = p.readline().strip().decode()
while line:
names.append(line)
#print(line)
line = p.readline().strip().decode()
# get positions
positions=[]
my_cmd = 'gio info ./* | grep metadata::caja-icon-position: | awk \'{print $2 $3}\''
p = subprocess.Popen(my_cmd, shell=True, bufsize=4096, stdout=subprocess.PIPE).stdout
line = p.readline().strip().decode()
while "," in line:
positions.append(line)
#print(line)
line = p.readline().strip().decode()
for pdx, pos in enumerate(positions):
temp = pos.split(",")
positions[pdx] = ([int(temp[0]), int(temp[1])])
#print(positions)
# combine each icon's name with its position
icons = zip(names, positions)
for icon in icons:
print(icon)


Thanks.
Code:#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys, subprocess
# get names
names = []
my_cmd = 'gio info ./* | grep standard::name | sed -e s/\ \ standard::name:\ //g'
p = subprocess.Popen(my_cmd, shell=True, bufsize=4096, stdout=subprocess.PIPE).stdout
line = p.readline().strip().decode()
while line:
names.append(line)
#print(line)
line = p.readline().strip().decode()
# get positions
positions=[]
my_cmd = 'gio info ./* | grep metadata::caja-icon-position: | awk \'{print $2 $3}\''
p = subprocess.Popen(my_cmd, shell=True, bufsize=4096, stdout=subprocess.PIPE).stdout
line = p.readline().strip().decode()
while "," in line:
positions.append(line)
#print(line)
line = p.readline().strip().decode()
for pdx, pos in enumerate(positions):
temp = pos.split(",")
positions[pdx] = ([int(temp[0]), int(temp[1])])
#print(positions)
# combine each icon's name with its position
icons = zip(names, positions)
for icon in icons:
print(icon)