{"id":30069329,"url":"https://github.com/ishara-madu/scrcpy-auto-retry","last_synced_at":"2025-08-08T11:08:54.548Z","repository":{"id":307796542,"uuid":"1030728053","full_name":"ishara-madu/scrcpy-auto-retry","owner":"ishara-madu","description":"A Zsh script packaged as a .command file for macOS, designed to automate the execution of scrcpy with automatic retries on failure. The script provides a user-friendly interface to configure the screen resolution for scrcpy, displays a dynamic progress bar for timeouts, and prompts the user to continue after a set number of attempts.","archived":false,"fork":false,"pushed_at":"2025-08-02T07:51:38.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-02T09:59:08.726Z","etag":null,"topics":["scrcpy","scrcpy-android","scrcpy-cli"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ishara-madu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-02T07:34:54.000Z","updated_at":"2025-08-02T07:51:41.000Z","dependencies_parsed_at":"2025-08-02T09:59:12.598Z","dependency_job_id":"bcfa4db9-f79b-4315-a00e-1dabaf45540c","html_url":"https://github.com/ishara-madu/scrcpy-auto-retry","commit_stats":null,"previous_names":["ishara-madu/scrcpy-auto-retry"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ishara-madu/scrcpy-auto-retry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishara-madu%2Fscrcpy-auto-retry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishara-madu%2Fscrcpy-auto-retry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishara-madu%2Fscrcpy-auto-retry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishara-madu%2Fscrcpy-auto-retry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ishara-madu","download_url":"https://codeload.github.com/ishara-madu/scrcpy-auto-retry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishara-madu%2Fscrcpy-auto-retry/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269410221,"owners_count":24412157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["scrcpy","scrcpy-android","scrcpy-cli"],"created_at":"2025-08-08T11:08:53.739Z","updated_at":"2025-08-08T11:08:54.541Z","avatar_url":"https://github.com/ishara-madu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scrcpy-auto-retry\n\n## Purpose\nThe purpose of this script is to simplify the use of `scrcpy` (a tool for displaying and controlling Android devices from a computer) on macOS by:\n- Allowing users to specify a custom resolution or use the default `scrcpy` settings.\n- Automatically retrying `scrcpy` execution on failure with a short delay.\n- Providing a clean and visually appealing interface with progress bars and prompts.\n- Ensuring a clean session by disabling Zsh history and removing cache files on exit.\n\n## Features\n- **Custom Resolution Input**: Users can specify a resolution (e.g., 720) for `scrcpy -m` or use the default settings.\n- **Automatic Retries**: Retries `scrcpy` execution on failure with a 1-second delay.\n- **Progress Bar**: Displays a dynamic progress bar during the 60-second timeout for user prompts.\n- **Session Cleanup**: Prevents Zsh history saving and removes cache files (`~/.zsh_history`, `~/.zcompdump*`) on exit or Ctrl+C.\n- **User-Friendly Interface**: Clear prompts and a clean layout with colored output for better readability.\n- **Retry Prompt**: After 50 attempts, prompts the user to continue or exit with a 60-second timeout.\n\n## Prerequisites\n- **macOS**: This script is designed for macOS, as it uses a `.command` file executable in Terminal.app.\n- **Zsh**: The script is written for the Zsh shell, which is the default shell on macOS (since macOS Catalina).\n- **scrcpy**: Must be installed and accessible in the system's PATH (e.g., via Homebrew: `brew install scrcpy`).\n- **Android Device**: A connected Android device with USB debugging enabled.\n\n## Installation\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/your-username/scrcpy-auto-retry.git\n   ```\n2. Navigate to the repository directory:\n   ```bash\n   cd scrcpy-auto-retry\n   ```\n3. Ensure the script is executable:\n   ```bash\n   chmod +x scrcpy-auto-retry.command\n   ```\n\n## Usage\nThe script is packaged as a `.command` file, which is macOS-specific and can be run in several ways using a Zsh terminal (Terminal.app on macOS):\n\n1. **Double-Click to Run**:\n   - Locate the `scrcpy-auto-retry.command` file in Finder.\n   - Double-click the file to automatically open it in Terminal.app and execute the script.\n   - Note: If macOS blocks the file (due to security settings), right-click the file, select **Open**, and confirm to allow execution.\n\n2. **Right-Click to Open in Terminal**:\n   - In Finder, right-click the `scrcpy-auto-retry.command` file.\n   - Select **Open With** \u003e **Terminal** (or **Terminal.app**).\n   - This will launch the script in a new Terminal window.\n\n3. **Direct Execution in Terminal**:\n   Navigate to the script's directory and run:\n   ```bash\n   ./scrcpy-auto-retry.command\n   ```\n\n4. **Absolute Path Execution**:\n   Run the script using its full path:\n   ```bash\n   /path/to/scrcpy-auto-retry/scrcpy-auto-retry.command\n   ```\n\n5. **Using Zsh Explicitly**:\n   If Zsh is not your default shell, explicitly invoke it:\n   ```bash\n   zsh ./scrcpy-auto-retry.command\n   ```\n\n6. **Running from Any Directory**:\n   If the script is in your PATH, you can run it directly:\n   ```bash\n   scrcpy-auto-retry.command\n   ```\n   To add it to your PATH, move the script to a directory like `/usr/local/bin` and ensure it's executable:\n   ```bash\n   sudo mv scrcpy-auto-retry.command /usr/local/bin/\n   sudo chmod +x /usr/local/bin/scrcpy-auto-retry.command\n   ```\n\n**Steps After Launch**:\n- Enter a resolution for `scrcpy -m` (e.g., `720`) when prompted, or press Enter to use the default settings.\n- The script will attempt to run `scrcpy`. If it fails, it will retry automatically with a 1-second delay.\n- After 50 attempts, the script will prompt you to continue (`y`) or exit (`n` or timeout after 60 seconds).\n- Press `Ctrl+C` at any time to exit cleanly, resetting the terminal and removing cache files.\n\n## Screenshots\nBelow are screenshots demonstrating the script's interface in action:\n\n| **Configuration Menu** | **Progress Bar \u0026 Retry Prompt** |\n|------------------------|------------------|\n| ![Configuration Menu](https://github.com/ishara-madu/scrcpy-auto-retry/raw/main/screenshots/configuration_menu.png)\u003cbr\u003eShows the initial prompt for entering the scrcpy resolution. | ![Progress Bar](https://github.com/ishara-madu/scrcpy-auto-retry/raw/main/screenshots/progress_bar.png)\u003cbr\u003eDisplays the dynamic progress bar during the 60-second timeout and Shows the prompt after 50 attempts asking to continue or exit.\n\n\n## Notes\n- The script uses Zsh-specific features (`setopt`, `read -k`, etc.) and is designed to run in a Zsh environment, which is the default on macOS.\n- Ensure `scrcpy` is properly configured and your Android device is connected via USB with debugging enabled.\n- The script prevents history saving to maintain a clean session, which is useful for privacy or debugging purposes.\n- The progress bar and colored output enhance the user experience but require a terminal that supports ANSI escape codes.\n- The `.command` file is macOS-specific and may not work on other operating systems without modification.\n- If double-clicking the `.command` file does not work due to macOS security settings, you may need to adjust Gatekeeper settings (`System Settings \u003e Privacy \u0026 Security`) or use the right-click **Open** method.\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishara-madu%2Fscrcpy-auto-retry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishara-madu%2Fscrcpy-auto-retry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishara-madu%2Fscrcpy-auto-retry/lists"}