{"id":21657641,"url":"https://github.com/vannrr/rofi-api","last_synced_at":"2025-09-09T13:46:28.159Z","repository":{"id":257790232,"uuid":"861060426","full_name":"VannRR/rofi-api","owner":"VannRR","description":"A go library for using the rofi API.","archived":false,"fork":false,"pushed_at":"2024-10-16T01:50:17.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T07:07:29.056Z","etag":null,"topics":["api","go","golang","library","rofi","rofi-scripts"],"latest_commit_sha":null,"homepage":"","language":"Go","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/VannRR.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":"2024-09-21T22:25:25.000Z","updated_at":"2024-10-16T01:46:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"8351bc61-4397-4f23-bea8-915c3670f395","html_url":"https://github.com/VannRR/rofi-api","commit_stats":null,"previous_names":["vannrr/rofi-api"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VannRR%2Frofi-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VannRR%2Frofi-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VannRR%2Frofi-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VannRR%2Frofi-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VannRR","download_url":"https://codeload.github.com/VannRR/rofi-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554955,"owners_count":20471330,"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":["api","go","golang","library","rofi","rofi-scripts"],"created_at":"2024-11-25T09:27:23.325Z","updated_at":"2025-03-20T05:22:15.730Z","avatar_url":"https://github.com/VannRR.png","language":"Go","readme":"# rofiapi\n\n#### `import github.com/VannRR/rofi-api`\n\nrofiapi, for use with https://github.com/davatorium/rofi also see man rofi-script\n\n## Usage\n\nA simple script would be:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\trofiapi \"github.com/VannRR/rofi-api\"\n)\n\n// make sure the fields of the struct are public/capitalized\ntype data struct {\n\tNumber uint16\n}\n\nfunc main() {\n\t// can be simplified in this case to NewRofiApi(0)\n\tapi, err := rofiapi.NewRofiApi(data{Number: 0})\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\\n\", err)\n\t}\n\n\tselectedEntry, ok := api.GetSelectedEntry()\n\n\tif !ok {\n\t\tapi.Entries = append(api.Entries, rofiapi.Entry{Text: \"initial run\"})\n\t}\n\n\tif selectedEntry.Text == \"quit\" {\n\t\treturn\n\t}\n\n\tsomeEntries := []rofiapi.Entry{\n\t\t{Text: fmt.Sprintf(\"counter: %d\", api.Data.Number)},\n\t\t{Text: \"quit\"},\n\t}\n\tapi.Entries = append(api.Entries, someEntries...)\n\n\tapi.Data.Number += 1\n\n\t//call last\n\terr = api.Draw()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\\n\", err)\n\t}\n}\n```\nThis shows three entries, initial run, counter and quit.\n- initial run: only displayed when there is no input/entry from rofi\n- counter: shows the value of data.number as it increments\n- quit : when the quit entry is selected, rofi closes\n\n***For more info check `DOCS.md`.***\n\n#### Notes\nI recommend compiling your rofi script/go binary with `go build -ldflags=\"-w -s\"` for a smaller size.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvannrr%2Frofi-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvannrr%2Frofi-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvannrr%2Frofi-api/lists"}