View | Details | Raw Unified | Return to bug 56315
Collapse All | Expand All

(-)a/kiosk/kiosk.py (-2 / +18 lines)
Lines 43-55 _lightdm_conf = "/etc/lightdm/lightdm.conf" Link Here
43
_lightdm_conf_dir = "%s.d" % _lightdm_conf
43
_lightdm_conf_dir = "%s.d" % _lightdm_conf
44
_autologin_conf = "%s/kiosk.conf" % _lightdm_conf_dir
44
_autologin_conf = "%s/kiosk.conf" % _lightdm_conf_dir
45
_sddm_conf = "/etc/X11/sddm/sddm.conf"
45
_sddm_conf = "/etc/X11/sddm/sddm.conf"
46
_gdm_conf = "/etc/gdm/custom.conf"
46
_etc_dir = "/etc/kiosk"
47
_etc_dir = "/etc/kiosk"
47
_true = ( "True", "true", "Yes", "yes" )
48
_true = ( "True", "true", "Yes", "yes" )
48
def check_dm():
49
def check_dm():
49
    """Check DM"""
50
    """Check DM"""
50
    #Check in SystemD
51
    #Check in SystemD
51
    for dm in [ "lightdm", "sddm" ]:
52
    for dm in [ "lightdm", "sddm", "gdm" ]:
52
        res = check_output( "systemctl status display-manager 2> /dev/null"
53
        res = check_output( "systemctl status display-manager 2> /dev/null"
53
                            "| grep %s >/dev/null; echo $?" % dm, shell=True, universal_newlines=True ).strip()
54
                            "| grep %s >/dev/null; echo $?" % dm, shell=True, universal_newlines=True ).strip()
54
        if res == "0":
55
        if res == "0":
Lines 59-64 def check_dm(): Link Here
59
        return "lightdm"
60
        return "lightdm"
60
    elif os.path.exists( _sddm_conf ):
61
    elif os.path.exists( _sddm_conf ):
61
        return "sddm"
62
        return "sddm"
63
    elif os.path.exists( _gdm_conf ):
64
        return "gdm"
62
    else:
65
    else:
63
        return False
66
        return False
64
_DM = check_dm()
67
_DM = check_dm()
Lines 75-81 def dm_clear_autologin(): Link Here
75
        if os.path.exists (_lightdm_conf_dir): os.system ("%s %s/*.conf 2>/dev/null" % (clear_cmd, _lightdm_conf_dir))
78
        if os.path.exists (_lightdm_conf_dir): os.system ("%s %s/*.conf 2>/dev/null" % (clear_cmd, _lightdm_conf_dir))
76
        if os.path.exists (_autologin_conf): os.remove(_autologin_conf)
79
        if os.path.exists (_autologin_conf): os.remove(_autologin_conf)
77
    if _DM == "sddm":
80
    if _DM == "sddm":
78
        os.system ( "sed -i s/^User.*/User=/ %s" % _sddm_conf )
81
        os.system ( "sed -i s/^User=/#User=/ %s" % _sddm_conf )
82
    if _DM == "gdm":
83
        os.system ( "sed -i s/^AutomaticLogin=/#AutomaticLogin=/ %s" % _gdm_conf )
79
def load_kiosk_user():
84
def load_kiosk_user():
80
    """Load username for KIOSK from the config file"""
85
    """Load username for KIOSK from the config file"""
Lines 100-105 def autologin_enable(username): Link Here
100
        os.system ( "sed -i s/^Session.*/Session=plasma/ %s" % _sddm_conf )
105
        os.system ( "sed -i s/^Session.*/Session=plasma/ %s" % _sddm_conf )
101
        os.system ( "sed -i s/^User.*/User=%s/ %s" % ( username, _sddm_conf ) )
106
        os.system ( "sed -i s/^User.*/User=%s/ %s" % ( username, _sddm_conf ) )
107
    if _DM == "gdm":
108
        config = ConfigParser( interpolation = None )
109
        config.optionxform = str
110
        config.read( _gdm_conf )
111
        config[ "daemon" ]["AutomaticLogin"] = username
112
        config[ "daemon" ]["AutomaticLoginEnable"] = "true"
113
        config[ "daemon" ]["WaylandEnable"] = "false"
114
        with open( _gdm_conf, 'w' ) as cfg:
115
            config.write( cfg )
116
102
def create_kiosk_exec(username, shortcut):
117
def create_kiosk_exec(username, shortcut):
103
    """Create executable file in X11 directory"""
118
    """Create executable file in X11 directory"""
104
    kiosk_exec = "/etc/X11/xsession.user.d/%s" % username
119
    kiosk_exec = "/etc/X11/xsession.user.d/%s" % username
Lines 196-201 def myc_save( user, _input, output ): Link Here
196
        pass
211
        pass
197
    return result
212
    return result
213
198
class Kiosk(Gtk.Window):
214
class Kiosk(Gtk.Window):
199
    def __init__( self, window ):
215
    def __init__( self, window ):
200
        """Window with settings of the mode KIOSK"""
216
        """Window with settings of the mode KIOSK"""

Return to bug 56315