{"id":19242693,"url":"https://github.com/tkapias/polybar-droidcpy","last_synced_at":"2025-07-10T01:08:08.337Z","repository":{"id":176357930,"uuid":"478149289","full_name":"tkapias/polybar-droidcpy","owner":"tkapias","description":"droidcpy - A Polybar script to control your Android device remote control services. Mirror display with handling, Audio, Webcam. Using scrcpy, sndcpy and v4l2loopback with IP Webcam.","archived":false,"fork":false,"pushed_at":"2022-04-09T16:30:58.000Z","size":32,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T09:52:03.299Z","etag":null,"topics":["adb","android-remote","i3wm-config","polybar-module","polybar-scripts","scrcpy","sndcpy","systemd-services","v4l2loopback","webcam"],"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/tkapias.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":"2022-04-05T13:48:55.000Z","updated_at":"2025-04-17T11:48:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"4dec5667-8ad7-453d-bd92-28d13e239d84","html_url":"https://github.com/tkapias/polybar-droidcpy","commit_stats":null,"previous_names":["tkapias/polybar-droidcpy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tkapias/polybar-droidcpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkapias%2Fpolybar-droidcpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkapias%2Fpolybar-droidcpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkapias%2Fpolybar-droidcpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkapias%2Fpolybar-droidcpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkapias","download_url":"https://codeload.github.com/tkapias/polybar-droidcpy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkapias%2Fpolybar-droidcpy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264507004,"owners_count":23619117,"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","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":["adb","android-remote","i3wm-config","polybar-module","polybar-scripts","scrcpy","sndcpy","systemd-services","v4l2loopback","webcam"],"created_at":"2024-11-09T17:15:15.029Z","updated_at":"2025-07-10T01:08:08.326Z","avatar_url":"https://github.com/tkapias.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# droidcpy\n**A [Polybar](https://github.com/polybar/polybar) script** to control your **Android device remote control services**. Mirror display with handling, Audio, Webcam. Using scrcpy, sndcpy and v4l2loopback with IP Webcam.\n\n\n![image](https://user-images.githubusercontent.com/45816387/161807714-bcdeffbe-2a5b-4923-8e07-8b684e884d0b.png)\n\n![image](https://user-images.githubusercontent.com/45816387/161813431-e4631644-30f6-40b0-a0e5-4026cdaf380a.png)\n\n\n\u003e The configurations proposed by this repository are **not adapted to all operating systems or easily customized** without reading some code.\n\u003e It is **dedicated to advanced Android/Linux** users who run at least **Polybar and Systemd**, ideally i3wm too.\n\u003e \n\u003e You can use the Systemd services wthout Polybar from the terminal, but it's cumbersome to monitor the status of the services and toggle their state from the command line.\n\n\n## Features\n\n  - Display a **panel with 3 icons/controls** on the status bar, **when the Android device is connected** on USB.\n    - Launch a **remote screen/mouse/keyboard** control with [scrcpy](https://github.com/Genymobile/scrcpy).\n    - Launch a **remote sound forwarding** with [sndcpy](https://github.com/rom1v/sndcpy).\n    - Launch an **IP webcam** device using your smartphone as a camera with [v4l2loopback](https://github.com/umlaeute/v4l2loopback) and [IP Webcam Pro/Lite](https://play.google.com/store/apps/details?id=com.pas.webcam.pro).\n  - A left-click **Stop/start** the services cleanly with the same icon.\n  - The **status** of the device and services is **displayed graphically**.\n    - The panel check if the device is connected to ADB and finished booting, if the **device is disconnected the panel is hidden**.\n    - Icons **displays the current status** of the services by their color: activated, failed, stopped.\n    - The **background** of the Panel is **Green** if any service is Activated.\n      - **Or Red** if a service is still activated or failed when the device is not ready.\n\n\n## Limitations\n\n  - My testing device was rooted and runs on Android 11, but it should work **without root** and **at least from Android 10**.\n  - Clicking on a failed service try to start it again, not to stop it:\n    - If you **disconnect the device** while a service is running, it **may not stop but switch to failed**, you will have to reconnect the device and start/stop cleanly before disconnecting again. Or the Red icon will stay visible.\n  - I choose to limit the bitrate (2M) and the resolution (1024) in the parameters to get the best perfs, you can tweak the exec command in the systemd service files.\n  - On some device the orientation of the Webcam may be wrong, you can change those settings in the IP Webcam app or in the systemd service file.\n  - As it was a quick project and the scripts are commented, I did not centralize options, device name or output colors. **There is no central ENV or attributes**, you wil have to find it in the code.\n    - The scripts are **not written to work when there is more than 1 device connected on ADB**. And **you have to specify the name of your device** in the script, or use a wildcard, but then any adb device will show the panel.\n  - I did not find any good open source solution for the IP webcam application on Android, it's possible to use [Open Camera](https://github.com/almalence/OpenCamera) with scrcpy and v4l2loopback to forward the picture from the screen but it's more limited. But [IP Webcam Pro](https://play.google.com/store/apps/details?id=com.pas.webcam.pro) seems to be a clean and serious application.\n\n\n## Requirements\n\n  - [scrcpy](https://github.com/Genymobile/scrcpy): display and control of Android devices connected via USB.\n    - On Debian and Ubuntu: `apt install scrcpy`\n    - On Arch Linux: `pacman -S scrcpy`\n    - Make sure you [enabled adb debugging](https://developer.android.com/studio/command-line/adb.html#Enabling) on your device.\n  - [sndcpy.apk](https://github.com/rom1v/sndcpy): audio forwarding of Android devices connected via USB.\n    - You need only the APK from [release 1.1](https://github.com/rom1v/sndcpy/releases/download/v1.1/sndcpy-v1.1.zip)\n    - Install the sndcpy.apk to your device manually or by droping it in [scrcpy file drop](https://github.com/Genymobile/scrcpy#file-drop).\n    - polybar-droidcpy use ffplay from the Ffmpeg package, instead of vlc:\n      - On Debian and Ubuntu: `apt install ffmpeg`\n      - On Arch Linux: `pacman -S ffmpeg`\n  - [v4l2loopback](https://github.com/umlaeute/v4l2loopback): kernel module to create V4L2 loopback devices.\n    - On Debian and Ubuntu: `apt install v4l2loopback-dkms`\n    - On Arch Linux: `pacman -S v4l2loopback-dkms`\n    - Create a first loopback device (/dev/video0): `sudo modprobe v4l2loopback`\n    - To load the device after reboot add a new file to your system, \n      - with the content \"v4l2loopback\": `sudo echo \"v4l2loopback \u003e \"/etc/modules-load.d/v4l2loopback.conf`\n  - [IP Webcam Pro](https://play.google.com/store/apps/details?id=com.pas.webcam.pro): turns your phone into a network camera.\n    - I use the Pro version but it should work with the [Lite version](https://play.google.com/store/apps/details?id=com.pas.webcam) too.\n    - I changed some settings in the app manually:\n      - Video Preferences/Main caméra: Frontal\n      - Video Preferences/Resolution: 1280x720\n      - Video Preferences/Quality: 80\n      - Video Preferences/Orientation: Landscape\n      - Local Sharing/Port: 8082 (used in systemd config)\n      - Audio Mode: Disabled\n  - [ADB] Google/Android useful tool for debugging android devices:\n    - On Debian and Ubuntu: `apt install android-tools-adb`\n    - On Arch Linux: `pacman -S android-tools`\n    - Check if you see you device : `adb devices -l`\n  - [Polybar](https://github.com/polybar/polybar): beautiful and highly customizable status bars.\n    - On Debian and Ubuntu: `apt install polybar`\n    - On Arch Linux: `pacman -S polybar`\n    - You need to customize your config.ini to incorporate droidcpy as a module.\n  - [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts): Nerd Fonts takes popular programming fonts and adds a bunch of Glyphs.\n    - droidcpy use icons provided by a Nerd-Fonts font, you need one, or to modify the icons in [polybar/scripts/droidcpy.sh](https://github.com/tkapias/polybar-droidcpy/blob/main/polybar/scripts/droidcpy.sh).\n  - [Systemd](https://www.freedesktop.org/software/systemd/man/systemd.service.html): system and service manager for Linux operating systems.\n    - Your desktop operating system probably works on this manager. If not, it's complicated to install it.\n\n### Optional\n\n  - [i3wm](https://github.com/i3/i3): a tiling window manager for X11.\n    - It's not mandatory but I use a fork with more features: [i3wm-gaps](https://github.com/Airblader/i3)\n\n\n## Installation\n\n  - Check all the [Requirements](#requirements).\n  - **Copy polybar-droidcpy's repo** on your machine: \n    ```shell\n    cd /tmp\n    git clone https://github.com/tkapias/polybar-droidcpy.git\n    cd polybar-droidcpy\n    ```\n  - **Add the systemd services to your user:**\n    ```shell\n    cp systemd/user/* ~/.config/systemd/user/\n    mkdir ~/.logs\n    systemctl --user daemon-reload\n    systemctl --user status scrcpy.service sndcpy.service v4l2-ipwebcam.service\n    ```\n  - **Copy the Polybar droidcpy script** to your config directory:\n    ```shell\n    mkdir ~/.config/polybar/scripts/\n    cp polybar/scripts/droidcpy.sh ~/.config/polybar/scripts/\n    ```\n  - **Change the name of your device** (variable my_device=\"\") **in the script** (~/.config/polybar/scripts/droidcpy.sh).\n    - You can find the name here: `adb devices -l`\n  - **Add droidcpy to your Polybar** config.ini:\n    - New module section:\n      ```\n      [module/droidcpy]\n      type   = custom/script\n      exec   = ~/.config/polybar/scripts/droidcpy.sh\n      tail   = false\n      ```\n    - Add it to one of your bars section, example:\n      ```\n      [bar/base]\n      modules-left = droidcpy\n      ```\n    - **Reload your Polybar**.\n  - **If you use i3wm**, add some rules for scrcpy, example:\n    ```shell\n    # assign the program to workspace 3, because I use \"set $ws3 number 3\"\n    assign [class=\"scrcpy\"] $ws3\n    \n    # force no borders and a floating window for scrpy\n    for_window [class=\".*\"] border pixel 0\n    for_window [class=\"scrcpy\"] floating enable\n    ```\n    - **Reload your i3wm**.\n\n\n## Acknowledgements\n\n  - Thanks to [Nitin Rai](https://github.com/imneonizer) for his [original script idea and some adb commands](https://github.com/imneonizer/android-webcam).\n  - Thanks to [Romain Vimont](https://github.com/rom1v) for his [sndcpy](https://github.com/rom1v/sndcpy) APK which has no comparable alternative at present.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkapias%2Fpolybar-droidcpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkapias%2Fpolybar-droidcpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkapias%2Fpolybar-droidcpy/lists"}