{"id":13396781,"url":"https://github.com/sindresorhus/wallpaper","last_synced_at":"2025-05-15T05:00:14.285Z","repository":{"id":29807029,"uuid":"33351424","full_name":"sindresorhus/wallpaper","owner":"sindresorhus","description":"Manage the desktop wallpaper","archived":false,"fork":false,"pushed_at":"2024-07-22T10:58:53.000Z","size":6374,"stargazers_count":1068,"open_issues_count":12,"forks_count":91,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-05-06T07:30:07.009Z","etag":null,"topics":["desktop-wallpaper","javascript","linux","macos","nodejs","wallpaper","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sindresorhus.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},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-04-03T07:04:15.000Z","updated_at":"2025-04-29T10:48:49.000Z","dependencies_parsed_at":"2023-10-16T11:08:03.272Z","dependency_job_id":"58c77445-42e8-4721-ad60-661ba5086305","html_url":"https://github.com/sindresorhus/wallpaper","commit_stats":{"total_commits":98,"total_committers":20,"mean_commits":4.9,"dds":0.2142857142857143,"last_synced_commit":"0e1f735b27bc182809551d753b2c7cc74977163d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwallpaper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwallpaper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwallpaper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwallpaper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/wallpaper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253451755,"owners_count":21910773,"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":["desktop-wallpaper","javascript","linux","macos","nodejs","wallpaper","windows"],"created_at":"2024-07-30T18:01:02.989Z","updated_at":"2025-05-15T05:00:13.896Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["系统","JavaScript","Packages","包","HarmonyOS","目录","Command-line apps"],"sub_categories":["Command-line apps","命令行程序","Windows Manager","命令行应用"],"readme":"# wallpaper\n\n\u003e Get or set the desktop wallpaper\n\nWorks on macOS 10.14.4+, Linux, and Windows 10+.\n\n*Maintainer needed for the Linux part of the code. No new Linux-related changes will be accepted until someone with good Linux knowledge volunteers.*\n\n## Install\n\n```sh\nnpm install wallpaper\n```\n\n## Usage\n\n```js\nimport {getWallpaper, setWallpaper} from 'wallpaper';\n\nawait setWallpaper('unicorn.jpg');\n\nawait getWallpaper();\n//=\u003e '/Users/sindresorhus/unicorn.jpg'\n```\n\n## API\n\n### getWallpaper(options?)\n\nReturns a `Promise\u003cstring\u003e` with the path of the current desktop wallpaper.\n\n#### options\n\nType: `object`\n\n##### screen *(macOS only)*\n\nType: `string | number`\\\nValues: `'all'`, `'main'`, or the index of a screen from `.screens()`\\\nDefault: `'main'`\n\nThe screen to get the wallpaper from.\n\nIf you set `'all'` then `getWallpaper()` will return a `Promise\u003cstring[]\u003e`.\n\n### setWallpaper(imagePath, options?)\n\nReturns a `Promise`.\n\nOn macOS, it sets the wallpaper on the active space. There is no way to set it on all spaces.\n\n#### imagePath\n\nType: `string`\n\nThe path to the image to set as the desktop wallpaper.\n\n#### options\n\nType: `object`\n\n##### screen *(macOS only)*\n\nType: `string | number`\\\nValues: `'all'`, `'main'`, or the index of a screen from `.screens()`\nDefault: `'all'`\n\nThe screen to set the wallpaper on.\n\n*On Linux and Windows it's hard-coded to `'main'`.*\n\n##### scale *(macOS \u0026 Windows)*\n\nType: `string`\\\nmacOS Values: `'auto' | 'fill' | 'fit' | 'stretch' | 'center'`\\\nWindows Values: `'center' | 'stretch' | 'tile' | 'span' | 'fit' | 'fill'`\\\nDefault macOS: `'auto'`\\\nDefault Windows: `'span'`\n\nScaling method.\n\n### setSolidColorWallpaper(color, options?) *(macOS only)*\n\nReturns a `Promise`.\n\n#### color\n\nType: `string`\n\nThe color to set as a RGB Hex value. For example, `000000` for black.\n\n#### options\n\nType: `object`\n\n##### screen\n\nType: `string | number`\\\nValues: `'all'`, `'main'`, or the index of a screen from `.screens()`\nDefault: `'all'`\n\nThe screen to set the wallpaper on.\n\n```js\nimport {setSolidColorWallpaper} from 'wallpaper';\n\nawait setSolidColorWallpaper('000000');\n```\n\n### screens() *(macOS only)*\n\nReturns a `Promise\u003cstring[]\u003e` with the available screens.\n\n```js\nimport {screens} from 'wallpaper';\n\nawait screens();\n//=\u003e ['Color LCD']\n```\n\n## FAQ\n\n#### How can I set a website as a static wallpaper?\n\nIf you only need a static snapshot of the website, you can use [`capture-website`](https://github.com/sindresorhus/capture-website) and then pass the result to this package. You can make it semi-dynamic, by capturing the website snapshot every 10 seconds, for example.\n\n#### How can I set a website, video, or WebGL as a dynamic wallpaper?\n\nYou cannot use this package to set a dynamic wallpaper.\n\nOn macOS, check out [Plash](https://github.com/sindresorhus/Plash), which lets you set any website as your wallpaper. The website could contain a fullscreen video, WebGL, slideshow, animated, etc.\n\nYou can also do this with Electron on macOS and Linux by using [`new BrowserWindow({type: 'desktop'})`](https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions).\n\nOn Windows, you can use [Wallpaper Engine](https://wallpaperengine.io). It's available on Steam, HumbleBundle, and Green Man Gaming for around 4 USD.\n\n## Related\n\n- [wallpaper-cli](https://github.com/sindresorhus/wallpaper-cli) - CLI for this module\n- [macos-wallpaper](https://github.com/sindresorhus/macos-wallpaper) - macOS binary used in this module\n- [windows-wallpaper](https://github.com/sindresorhus/windows-wallpaper) - Windows binary used in this module\n- [trash](https://github.com/sindresorhus/trash) - Move files and directories to the trash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fwallpaper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fwallpaper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fwallpaper/lists"}