set-wall 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # set-wall
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A simple interactive wallpaper manager for Linux using `swaybg`.
4
+
5
+ ## Requirements
6
+
7
+ Before installing, make sure you have:
8
+
9
+ - Linux
10
+ - A Wayland session
11
+ - [swaybg](https://github.com/swaywm/swaybg) installed
12
+ - Node.js and npm
13
+
14
+ ## Installation
15
+
16
+ Install globally using npm:
17
+
18
+ ```bash
19
+ npm install -g set-wall
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Run the command:
25
+
26
+ ```bash
27
+ set-wall
28
+ ```
29
+
30
+ Follow the interactive prompts to choose and set your wallpaper.
31
+
32
+ ## How it works
33
+
34
+ `set-wall` uses `swaybg` to display wallpapers on your Wayland desktop.
@@ -0,0 +1,2 @@
1
+ export declare function listDirectoryContents(): Promise<void>;
2
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAeA,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CA2F3D"}
@@ -0,0 +1,77 @@
1
+ import { input } from "@inquirer/prompts";
2
+ import * as fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { setWallpaper } from "./wallpaper.js";
5
+ import { previewImage,
6
+ //previewRandomImage,
7
+ validateImgFormat, } from "./image-utils.js";
8
+ import { previewRandomImage } from "./random-wallpaper.js";
9
+ export async function listDirectoryContents() {
10
+ try {
11
+ const userInput = await input({
12
+ message: "Enter a folder path to list it's contents:",
13
+ default: ".",
14
+ });
15
+ const resolvedPath = path.resolve(userInput);
16
+ const stats = await fs.stat(resolvedPath);
17
+ if (!stats.isDirectory()) {
18
+ console.error(`❌ Error: "${userInput}" is a file, not a directory.`);
19
+ return;
20
+ }
21
+ const items = await fs.readdir(resolvedPath);
22
+ if (items.length === 0) {
23
+ console.log(" The directory is empty.");
24
+ return;
25
+ }
26
+ console.log(`\n Contents of: ${resolvedPath}`);
27
+ console.log("-----------------------------------");
28
+ for (const item of items) {
29
+ const itemPath = path.join(resolvedPath, item);
30
+ const itemStats = await fs.stat(itemPath);
31
+ const prefix = itemStats.isDirectory() ? " " : "";
32
+ console.log(`${prefix} ${item}`);
33
+ }
34
+ console.log("-----------------------------------");
35
+ const imgFiles = await validateImgFormat(resolvedPath);
36
+ if (imgFiles.length === 0) {
37
+ console.log("No images found.");
38
+ return;
39
+ }
40
+ console.log(`\nImages found: ${imgFiles.length}`);
41
+ for (const image of imgFiles) {
42
+ const imagePath = path.join(resolvedPath, image);
43
+ console.log(`\n${image}`);
44
+ // await previewImage(imagePath); this part help the image to be listed on the terminal
45
+ }
46
+ const choose = await input({
47
+ message: "Choose an image (enter its filename or 'random'):",
48
+ default: "random",
49
+ });
50
+ if (choose === "random") {
51
+ await previewRandomImage(resolvedPath, imgFiles);
52
+ return;
53
+ }
54
+ if (!imgFiles.includes(choose)) {
55
+ console.log(`Error: "${choose}" is not an image in that directory.`);
56
+ return;
57
+ }
58
+ console.log(`You chose: "${choose}"`);
59
+ const imagePath = path.join(resolvedPath, choose);
60
+ await previewImage(imagePath);
61
+ setWallpaper(imagePath);
62
+ // Next step: use node:child_process to communicate with swaybg
63
+ // and set the selected image as the wallpaper.
64
+ }
65
+ catch (error) {
66
+ if (typeof error === "object" &&
67
+ error !== null &&
68
+ "code" in error &&
69
+ error.code === "ENOENT") {
70
+ console.error("Error: That path does not exist.");
71
+ return;
72
+ }
73
+ const message = error instanceof Error ? error.message : String(error);
74
+ console.error("An error occurred:", message);
75
+ }
76
+ }
77
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot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,MAAM,GAAG,CAAC,CAAC;QAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9B,YAAY,CAAC,SAAS,CAAC,CAAC;QAExB,+DAA+D;QAC/D,+CAA+C;IAEjD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACd,MAAM,IAAI,KAAK;YACf,KAAK,CAAC,IAAI,KAAK,QAAQ,EACvB,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function validateImgFormat(dirPath: string): Promise<string[]>;
2
+ export declare function previewImage(imagePath: string): Promise<void>;
3
+ //# sourceMappingURL=image-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-utils.d.ts","sourceRoot":"","sources":["../src/image-utils.ts"],"names":[],"mappings":"AAcA,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAe1E;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnE"}
@@ -0,0 +1,48 @@
1
+ import * as fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import terminalImage from "terminal-image";
4
+ const imgExtensions = [
5
+ ".jpg",
6
+ ".jpeg",
7
+ ".png",
8
+ ".gif",
9
+ ".webp",
10
+ ".svg",
11
+ ".bmp",
12
+ ];
13
+ export async function validateImgFormat(dirPath) {
14
+ try {
15
+ const files = await fs.readdir(dirPath);
16
+ return files.filter((file) => {
17
+ const ext = path.extname(file).toLowerCase();
18
+ return imgExtensions.includes(ext);
19
+ });
20
+ }
21
+ catch (error) {
22
+ const message = error instanceof Error ? error.message : String(error);
23
+ console.error(`Error reading directory: ${message}`);
24
+ return [];
25
+ }
26
+ }
27
+ export async function previewImage(imagePath) {
28
+ const imageOutput = await terminalImage.file(imagePath, {
29
+ width: 40,
30
+ height: 40,
31
+ });
32
+ console.log(imageOutput);
33
+ }
34
+ // export async function previewRandomImage(
35
+ // dirPath: string,
36
+ // imgFiles: string[],
37
+ // ): Promise<void> {
38
+ // const randomIndex = Math.floor(Math.random() * imgFiles.length);
39
+ // const randomImg = imgFiles[randomIndex];
40
+ // if (!randomImg) {
41
+ // return;
42
+ // }
43
+ // const imagePath = path.join(dirPath, randomImg);
44
+ // const imageOutput = await terminalImage.file(imagePath);
45
+ // console.log(`\nRandomly chosen: ${randomImg}`);
46
+ // console.log(imageOutput);
47
+ // }
48
+ //# sourceMappingURL=image-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-utils.js","sourceRoot":"","sources":["../src/image-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAE3C,MAAM,aAAa,GAAa;IAC9B,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;CACP,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe;IACrD,IAAI,CAAC;QACH,MAAM,KAAK,GAAa,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;YAE7C,OAAO,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,OAAO,CAAC,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,SAAiB;IAClD,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QACtD,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;KACX,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC3B,CAAC;AAED,4CAA4C;AAC5C,qBAAqB;AACrB,wBAAwB;AACxB,qBAAqB;AACrB,qEAAqE;AACrE,6CAA6C;AAE7C,sBAAsB;AACtB,cAAc;AACd,MAAM;AAEN,qDAAqD;AACrD,6DAA6D;AAE7D,oDAAoD;AACpD,8BAA8B;AAC9B,IAAI"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { intro } from "./intro.js";
3
+ import { listDirectoryContents } from "./directory.js";
4
+ intro();
5
+ await listDirectoryContents();
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,KAAK,EAAE,CAAC;AACR,MAAM,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function intro(): void;
2
+ //# sourceMappingURL=intro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intro.d.ts","sourceRoot":"","sources":["../src/intro.ts"],"names":[],"mappings":"AAWA,wBAAgB,KAAK,IAAI,IAAI,CAK5B"}
package/dist/intro.js ADDED
@@ -0,0 +1,15 @@
1
+ import * as p from "@clack/prompts";
2
+ //import color from "picocolors";
3
+ const colors = {
4
+ blue: "\x1b[38;2;137;180;250m",
5
+ mauve: "\x1b[38;2;203;166;247m",
6
+ text: "\x1b[38;2;205;214;244m",
7
+ reset: "\x1b[0m",
8
+ bold: "\x1b[1m",
9
+ };
10
+ export function intro() {
11
+ p.intro(
12
+ // `${colors.blue(colors.black(`Hello, Welcome to the ${colors.bold("set-wall")}`))}`,
13
+ `${colors.blue}${colors.bold} Welcome to ${colors.mauve}set-wall ${colors.reset}`);
14
+ }
15
+ //# sourceMappingURL=intro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intro.js","sourceRoot":"","sources":["../src/intro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,iCAAiC;AAEjC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,wBAAwB;IAC9B,KAAK,EAAE,wBAAwB;IAC/B,IAAI,EAAE,wBAAwB;IAC9B,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;CAChB,CAAA;AAED,MAAM,UAAU,KAAK;IACnB,CAAC,CAAC,KAAK;IACL,uFAAuF;IACvF,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,eAAe,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,KAAK,EAAE,CAClF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function previewRandomImage(dirPath: string, imgFiles: string[]): Promise<void>;
2
+ //# sourceMappingURL=random-wallpaper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-wallpaper.d.ts","sourceRoot":"","sources":["../src/random-wallpaper.ts"],"names":[],"mappings":"AAWA,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -0,0 +1,27 @@
1
+ // Random wallpaper settings.
2
+ // choose random wallpaper(for now).
3
+ // change wallpapers every one hour.
4
+ // import * from "./image-utils.ts";
5
+ // import * as imageUtils from "./image-utils.ts";
6
+ import path from "node:path";
7
+ import terminalImage from "terminal-image";
8
+ import { setWallpaper } from "./wallpaper.js";
9
+ export async function previewRandomImage(dirPath, imgFiles) {
10
+ const randomIndex = Math.floor(Math.random() * imgFiles.length);
11
+ const randomImg = imgFiles[randomIndex];
12
+ if (!randomImg) {
13
+ return;
14
+ }
15
+ const imagePath = path.join(dirPath, randomImg);
16
+ const imageOutput = await terminalImage.file(imagePath);
17
+ console.log(`\nRandomly chosen: ${randomImg}`);
18
+ console.log(imageOutput);
19
+ try {
20
+ setWallpaper(imagePath);
21
+ console.log('wallpaper changed successfully!!');
22
+ }
23
+ catch (err) {
24
+ console.log(`oops: ${err}`);
25
+ }
26
+ }
27
+ //# sourceMappingURL=random-wallpaper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-wallpaper.js","sourceRoot":"","sources":["../src/random-wallpaper.ts"],"names":[],"mappings":"AACA,6BAA6B;AAC7B,oCAAoC;AACpC,oCAAoC;AAEpC,oCAAoC;AACpC,kDAAkD;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAG,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAe,EACf,QAAkB;IAElB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAExC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAExD,OAAO,CAAC,GAAG,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAGzB,IAAI,CAAC;QAEH,YAAY,CAAC,SAAS,CAAC,CAAA;QACvB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;IAEjD,CAAC;IAAC,OAAM,GAAG,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;IAC9B,CAAC;AAEH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function setWallpaper(imagePath: string): void;
2
+ //# sourceMappingURL=wallpaper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallpaper.d.ts","sourceRoot":"","sources":["../src/wallpaper.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CA+BpD"}
@@ -0,0 +1,32 @@
1
+ // node:child_process thing
2
+ import { execSync, spawn } from "node:child_process";
3
+ import fs from "fs";
4
+ import path from "node:path";
5
+ // import { DiffieHellmanGroup } from "node:crypto";
6
+ let currentWallpaper = null;
7
+ export function setWallpaper(imagePath) {
8
+ if (currentWallpaper) {
9
+ currentWallpaper.kill();
10
+ }
11
+ execSync("pkill -x swaybg");
12
+ const targetPath = path.join(process.env.HOME || "/root", ".background");
13
+ fs.copyFileSync(imagePath, targetPath);
14
+ const wallpaper = spawn("swaybg", [
15
+ "-i",
16
+ targetPath,
17
+ "-m",
18
+ "fill",
19
+ ], {
20
+ detached: true,
21
+ stdio: "inherit",
22
+ });
23
+ wallpaper.unref();
24
+ currentWallpaper = wallpaper;
25
+ wallpaper.on("error", (error) => {
26
+ console.error("Failed to start swaybg:", error);
27
+ });
28
+ wallpaper.on("exit", (code) => {
29
+ console.log(`swaybg exited with code: ${code}`);
30
+ });
31
+ }
32
+ //# sourceMappingURL=wallpaper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallpaper.js","sourceRoot":"","sources":["../src/wallpaper.ts"],"names":[],"mappings":"AACA,2BAA2B;AAE3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,oDAAoD;AAEpD,IAAI,gBAAgB,GAAwB,IAAI,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,IAAI,gBAAgB,EAAE,CAAC;QACrB,gBAAgB,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,EAAE,aAAa,CAAC,CAAC;IAEzE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAEvC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE;QAChC,IAAI;QACJ,UAAU;QACV,IAAI;QACJ,MAAM;KACP,EAAE;QACD,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IACH,SAAS,CAAC,KAAK,EAAE,CAAC;IAElB,gBAAgB,GAAG,SAAS,CAAC;IAE7B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QAC9B,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "set-wall",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "A simple interactive wallpaper manager for Linux using swaybg.",
5
+ "main": "./dist/index.js",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "bin": {
11
+ "set-wall": "dist/index.js"
12
+ },
13
+ "scripts": {
14
+ "start": "node dist/index.js",
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ },
17
+ "keywords": [
18
+ "wallpaper",
19
+ "linux",
20
+ "wayland",
21
+ "swaybg",
22
+ "cli",
23
+ "typescript"
24
+ ],
25
+ "devDependencies": {
26
+ "@types/node": "^26.6.4",
27
+ "typescript": "^7.0.2"
28
+ },
29
+ "dependencies": {
30
+ "@clack/prompts": "^1.8.1",
31
+ "@inquirer/prompts": "^8.7.3",
32
+ "commander": "^15.0.0",
33
+ "picocolors": "^1.1.1",
34
+ "terminal-image": "^5.0.1"
35
+ }
36
+ }