source: lliurex-perfilreset/trunk/fuentes/lliurex-perfilreset.install/usr/sbin/lliurex-perfilreset @ 8329

Last change on this file since 8329 was 8329, checked in by hectorgh, 12 months ago

relaunching dock if its currently not running

  • Property svn:executable set to *
File size: 945 bytes
Line 
1#! /usr/bin/python3
2
3import sys
4import os
5import os.path
6import shutil
7from gi.repository import Gio
8
9
10#print ("inicio")
11
12cmd='dconf reset -f /'
13skel_panel='/etc/skel/.config/xfce4/panel'
14
15home_path=os.path.expanduser('~')
16local_panel=home_path+'/.config/xfce4/panel'
17
18def copy_and_overwrite(from_path, to_path):
19    if os.path.exists(to_path):
20        shutil.rmtree(to_path)
21    shutil.copytree(from_path, to_path)
22#def copy_and_overwrite
23
24#Restore Desktop profile
25os.system(cmd)
26
27#Restore Main LliureX Menu
28if os.path.isdir(skel_panel):
29        print('Copy skel from %s to %s' %(skel_panel,local_panel))
30        copy_and_overwrite(skel_panel, local_panel)
31
32#Relaunch dock if it isn't active
33try:
34        settings = Gio.Settings("org.mate.session.required-components")
35        dock=settings.get_string("dock")
36        if len(dock) > 0:
37                ret=os.system("ps aux | grep $USER | grep %s | grep -v grep"%dock)
38                if ret!=0:
39                        os.system("%s &"%dock)
40except:
41       
42        pass
43
44
45#print ("FIN")
46       
Note: See TracBrowser for help on using the repository browser.