# patch -p1 kiosk/kiosk.py gdm.patch diff --git a/kiosk/kiosk.py b/kiosk/kiosk.py index 5ec466c..828d4c7 100644 --- a/kiosk/kiosk.py +++ b/kiosk/kiosk.py @@ -43,13 +43,14 @@ _lightdm_conf = "/etc/lightdm/lightdm.conf" _lightdm_conf_dir = "%s.d" % _lightdm_conf _autologin_conf = "%s/kiosk.conf" % _lightdm_conf_dir _sddm_conf = "/etc/X11/sddm/sddm.conf" +_gdm_conf = "/etc/gdm/custom.conf" _etc_dir = "/etc/kiosk" _true = ( "True", "true", "Yes", "yes" ) def check_dm(): """Check DM""" #Check in SystemD - for dm in [ "lightdm", "sddm" ]: + for dm in [ "lightdm", "sddm", "gdm" ]: res = check_output( "systemctl status display-manager 2> /dev/null" "| grep %s >/dev/null; echo $?" % dm, shell=True, universal_newlines=True ).strip() if res == "0": @@ -59,6 +60,8 @@ def check_dm(): return "lightdm" elif os.path.exists( _sddm_conf ): return "sddm" + elif os.path.exists( _gdm_conf ): + return "gdm" else: return False _DM = check_dm() @@ -75,7 +78,9 @@ def dm_clear_autologin(): if os.path.exists (_lightdm_conf_dir): os.system ("%s %s/*.conf 2>/dev/null" % (clear_cmd, _lightdm_conf_dir)) if os.path.exists (_autologin_conf): os.remove(_autologin_conf) if _DM == "sddm": - os.system ( "sed -i s/^User.*/User=/ %s" % _sddm_conf ) + os.system ( "sed -i s/^User=/#User=/ %s" % _sddm_conf ) + if _DM == "gdm": + os.system ( "sed -i s/^AutomaticLogin=/#AutomaticLogin=/ %s" % _gdm_conf ) def load_kiosk_user(): """Load username for KIOSK from the config file""" @@ -100,6 +105,16 @@ def autologin_enable(username): os.system ( "sed -i s/^Session.*/Session=plasma/ %s" % _sddm_conf ) os.system ( "sed -i s/^User.*/User=%s/ %s" % ( username, _sddm_conf ) ) + if _DM == "gdm": + config = ConfigParser( interpolation = None ) + config.optionxform = str + config.read( _gdm_conf ) + config[ "daemon" ]["AutomaticLogin"] = username + config[ "daemon" ]["AutomaticLoginEnable"] = "true" + config[ "daemon" ]["WaylandEnable"] = "false" + with open( _gdm_conf, 'w' ) as cfg: + config.write( cfg ) + def create_kiosk_exec(username, shortcut): """Create executable file in X11 directory""" kiosk_exec = "/etc/X11/xsession.user.d/%s" % username @@ -196,6 +211,7 @@ def myc_save( user, _input, output ): pass return result + class Kiosk(Gtk.Window): def __init__( self, window ): """Window with settings of the mode KIOSK"""