{"id":30207613,"url":"https://github.com/nstechbytes/detect-desktop","last_synced_at":"2026-03-05T02:01:45.096Z","repository":{"id":295180416,"uuid":"989416057","full_name":"NSTechBytes/detect-desktop","owner":"NSTechBytes","description":"Detect when Windows desktop is in foreground.","archived":false,"fork":false,"pushed_at":"2025-05-28T01:46:12.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-16T00:19:41.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/NSTechBytes.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-05-24T03:57:35.000Z","updated_at":"2025-05-27T04:59:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d70f743-3dfe-4e76-bcd4-38dff4b12672","html_url":"https://github.com/NSTechBytes/detect-desktop","commit_stats":null,"previous_names":["nstechbytes/detect-desktop"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/NSTechBytes/detect-desktop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSTechBytes%2Fdetect-desktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSTechBytes%2Fdetect-desktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSTechBytes%2Fdetect-desktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSTechBytes%2Fdetect-desktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NSTechBytes","download_url":"https://codeload.github.com/NSTechBytes/detect-desktop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSTechBytes%2Fdetect-desktop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30106129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T01:39:18.192Z","status":"online","status_checked_at":"2026-03-05T02:00:06.710Z","response_time":93,"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":[],"created_at":"2025-08-13T16:11:48.221Z","updated_at":"2026-03-05T02:01:45.091Z","avatar_url":"https://github.com/NSTechBytes.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖥️ desktop-detector\n\nA small Windows utility and Node.js wrapper that detects when the desktop becomes the foreground window (i.e., when all applications are minimized).\n\nThis version improves detection by distinguishing between a true \"Show Desktop\" (triggered via Win+D or the taskbar button) and a simple click on the desktop:\n\n* **Show Desktop** is recognized when:\n    * Any window minimize-start event occurs within a 500-millisecond window before desktop activation (meaning a \"burst\" of one or more minimization events).\n    * It is triggered via the \"Show Desktop\" button or the Win+D hotkey.\n* A **plain click** on the desktop is ignored as a \"Show Desktop\" event and logs only a simple \"shown\" state.\n\n---\n\n## ⚙️ Features\n\n* Detects when the Windows desktop is shown or hidden (based on focus).\n* Distinguishes \"Show Desktop\" (via key/button) from ordinary clicks.\n* Exposes a clean JavaScript API for use in Node.js.\n* Optional `--quiet` and `--log` CLI flags for flexible output.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install desktop-detector\n```\n\nOr clone it:\n\n```bash\ngit clone https://github.com/nstechbytes/desktop-detector.git\ncd desktop-detector\nnpm install\n```\n\n---\n\n## 🚀 Usage\n\n### In Node.js:\n\n```js\nconst { startDesktopDetector } = require('desktop-detector');\n\n// Start monitoring\nconst proc = startDesktopDetector({\n  quiet: false, // show console output\n  log: true     // also log to `detect-desktop.log`\n});\n\n// Optional: stop after 10 seconds\nsetTimeout(() =\u003e {\n  proc.kill();\n  console.log(\"Stopped detector.\");\n}, 10000);\n```\n\n---\n\n## 🧰 CLI Options\n\nYou can also run the binary directly:\n\n```bash\n./bin/detect-desktop.exe [--quiet] [--log] [--help]\n```\n\n| Flag      | Description                               |\n| --------- | ----------------------------------------- |\n| `--quiet` | Suppresses console output                 |\n| `--log`   | Logs output to `detect-desktop.log`       |\n| `--help`  | Displays usage information                |\n\n---\n\n## 🧪 Example Output\n\n```\n[2025-05-24 16:00:00] Initial state: Desktop is BACKGROUND\n[2025-05-24 16:00:00] Listening for Show Desktop; press Ctrl+C to exit.\n[2025-05-24 16:01:10] *** Desktop is now FOREGROUND (Show Desktop)\n[2025-05-24 16:01:12] *** Desktop is now BACKGROUND (apps restored via desktopMode)\n[2025-05-24 16:02:00] *** Desktop is now FOREGROUND (shown)\n```\n\n---\n\n## 📜 License\n\nMIT © nstechbytes","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstechbytes%2Fdetect-desktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnstechbytes%2Fdetect-desktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstechbytes%2Fdetect-desktop/lists"}