UNPKG

sway-tools

Version:

Some tools and a library for controlling sway

28 lines (27 loc) 861 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const shelljs = require("shelljs"); const _ = require("lodash"); const fs = require("fs-extra"); const __1 = require(".."); const minimist = require("minimist"); (async function () { const args = minimist(process.argv.slice(2)); const bgDirectory = args._[0]; const exists = await fs.pathExists(bgDirectory); if (exists === false) { console.error(`Path ${bgDirectory} does not exists`); process.exit(1); } const sway = new __1.Sway(); const outputs = await sway.getOutputs(); const files = shelljs .exec(`find ${bgDirectory} -type f`, { async: false, silent: true, }) .split('\n'); for (const output of outputs) { await sway.output(output).bg(_.sample(files), 'fill').exec(); } })();