Skip to content

Display disconnected icon before closing#6662

Open
rom1v wants to merge 7 commits intodevfrom
disconnected
Open

Display disconnected icon before closing#6662
rom1v wants to merge 7 commits intodevfrom
disconnected

Conversation

@rom1v
Copy link
Collaborator

@rom1v rom1v commented Feb 9, 2026

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:

scrcpy_disconnected_small

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) with SCRCPY_ICON_DIR now 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"

  • in normal mode, it's the adb socket (either over USB or wifi)
  • in OTG mode, it's the AOA connection (over USB)

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.

rom1v added 7 commits February 9, 2026 18:36
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments