-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raylib/ui: Wi-Fi manager #34364
base: master
Are you sure you want to change the base?
raylib/ui: Wi-Fi manager #34364
Conversation
95ed4f8
to
ee0f0c8
Compare
I love how short this is! The only thing we'll have to be careful about here is not blocking the UI. |
8d2c826
to
a7237fb
Compare
@maxime-desroches Do you have any idea why |
5d58c04
to
bfaf503
Compare
136111b
to
3846500
Compare
3846500
to
1c74d8e
Compare
|
||
bool forget(const std::string& ssid) { | ||
std::string command = "nmcli connection delete id '" + ssid + "'"; | ||
return system(command.c_str()) == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how quick is this? I worry that it'll still block the UI thread for too long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends, may takes 3-5 seconds on 3X. However, since forget
is called asynchronously in the wifiManager
class, it won’t block the UI.
The main issue occurs when using nmcli device wifi connect
. If the password is incorrect, nmcli
blocks and waits for NetworkManager
to trigger a graphical password prompt from the default front-end (e.g., nm-applet) or another external application managing network connections:
To prevent this takeover, we may need to use dbus or sd_dbus to interact directly with NetworkManager, avoiding external applications being notified to prompt for the password. This would allow us to handle password authentication programmatically, ensuring our app retains full control.
I'll close this PR until the issue is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to make any CLI commands async... I worry it'll block even for durations like 0.1s. We want to make sure the new UI runs comfortably at 60+ fps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UI already calls functions in the WiFi namespace asynchronously, so the CLI commands won’t block the main thread.
A demonstration of a Wi-Fi manager implemented using. The features have been mostly completed, with the exception of advanced network-related operationsraygui
andnmcli
. This is an initial draft version designed to showcase the core functionality.File Descriptions:
1.
nmcli_backend.cc
: Contains the backend logic for Wi-Fi management, interfacing with the system’snmcli
commands to handle network operations.2.
wifi_manager.cc
: A reusable widget for managing Wi-Fi networks usingraygui
. This widget can be easily embedded into other raylib windows (UI, setup, etc.) by callingWifiManager::render(Rectangle)
, which allows it to be placed within a specified rectangle on the screen for flexible UI integration.3.
main.cc
: A demo application that uses the Wi-Fi manager to display available networks and connect/forgot to them. This serves as an example of how to integrate the Wi-Fi manager widget.This is an early draft intended for demonstration purposes. Future improvements could include error handling, enhanced styling, background threading, and additional features to further enhance both functionality and user experience.Screenshot:
TODO: