sway-tools
Version:
Some tools and a library for controlling sway
29 lines (28 loc) • 904 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const shelljs = require("shelljs");
const _ = require("lodash");
const fs = require("fs-extra");
const sway_1 = require("../../services/sway");
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 sway_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();
}
})();