Files
custum-hyprpanel/src/components/settings/shared/inputs/wallpaper.tsx
Jas Singh 5f72b4f5e1 Workspaces now show up on their appropriate monitors. (#681)
* Workspaces now show up on their appropriate monitors.

* Fixed undefined rules showing up.
2024-12-31 01:33:40 -08:00

28 lines
827 B
TypeScript

import FileChooserButton from 'src/components/shared/FileChooserButton';
import { Opt } from 'src/lib/option';
import Wallpaper from 'src/services/Wallpaper';
export const WallpaperInputter = <T extends string | number | boolean | object>({
opt,
}: WallpaperInputterProps<T>): JSX.Element => {
if (typeof opt.get() === 'string') {
return (
<FileChooserButton
onFileSet={(self) => {
const newValue: string = self.get_uri()!.replace('file://', '');
opt.set(newValue as T);
if (options.wallpaper.enable.get()) {
Wallpaper.setWallpaper(newValue);
}
}}
/>
);
}
return <box />;
};
interface WallpaperInputterProps<T> {
opt: Opt<T>;
}