Skip to content

Commit a60bb02

Browse files
committed
refactor(wallpaper): rename path to applyPath
- Renamed the `path` property to `applyPath` across wallpaper types, schemas, and related functions to better reflect its purpose as the path used when applying the wallpaper. Updated all relevant API, type definitions, and UI components accordingly.
1 parent 0aa2a33 commit a60bb02

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

src/electron/main/trpc/routes/settings/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const schema: Schema<SettingsSchema> = {
138138
type: { type: "string", enum: ["image", "video", "wallpaper-engine"] },
139139
id: { type: "string", minLength: 1 },
140140
name: { type: "string", minLength: 1 },
141-
path: { type: "string", minLength: 1 },
141+
applyPath: { type: "string", minLength: 1 },
142142
monitors: {
143143
type: "array",
144144
minItems: 1,

src/electron/main/trpc/routes/wallpaper/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const setWallpaperSchema = z.object({
4141
type: z.enum(["image", "video", "wallpaper-engine"]),
4242
id: z.string().min(1),
4343
name: z.string().min(1),
44-
path: z.string().min(1),
44+
applyPath: z.string().min(1),
4545
monitors: monitorsSchema.min(1),
4646
wallpaperEngineOptions: z
4747
.object({

src/electron/main/trpc/routes/wallpaper/search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const getImageAndVideoWallpapers = async (type: "image" | "video") => {
3434
wallpapers.push({
3535
id: path.basename(file.path),
3636
name: file.name,
37-
path: file.path,
37+
applyPath: file.path,
3838
thumbnailPath: "", // Generated later
3939
fullSizePath: `${type}://${file.path}`,
4040
dateAdded: Date.now(),
@@ -113,7 +113,7 @@ const getWallpaperEngineWallpapers = async () => {
113113
type: "wallpaper-engine",
114114
id: path.basename(subdirectoryPath),
115115
name: parsedData.title,
116-
path: subdirectoryPath,
116+
applyPath: subdirectoryPath,
117117
thumbnailPath: "", // Generated later
118118
fullSizePath: `image://${path.join(subdirectoryPath, parsedData.preview)}`,
119119
dateAdded: stat.mtime.getTime(),

src/electron/main/trpc/routes/wallpaper/set.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const saveLastWallpaper = async (input: SetWallpaperInput) => {
3131

3232
const screenshotWallpaper = async (input: SetWallpaperInput) => {
3333
if (input.type === "image") {
34-
await copyWallpaperToDestinations(input.id, input.name, input.path);
34+
await copyWallpaperToDestinations(input.id, input.name, input.applyPath);
3535
} else if (input.type === "video") {
36-
await screenshotWallpaperInCage(["mpv", "panscan=1.0", input.path]);
36+
await screenshotWallpaperInCage(["mpv", "panscan=1.0", input.applyPath]);
3737
await copyWallpaperToDestinations(input.id, input.name, CAGE_SCREENSHOT_PATH);
3838
} else if (input.type === "wallpaper-engine") {
3939
const assetsPath = await caller.settings.get({
@@ -56,17 +56,17 @@ const screenshotWallpaper = async (input: SetWallpaperInput) => {
5656
assetsPath,
5757
"--window",
5858
"0x0x1280x720",
59-
input.path,
59+
input.applyPath,
6060
]);
6161
await copyWallpaperToDestinations(input.id, input.name, CAGE_SCREENSHOT_PATH);
6262
}
6363
};
6464

6565
const setWallpaper = async (input: SetWallpaperInput, detached: boolean) => {
6666
if (input.type === "image") {
67-
await setImageWallpaper(input.path, input.monitors, detached);
67+
await setImageWallpaper(input.applyPath, input.monitors, detached);
6868
} else if (input.type === "video") {
69-
await setVideoWallpaper(input.path, input.monitors, input.videoOptions, detached);
69+
await setVideoWallpaper(input.applyPath, input.monitors, input.videoOptions, detached);
7070
} else if (input.type === "wallpaper-engine") {
7171
const assetsPath = await caller.settings.get({
7272
key: "wallpaperSources.wallpaperEngineAssetsFolder",
@@ -81,7 +81,7 @@ const setWallpaper = async (input: SetWallpaperInput, detached: boolean) => {
8181

8282
await setWallpaperEngineWallpaper(
8383
assetsPath,
84-
input.path,
84+
input.applyPath,
8585
input.monitors,
8686
input.wallpaperEngineOptions,
8787
detached

src/electron/main/trpc/routes/wallpaper/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ export interface ApiWallpaper extends BaseWallpaper {
1515

1616
interface ImageWallpaper extends BaseWallpaper {
1717
type: "image";
18-
path: string;
18+
applyPath: string;
1919
dateAdded: number;
2020
tags: string[];
2121
}
2222

2323
interface VideoWallpaper extends BaseWallpaper {
2424
type: "video";
25-
path: string;
25+
applyPath: string;
2626
dateAdded: number;
2727
tags: string[];
2828
}
2929

3030
export interface WallpaperEngineWallpaper extends BaseWallpaper {
3131
type: "wallpaper-engine";
32-
path: string;
32+
applyPath: string;
3333
dateAdded: number;
3434
tags: string[];
3535
workshopId: string;

src/renderer/tabs/library/tabs/image.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const LibraryImageTab = () => {
6262
type: "image",
6363
id: wallpaper.id,
6464
name: wallpaper.name,
65-
path: wallpaper.path,
65+
applyPath: wallpaper.applyPath,
6666
monitors,
6767
});
6868
}}

src/renderer/tabs/library/tabs/video.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const LibraryVideoTab = () => {
7171
type: "video",
7272
id: wallpaper.id,
7373
name: wallpaper.name,
74-
path: wallpaper.path,
74+
applyPath: wallpaper.applyPath,
7575
monitors,
7676
videoOptions: controlValues,
7777
});

src/renderer/tabs/library/tabs/wallpaper-engine.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ const LibraryWallpaperEngineTab = () => {
286286
type: "wallpaper-engine",
287287
id: wallpaper.id,
288288
name: wallpaper.name,
289-
path: wallpaper.path,
289+
applyPath: wallpaper.applyPath,
290290
monitors,
291291
wallpaperEngineOptions: controlValues,
292292
});

0 commit comments

Comments
 (0)