def add_to_desktop(self, widget, desktopEntry):
try:
# Determine where the Desktop folder is (could be localized)
import subprocess
#sys.path.append('/usr/lib/ubuntu-mate/common')
from configobj import ConfigObj
config = ConfigObj(GLib.get_home_dir() + "/.config/user-dirs.dirs")
desktopDir = GLib.get_home_dir() + "/Desktop"
tmpdesktopDir = config['XDG_DESKTOP_DIR']
tmpdesktopDir = subprocess.getoutput("echo " + tmpdesktopDir)
if os.path.exists(tmpdesktopDir):
desktopDir = tmpdesktopDir
# Copy the desktop file to the desktop
os.system("cp \"%s\" \"%s/\"" % (desktopEntry.desktopFile, desktopDir))
os.system("chmod a+rx %s/*.desktop" % (desktopDir))
except Exception as detail:
print (detail)
评论列表
文章目录