import { Gtk } from 'astal/gtk3'; import FileChooserButton from 'src/components/shared/FileChooserButton'; import { Opt } from 'src/lib/option'; const handleFileSet = (opt: Opt) => (self: Gtk.FileChooserButton): void => { const uri = self.get_uri(); if (!uri) { return; } try { const decodedPath = decodeURIComponent(uri.replace('file://', '')); opt.set(decodedPath as unknown as T); } catch (error) { console.error('Failed to decode URI:', error); } }; export const ImageInputter = ({ opt, }: ImageInputterProps): JSX.Element => { return ( { return handleFileSet(opt)(self); }} /> ); }; interface ImageInputterProps { opt: Opt; }