@@ -100,15 +100,49 @@ def update(do):
100100 "Rebuilding initramfs…" ,
101101 )
102102
103+ def connect ():
104+ # Only attempt WiFi configuration on Linux
105+ if app .helper .get_os () != "linux" :
106+ return
107+
108+ # Only attempt WiFi configuration on ARM64
109+ if app .helper .get_arch () != "arm64" :
110+ return
111+
112+ ssid = app .configuration .get ("wifi.ssid" )
113+ passphrase = app .configuration .get ("wifi.passphrase" )
114+
115+ # Nothing to do if SSID is not configured
116+ if not ssid :
117+ return
118+
119+ # Ensure WiFi radio is enabled
120+ app ._run_system_command (
121+ ["nmcli" , "radio" , "wifi" , "on" ],
122+ wait = True ,
123+ )
124+
125+ # Build nmcli command to connect wlan0
126+ cmd = ["nmcli" , "dev" , "wifi" , "connect" , ssid , "ifname" , "wlan0" ]
127+ if passphrase :
128+ cmd += ["password" , passphrase ]
129+
130+ # Run the connection command synchronously so we know when it's done
131+ app ._run_system_command (
132+ cmd ,
133+ wait = True ,
134+ )
135+
103136 # Connect to update signal
104137 app .updating .connect (update )
105138 app .configuration .configChanged .connect (reload )
106139
107140 # Add configuration entries
108- if (app .helper .get_os () == "linux" ):
141+ if (app .helper .get_os () == "linux" and app . helper . get_arch () == "arm64" ):
109142 app .configuration .label ("wifi" , "WiFi" )
110143 app .configuration .add ("wifi.ssid" , None , "wifi" , label = "SSID" )
111144 app .configuration .add ("wifi.passphrase" , None , "password" )
145+ app .configuration .configChanged .connect (connect )
112146 app .configuration .add ("customize.logo_file" , None , "picture" , label = "Logo File" )
113147 app .configuration .add ("customize.gradient_start" , "#76797c" , "color" , label = "Gradient Start" )
114148 app .configuration .add ("customize.gradient_end" , "#242829" , "color" , label = "Gradient End" )
0 commit comments