How to use the wallpaper.set function in wallpaper

To help you get started, we’ve selected a few wallpaper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github builtbyproxy / Weebg / index.js View on Github external
//Replace Old Wallpaper
            // fs.unlinkSync(path);
            await setImgName();
            console.log("   2. Image Should Be Replaced");

            //Set Wallpaper
            await wallpaper.set(path);
            console.log("   3. Image Should Be Set");
            declareStatus();

        } else if(err.code == 'ENOENT') {
            await setImgName();
            console.log("   2. Image Should Be Saved");

            //Set Wallpaper
            await wallpaper.set(path);
            console.log("   3. Image Should Be Set");
            declareStatus();
        }
    });
}
github splash-cli / splash-cli / src / libs / download.js View on Github external
if (fs.existsSync(img) && !quiet) {
    spinner.stop();

    printBlock(chalk`Hey! That photo is already on your computer!`);

    const a = await prompt([
      {
        name: "again",
        message: "Do you want to download it again?",
        prefix: chalk.green("%"),
        type: "confirm"
      }
    ]);

    if (!a.again) {
      if (setAsWallpaper) wallpaper.set(img);

      // Display 'shot by ...'
      console.log();
      showCopy(photo, info);

      return;
    }

    spinner.start();
  }

  const file = fs.createWriteStream(img);

  try {
    https.get(url, response => {
      response.pipe(file).on("finish", () => {
github splash-cli / splash-cli / src / client.js View on Github external
}

	if (!command) {
		console.clear();
		if (!flags.me && !flags.updateMe && !flags.set) spinner.start('Connecting to Unsplash');

		if (flags.set) {
			const filePath = pathFixer(flags.set);

			if (fs.existsSync(filePath) && isImage(filePath)) {
				let options = {};

				if (flags.scale) options.scale = flags.scale;
				if (flags.screen) options.screen = flags.screen;

				wallpaper.set(filePath, options);

				return printBlock('Wallpaper updated!');
			}

			return errorHandler('File not found.');
		}

		try {
			let photo = false;

			// here you can add your own custom flags
			if (flags.day) {
				photo = await Unsplash.shared.picOfTheDay();
			} else if (flags.curated) {
				const response = await Unsplash.shared.getRandomPhoto({ collection: 317099 });
				const photos = await response.json();
github RWOverdijk / hasselhoff / index.js View on Github external
#!/usr/bin/env node

const wallpaper = require('wallpaper');
const fs = require('fs');
const path = require('path');
const images = fs.readdirSync(path.join(__dirname, 'img'));
const index = Math.floor(Math.random() * images.length);

wallpaper.set(path.join(__dirname, 'img', images[index])).then(() => {
  console.log('Your day just got hassel of a lot better.');
});
github splash-cli / splash-cli / index.js View on Github external
response.pipe(file).on('finish', () => {
			wallpaper.set(pic_dir + '/' + photo_name + '.jpg');
			spinner.succeed();

			if ( program.info ) {
				console.log('');
				console.log(`ID: ${photo.id.yellow}`);
				console.log('');

				if ( photo.exif !== undefined ) {
					if (photo.exif.make) {
						console.log('Make: '.yellow.bold + photo.exif.make);
					} else {
						console.log('Make: '.yellow.bold + '--');
					}
					if (photo.exif.model) {
						console.log('Model: '.yellow.bold + photo.exif.model);
					} else {
github sindresorhus / wallpaper-cli / cli.js View on Github external
(async () => {
	if (input) {
		if (isUrl(input)) {
			const file = tempfile(path.extname(input));

			got
				.stream(input)
				.pipe(fs.createWriteStream(file))
				.on('finish', async () => {
					await wallpaper.set(file, cli.flags);
				});
		} else {
			await wallpaper.set(input, cli.flags);
		}
	} else {
		console.log(await wallpaper.get());
	}
})();
github micahcowan / starfishjs / starfish.js View on Github external
function maybeSetWallpaper() {
    if (!opts.wallpaper) return;
    verbose('Setting wallpaper...');
    //require('wallpaper').set(opts.output, {scale: 'tile'});
    require('wallpaper').set(opts.output);
}
github 1j01 / 98 / programs / jspaint / src / functions.js View on Github external
fs.writeFile(imgPath, base64, "base64", function(err){
			if(err){
				return show_error_message("Failed to set as desktop background: couldn't write temporary image file.", err);
			}
			wallpaper.set(imgPath, function(err){
				if(err){
					show_error_message("Failed to set as desktop background!", err);
				}
			});
		});
	}else{
github marvin-js / marvin / src / commands / wallpaper.js View on Github external
export default function (opts, path) {
  if (path) {
    return wallpaper.set(path);
  }

  return wallpaper.get();
}

wallpaper

Manage the desktop wallpaper

MIT
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis

Popular wallpaper functions