https://github.com/ccnokes/node-desktop-bg
Native node module for setting the desktop background (Mac OSX only currently)
https://github.com/ccnokes/node-desktop-bg
Last synced: about 1 year ago
JSON representation
Native node module for setting the desktop background (Mac OSX only currently)
- Host: GitHub
- URL: https://github.com/ccnokes/node-desktop-bg
- Owner: ccnokes
- Created: 2016-05-19T04:59:04.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-19T05:04:54.000Z (about 10 years ago)
- Last Synced: 2025-03-09T07:39:26.344Z (over 1 year ago)
- Language: Objective-C++
- Size: 2.93 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-desktop-bg
This is my first attempt at a native node module. It only works on Mac OSX currently. Maybe I'll try to get Windows and Linux working on it someday.
## API
### `getDesktopImages`
This returns:
```javascript
[
{
filepath: '/Library/Desktop Pictures/Earth and Moon.jpg', //absolute path to file
isMain: true, // is it the main screen or a secondary?
id: 2077750397 // the screeen id. note that this changes if the user connects/disconnects a display
}
]
```
### `setDesktopImages`
Params:
```
{int|string} screen id|"main"
{string} File URL to new image. Must start with "file://"
```
Returns `true` if it worked. The existence of the file URL is not checked.
## Sample
```javascript
const DesktopBg = require('node-desktop-bg');
console.log(DesktopBg.getDesktopImages());
DesktopBg.getDesktopImages().forEach(screen => {
DesktopBg.setDesktopImage(screen.id, 'file:///Images/RickAstley/Rickrolling.png');
});
```