Open
Conversation
This makes the icon name consistent everywhere.
Add a utility function to create a full path from a directory and a filename.
SCRCPY_ICON_PATH defined the path of the scrcpy app icon. SCRCPY_ICON_DIR defines the directory where scrcpy icons reside. This change prepares for the addition of other icons.
Replace scrcpy_icon_load(), which loaded the unique scrcpy app icon, with sc_icon_load(filename), which can load any icon from the icons directory.
When the connection to the device is lost while mirroring, the window closed immediately, suggesting scrcpy had crashed. To make it clear that a disconnection occurred, display a disconnected icon for 2 seconds before closing the window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the connection to the device is lost while mirroring, the window closed immediately, suggesting scrcpy had crashed.
To make it clear that a disconnection occurred, display a disconnected icon for 2 seconds before closing the window.
The icon replaces the screen content immediately:
On purpose, the last frame is immediately removed. For example, during a presentation, the device might inadvertently show some private content on screen, the user should be able to immediately disconnects the USB cable to remove the content.
I intentionally did not add an option to configure the timeout delay (it's hardcoded to 2 seconds), there are already a lot of options…
The implementation is a bit "ad hoc", but hey it works.
I replaced
SCRCPY_ICON_PATH(which defined the unique scrcpy icon) withSCRCPY_ICON_DIRnow that there are several icons.I get the (temporary) disconnected icon from a free icons website (I can't remember where).
@varlesh As the author of the main icon (#1987 (comment)), may I ask you to create an icon for this use case?
This is an "Android disconnection"
so this is not specifically for USB or Wifi (and even less wall socket). If it needs to represent something physical, USB is probably fine though.