naneos.gui.integration
How the tray app fits into each operating system, without Qt.
- where it logs,
- how it starts at login (LaunchAgent, Run key, XDG autostart),
- the macOS app bundle that lets Bluetooth ask for permission in its own name,
- the Linux application menu entry.
Everything takes the home directory, the environment and (on Windows) the registry as optional arguments, so the tests never touch the real ones.
Autostart
Bases: ABC
Start the tray app when the user logs in.
Source code in src/naneos/gui/integration.py
131 132 133 134 135 136 137 138 139 140 141 | |
LinuxAutostart
Bases: Autostart
~/.config/autostart/naneos-devices.desktop (XDG autostart).
Source code in src/naneos/gui/integration.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
MacAutostart
Bases: Autostart
A LaunchAgent that opens the app bundle at login (open -g -a).
It takes effect at the next login. open goes through LaunchServices, so the
start looks like a double click and the bundle stays the responsible app.
Source code in src/naneos/gui/integration.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
WindowsAutostart
Bases: Autostart
A value in HKCU\Software\Microsoft\Windows\CurrentVersion\Run (no admin needed).
Source code in src/naneos/gui/integration.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
current_platform()
"darwin", "win32" or "linux" (every other Unix counts as linux).
Source code in src/naneos/gui/integration.py
43 44 45 46 47 | |
entry_point(platform=None)
The naneos-gui next to the running python, i.e. inside the environment that
uv tool install made. That path stays the same when the tool is reinstalled.
Source code in src/naneos/gui/integration.py
86 87 88 89 90 | |
install_integration(platform=None, command=None, environ=None, home=None)
Make the app startable from the desktop. Returns what was written.
macOS: the app bundle. Linux: the application menu entry. Windows: nothing here, the installer script makes the Start Menu shortcut.
Source code in src/naneos/gui/integration.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
install_macos_bundle(command, home=None)
Write ~/Applications/Naneos Devices.app and return its path.
macOS asks for Bluetooth access on behalf of the "responsible" app, the one at the top of the process chain. A python started at login has no Info.plist with a usage text, so CoreBluetooth would kill it or never ask. So the bundle holds a small launcher that starts python as its child; the child inherits the launcher as the responsible app (see macos/launcher.c).
Idempotent: files that already hold the right content are left alone, and the bundle is only signed again when it changed or its signature is not valid. The signature is ad-hoc and the same for the same content, so an update of the package does not make macOS ask for Bluetooth access again.
Source code in src/naneos/gui/integration.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
launch_command()
The command that starts the tray app: the installed script, or python -m
naneos.gui when run from a checkout.
Source code in src/naneos/gui/integration.py
93 94 95 96 97 98 99 | |
log_dir(platform=None, environ=None, home=None)
Where the tray app writes naneos-devices.log.
Source code in src/naneos/gui/integration.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |