{"id":21131034,"url":"https://github.com/brunodles/linux-second-screen","last_synced_at":"2025-07-09T01:33:38.840Z","repository":{"id":32208300,"uuid":"35782070","full_name":"brunodles/linux-second-screen","owner":"brunodles","description":"Scripts to repurpose old android device as second monitor on linux","archived":false,"fork":false,"pushed_at":"2021-10-08T21:47:28.000Z","size":70,"stargazers_count":194,"open_issues_count":4,"forks_count":23,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-04T14:44:01.876Z","etag":null,"topics":["adb","android","android-device","bash","linux","lockscreen","ssh","vnc"],"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/brunodles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-17T20:38:54.000Z","updated_at":"2024-12-01T17:22:58.000Z","dependencies_parsed_at":"2022-08-26T10:22:14.320Z","dependency_job_id":null,"html_url":"https://github.com/brunodles/linux-second-screen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brunodles/linux-second-screen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunodles%2Flinux-second-screen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunodles%2Flinux-second-screen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunodles%2Flinux-second-screen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunodles%2Flinux-second-screen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunodles","download_url":"https://codeload.github.com/brunodles/linux-second-screen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunodles%2Flinux-second-screen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375597,"owners_count":23598413,"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","android-device","bash","linux","lockscreen","ssh","vnc"],"created_at":"2024-11-20T05:43:43.932Z","updated_at":"2025-07-09T01:33:38.522Z","avatar_url":"https://github.com/brunodles.png","language":"Shell","readme":"# linux-second-screen\nScripts to repurpose old android device as second monitor on linux\n\n## Warnning\nThis script is using Legacy nVidea Driver and may not be compatible anymore.\nIt was created on 2017 and it's not actively maintained.\nPlease be carefull if you insist to use it.\nOne alternative cold be using the [evdi kernel module](https://github.com/DisplayLink/evdi/).\nLook [here](https://github.com/brunodles/linux-second-screen/issues/25) for more details.\n\n## Usage\nThis repo have many bash scripts to interact with android using adb.\nEach script have it's own function.\n\n### Device\nA simple wrapper to select target device by name.\n\n#### Add device\n```\ndevice add droid2 015F13B817021010\n```\n\n#### Usage\n```\ndevice droid2 adb shell\ndevice droid2 \u003cany other command\u003e\n```\n\n### Display\nChange host (linux) display settings.\nWith this script we can create, change settings or remove of virtual displays.\nIt does not care about positioning the virtual displays, this should be done using your favorite monitor app. E.g.: xrandr, arandr or some other you like.\n\n### droid\nGeneral commands for android.\nThis script is a wrapper for adb, with it we can:\n* start an app to resolve one url\n* open pre-defined activites\n* set date and time\n* get device ip\n* connect to wifi\n* get sdk\n* get model\n* get and change orientation\n* change some developer settings \n* get screen resolution\n* shutdown device\n* record and playback inputs\n\n### input\nAn reimplementation of input script on android.\nSome devices doesn't have tap and swipe command, so this script tries to reprotuce theses commands.\n\n### keyboard\nSend multiple KEY_EVENTS in a single string.\nThe idea here is to simplify the way to send keyboard inputs.\nThis script replaces ` `(space character) by `%s` the one is used by key event.\nAlso send key events by name, just using UPPERCASED text.\n```\n# We can input text, then key, the text again, the order doesn't matter\nkeyboard \"My name is Bruno;ENTER;This one is probably on the next field\"\n\n# we can also send multiple key events\nkeyboard \"UP;UP;DOWN;DOWN;LEFT;RIGHT;LEFT;RIGHT\"\n```\n\n### terminal\nThis script is a wrapper to interact with **screen**, a screen manager for terminal.\nUsing screen we can share a terminal session like. \nThe idea is use it like a vnc, and connect other devices to keep a terminal session running on then like server logs or status.\n\n### vnc\nA wrapper for vnc commands.\nWe have only two commands here:\n* Start - wich starts vnc for a virtual display\n* window - wich starts vnc for a given window\n\n## Setup\nFirst we need to run setup to install all tools we need to run this.\nThere are tools that we doesn't provide, like adb (Android Debug Bridge), it comes with android sdk.\nYou will have to setup adb into your path.\n* [adb only](https://developer.android.com/studio/releases/platform-tools)\n* [about adb](https://developer.android.com/studio/command-line/adb?hl=pt-br)\n* [android sdk](https://developer.android.com/studio/install?hl=pt-br)\n\nThen run setup.\nYou will be prompt to put your password to install necessary tools.\n*We may split setup into multiple phases later, for optional instalation.*\n```\n# install tools\n./main setup\n\n# create virtual displays, only works with intel's graphic card\n# you may change 2 by any number of virtual displays you want\n./display create 2\n```\nRestart you computer, if you created virtual display.\nWhen you login again you will see `VIRTUAL` as possible video output.\n\n## How to create a extended display? - Intel's graphic card only\nWith these scripts it gets simple.\nBut we still need to make some touches to make then integrated. \n*may I make this on main.*\n\nI high recomend you to write a script to start your own devices, this will make your life a lot easier.\nSo I will write the step-by-step in a script-like.\n\n### Step 1 - get information from your device\nWe need to know the resolution from our device, it's orientation and screen size inches.\nBased on these two informations we can create one virtual display.\n\n```\n# resolution - this one may fail, so you may have to get this information from internet\n# ./droid resolution\nresolution=$(./droid resolution)\n\n# replace resolution ´x´ by ´ ´ (space)\nresolution=${resolution/x/ }\n\n# orientation\n# ./droid orientation\norientation=$(./droid orientation)\n\n# inches - this one may fail too, cause we need resolution and density to calculate an aproximate screen inches\n# ./droid inches\ninches=$(./droid inches)\n```\n\n### Step 2 - calculate virtual display resolution\nNow we have the resolution let's calculate an virtual display size\n\n```\n# ./display calcRes $resolution $inches\nvirtual=$(./display calcRes $resolution $inches | grep virtual | grep -Po \"(\\d+x\\d+)\")\n```\n\n### Step 3 - set virtual display resolution\nLet's set the resolution for display 1.\nDepending on orientation we change order of width and height.\n```\nvirtual=(${virtual/x/ })\nwidth=${virtual[0]}\nheight=${virtual[1]}\nif [ \"$orientation\" == 0 ] || [ \"$orientation\" == 2]; then\n  # portrait\n  ./display setRes 1 $width $height\nelse\n  # landscape\n  ./display setRes 1 $height $width\nfi\n```\n\n### Step 4 - share display on vnc\n```\n./vnc start 1\n```\n\n### Step 5 - share vnc connection directly to device\n```\n./droid start vnc://{your local ip address}:5900\n```\nHere we can also use `adb reverse tcp:5900 tcp:5900` to make a tunnel using usb cable, but it only works on android 5.0+.\n\n### Step 6 - clean\nShutdown display and remove configurations from it.\n```\n./display remove 1\n```  \n\n## if you still want to do it by hand\nFollow this [tutorial](https://github.com/Dlimaun/linux-second-screen/blob/master/tutorial.md).   \n\n\n# Similar apps\n~~This app will be made by the rage because we have a lot of apps for all other platforms\nOnly linux isn't supported by those apps.~~   \n* [AirDisplay](https://avatron.com/applications/air-display/)\n* [AirDisplay Android](https://play.google.com/store/apps/details?id=com.avatron.airdisplay)\n* [Splashtop](http://www.splashtop.com/downloads)*\n* [Splashtop Extended Display Android](https://play.google.com/store/apps/details?id=com.splashtop.remote.xdisplay)\n* [iDisplay Android](https://play.google.com/store/apps/details?id=com.idisplay.virtualscreen)\n* [DuetDisplay](http://www.duetdisplay.com/)\n\n\nSplashtop appear to have a beta, for linux.   \n\\o/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunodles%2Flinux-second-screen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunodles%2Flinux-second-screen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunodles%2Flinux-second-screen/lists"}