{"id":13806005,"url":"https://github.com/ttytm/dialog","last_synced_at":"2025-04-28T17:16:25.085Z","repository":{"id":198793571,"uuid":"701560370","full_name":"ttytm/dialog","owner":"ttytm","description":"A cross-platform utility library for V to open system dialogs - open files, message boxes, color-pickers etc.","archived":false,"fork":false,"pushed_at":"2024-10-17T18:53:48.000Z","size":31,"stargazers_count":30,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-28T17:16:15.311Z","etag":null,"topics":["cross-platform","dialog","file","filesystem","gtk2","gtk3","library","linux","macos","operating-system","os","ui","windows"],"latest_commit_sha":null,"homepage":"https://ttytm.github.io/dialog/","language":"V","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttytm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-06T23:14:58.000Z","updated_at":"2025-04-13T13:23:18.000Z","dependencies_parsed_at":"2024-11-17T23:02:40.865Z","dependency_job_id":null,"html_url":"https://github.com/ttytm/dialog","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"22f1b54381b59883f7d9f59f843af9f064eb8c45"},"previous_names":["ttytm/dialog"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttytm%2Fdialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttytm%2Fdialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttytm%2Fdialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttytm%2Fdialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttytm","download_url":"https://codeload.github.com/ttytm/dialog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251352639,"owners_count":21575865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-platform","dialog","file","filesystem","gtk2","gtk3","library","linux","macos","operating-system","os","ui","windows"],"created_at":"2024-08-04T01:01:07.080Z","updated_at":"2025-04-28T17:16:25.065Z","avatar_url":"https://github.com/ttytm.png","language":"V","funding_links":[],"categories":["Libraries"],"sub_categories":["Utility"],"readme":"# dialog\n\n\u003e A cross-platform utility library for V to open system dialogs - open files, message boxes,\n\u003e color-pickers etc.\n\n## Showcase\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003cth\u003eLinux\u003c/th\u003e\n    \u003cth\u003eWindows\u003c/th\u003e\n    \u003cth\u003emacOS\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"Linux File Dialog\" src=\"https://github.com/ttytm/dialog/assets/34311583/6ba6e96b-3581-4382-8074-79918a99dcbd\"\u003e\n    \u003c/td\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"Windows File Dialog\" src=\"https://github.com/ttytm/dialog/assets/34311583/911e8c71-0cc1-4426-a62c-04714b6b071f\"\u003e\n    \u003c/td\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"macOS File Dialog\" src=\"https://github.com/ttytm/dialog/assets/34311583/f7c4375e-d2e4-4121-ad34-db0473d8fabe\"\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ckbd\u003eToggle More\u003c/kbd\u003e\u003c/summary\u003e\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003cth\u003eLinux\u003c/th\u003e\n    \u003cth\u003eWindows\u003c/th\u003e\n    \u003cth\u003emacOS\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"Linux Color Picker GTK3\" src=\"https://github.com/ttytm/dialog/assets/34311583/8e587c8c-2f12-41ee-9a10-4c3f92e72885\"\u003e\n      \u003cimg alt=\"Linux Message\" src=\"https://github.com/ttytm/dialog/assets/34311583/42e1081b-ee52-4286-abfd-ad9eda63d282\"\u003e\n      \u003cimg alt=\"Linux Message with Yes and No Buttons\" src=\"https://github.com/ttytm/dialog/assets/34311583/07aa26bd-f887-417b-9c1a-56724ceb2589\"\u003e\n      \u003cimg alt=\"Linux Input Prompt\" src=\"https://github.com/ttytm/dialog/assets/34311583/bc5e3ec1-88b5-4e1a-b46e-381b322b8a6c\"\u003e\n      \u003cimg alt=\"Linux Color Picker GTK2\" src=\"https://github.com/ttytm/dialog/assets/34311583/37619ed0-8fe2-4e5c-af11-70d7f2304b2b\"\u003e\n    \u003c/td\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"Windows Color Picker\" src=\"https://github.com/ttytm/dialog/assets/34311583/966b1395-55ac-45b8-aa1b-516f673b64e8\"\u003e\n      \u003cimg alt=\"Windows Message\" src=\"https://github.com/ttytm/dialog/assets/34311583/a73e0eaf-e56b-44e6-bcc5-31bb381c6e37\"\u003e\n      \u003cimg alt=\"Windows Message with Yes and No Buttons\" src=\"https://github.com/ttytm/dialog/assets/34311583/16a1ad65-571e-4183-8c0b-119cbf126aec\"\u003e\n      \u003cimg alt=\"Windows Input Prompt\" src=\"https://github.com/ttytm/dialog/assets/34311583/54e4a708-de38-44ea-ae61-be39c1bdbff9\"\u003e\n    \u003c/td\u003e\n    \u003ctd width=\"400\"\u003e\n      \u003cimg alt=\"macOS Message\" src=\"https://github.com/ttytm/dialog/assets/34311583/15920c46-e529-405f-9731-3ac57ce46449\"\u003e\n      \u003cimg alt=\"macOS Message with Yes and No Buttons\" src=\"https://github.com/ttytm/dialog/assets/34311583/11cba10b-3190-4114-b1ad-e49e56d4498c\"\u003e\n      \u003cimg alt=\"macOS Input Prompt\" src=\"https://github.com/ttytm/dialog/assets/34311583/e6d496b4-3c20-4ece-8808-0eba99a59a45\"\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/details\u003e\n\n## Installation\n\n```sh\nv install https://github.com/ttytm/dialog\n```\n\nOn macOS, `dialog` currently uses V webview to ensure it can interop with system windows.\n\n```sh\n# macOS only dependency\nv install https://github.com/ttytm/webview\n~/.vmodules/webview/build.vsh\n```\n\n## Usage\n\n```v ignore\n// message launches a message box and returns `true` if `OK` or `Yes` was pressed.\npub fn message(message string, opts MessageOptions) bool\n\n// prompt launches an input prompt with an \"OK\" and \"Cancel\" button.\npub fn prompt(message string, opts PromptOptions) ?string\n\n// file_dialog opens a file dialog and returns the selected path or `none` if the selection was canceled.\npub fn file_dialog(opts FileDialogOptions) ?string\n\n// open_file opens a file dialog and returns the `os.File` of the selected file.\n// Optionally, `path` can be specified as the default folder the dialog will attempt to open in.\n// It returns an error if the selection was cancelled or if reading the file fails.\npub fn open_file(opts FileOpenOptions) !os.File\n\n// read_file opens a file dialog and reads the file contents of the selected file.\n// Optionally, `path` can be specified as the default folder the dialog will attempt to open in.\n// It returns an error if the selection was cancelled or if reading the file fails.\npub fn read_file(opts FileOpenOptions) !string\n\n// open_dir opens a file dialog and returns the path of the selected directory and a list of its contents.\n// Optionally, `path` can be specified as the default folder the dialog will attempt to open in.\n// It returns an error if the selection was cancelled or if reading the directory contents fails.\npub fn open_dir(opts FileOpenOptions) !(string, []string)\n\n// save_file opens a file dialog and saves the given content to the selected path.\n// Optionally, `path` can be specified as the default folder the dialog will attempt to open in.\n// `filename` can be provided to set the default text that will appear in the filename input.\n// It returns an error if the selection was canceled or if writing the file fails.\npub fn save_file(opts FileSaveOptions) !\n\n// color_picker opens an RGBA color picker dialog and returns the selected color or `none` if the\n// selection was canceled. Optionally, it takes a `color` and `opacity` argument. `color` sets the\n// dialogs initial color. `opacity` can be set to `false` to disable the opacity slider on Linux.\npub fn color_picker(opts ColorPickerOptions) ?Color\n```\n\n\u003e [!NOTE]\n\u003e v doc provides an overview of all public definitions. \\\n\u003e Use `v doc -comments dialog` in the terminal, or refer to the module's [doc pages](https://ttytm.github.io/dialog/dialog.html) in the browser.\n\n### Example\n\n```v\nmodule main\n\nimport dialog\n\ndialog.message('Thanks for using dialog!')\n\nif !dialog.message('Do you want to continue?', buttons: .yes_no) {\n\tdump('Canceled!')\n}\n\ninput := dialog.prompt('What is your pets name?')\ndump(input)\n\nselected_file := dialog.file_dialog()\ndump(selected_file)\n\nselected_color := dialog.color_picker()\ndump(selected_color)\n```\n\n```sh\nv run examples/minimal.v\n```\n\n\u003e [!TIP]\n\u003e When running and building on Windows, it is recommended to use `gcc` for compilation. E.g.:\n\u003e\n\u003e ```sh\n\u003e v -cc gcc run examples/minimal.v\n\u003e ```\n\n## Disclaimer\n\nThe project is made public in an early stage. Best practices and quality will be paramount\nthroughout development, but it may undergo drastic changes while maturing.\n\nIf the library could already achieve it's goal of also helping your project, or just to share some\nlove, filling the ☆ of this repo with color will warm the heart of your fellow developer.\n\n## Credits\n\n- [AndrewBelt/osdialog](https://github.com/AndrewBelt/osdialog) - C project that `dialog` binds to.\n- [vlang/v](https://github.com/vlang/v) - Simple-to-use, developer-friendly system programming with\n  high interoperability.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttytm%2Fdialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttytm%2Fdialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttytm%2Fdialog/lists"}