{"id":18053818,"url":"https://github.com/hymkor/go-getch","last_synced_at":"2025-04-10T22:53:21.345Z","repository":{"id":57712823,"uuid":"60702954","full_name":"hymkor/go-getch","owner":"hymkor","description":"A Library to read the console-event (keyboard-hits or screen-resize) for Go on Windows.","archived":false,"fork":false,"pushed_at":"2018-12-23T07:56:17.000Z","size":31,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T22:53:15.501Z","etag":null,"topics":["go","windows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hymkor.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}},"created_at":"2016-06-08T14:11:48.000Z","updated_at":"2024-11-15T03:46:49.000Z","dependencies_parsed_at":"2022-09-05T22:50:44.047Z","dependency_job_id":null,"html_url":"https://github.com/hymkor/go-getch","commit_stats":null,"previous_names":["zetamatta/go-getch"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-getch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-getch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-getch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-getch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hymkor","download_url":"https://codeload.github.com/hymkor/go-getch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312172,"owners_count":21082638,"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":["go","windows"],"created_at":"2024-10-31T00:08:11.243Z","updated_at":"2025-04-10T22:53:21.319Z","avatar_url":"https://github.com/hymkor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/zetamatta/go-getch?status.svg)](https://godoc.org/github.com/zetamatta/go-getch)\r\n\r\ngo-getch\r\n=========\r\n\r\n`go-getch` is a library to read the console-event \r\n(keyboard-hits or screen-resize),\r\nfor the programming language Go for Windows,\r\n\r\nExample\r\n-------\r\n\r\n    package main\r\n\r\n    import (\r\n        \"fmt\"\r\n\r\n        \"github.com/zetamatta/go-getch\"\r\n    )\r\n\r\n    const COUNT = 5\r\n\r\n    func main() {\r\n        for i := 0; i \u003c COUNT; i++ {\r\n            fmt.Printf(\"[%d/%d] \", i+1, COUNT)\r\n            e := getch.All()\r\n            if k := e.Key; k != nil {\r\n                fmt.Printf(\"\\n%c %08X %08X %08X\\n\",\r\n                    k.Rune, k.Rune, k.Scan, k.Shift)\r\n            } else if r := e.Resize; r != nil {\r\n                fmt.Printf(\"\\nWidth=%d Height=%d\\n\", r.Width, r.Height)\r\n            } else {\r\n                fmt.Println(\"\\n(unknown event)\")\r\n            }\r\n        }\r\n    }\r\n\r\n- `go-getch` supports the surrogate pair of Unicode.\r\n- `go-getch` is used in Windows CUI Shell [NYAGOS](https://github.com/zetamatta/nyagos)\r\n\r\nTypes\r\n-----\r\n\r\n\ttype Event struct {\r\n\t\tFocus   *struct{}\r\n\t\tKey     *keyEvent // == KeyDown\r\n\t\tKeyDown *keyEvent\r\n\t\tKeyUp   *keyEvent\r\n\t\tMenu    *struct{}\r\n\t\tMouse   *struct{}\r\n\t\tResize  *resizeEvent\r\n\t}\r\n\r\n\ttype keyEvent struct {\r\n\t\tRune  rune\r\n\t\tScan  uint16\r\n\t\tShift uint32\r\n\t}\r\n\r\n\ttype resizeEvent struct {\r\n\t\tWidth  uint\r\n\t\tHeight uint\r\n\t}\r\n\r\nFunctions\r\n---------\r\n\r\n### func All() Event\r\n\r\nGet all keyboard events.\r\n\r\n### func Rune() rune\r\n\r\nGet a KeyDown event.\r\n\r\n### func Within(msec uintptr) (Event, error)\r\n\r\nGet all keyboard events with time-out.\r\n\r\n### func RuneWithin(msec uintptr) (rune, error)\r\n\r\nGet a KeyDown event with time-out.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fgo-getch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhymkor%2Fgo-getch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fgo-getch/lists"}