{"id":23642429,"url":"https://github.com/sogaiu/janet-termsize","last_synced_at":"2026-01-24T07:32:01.190Z","repository":{"id":184680259,"uuid":"672303759","full_name":"sogaiu/janet-termsize","owner":"sogaiu","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-08T13:09:19.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T10:52:20.218Z","etag":null,"topics":["janet","terminal"],"latest_commit_sha":null,"homepage":"","language":"Janet","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sogaiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-29T16:00:55.000Z","updated_at":"2024-09-08T13:09:23.000Z","dependencies_parsed_at":"2023-07-29T17:20:57.816Z","dependency_job_id":"e87c7f63-cbbf-4224-862b-c2cd66a0f088","html_url":"https://github.com/sogaiu/janet-termsize","commit_stats":null,"previous_names":["sogaiu/janet-termsize"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogaiu%2Fjanet-termsize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogaiu%2Fjanet-termsize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogaiu%2Fjanet-termsize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogaiu%2Fjanet-termsize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sogaiu","download_url":"https://codeload.github.com/sogaiu/janet-termsize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239581760,"owners_count":19662960,"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":["janet","terminal"],"created_at":"2024-12-28T10:50:55.964Z","updated_at":"2025-11-10T15:30:21.771Z","avatar_url":"https://github.com/sogaiu.png","language":"Janet","funding_links":[],"categories":[],"sub_categories":[],"readme":"# janet-termsize\n\nA Janet implementation of determining a terminal's size (rows and\ncolumns).  No C compilation necessary.\n\n## Usage\n\n```janet\n(import termsize :as ts)\n\n(ts/rows-and-cols)\n# =\u003e\n[24 80]\n\n(ts/rows)\n# =\u003e\n24\n\n(ts/cols)\n# =\u003e\n80\n```\n\n## Notes\n\nPossibly of interest:\n\n* The `:web` \"operating system\" (emscripten) isn't supported, but\n  various attempts have been made to try to support others including:\n\n  * `:bsd` - BSD that isn't the other specific ones?\n  * `:cygwin`\n  * `:dragonfly`\n  * `:freebsd`\n  * `:linux` - includes Termux on Android\n  * `:macos`\n  * `:mingw`\n  * `:netbsd`\n  * `:posix` - some UNIXy machine not more specifically recognized?\n  * `:windows`\n\n  Not all have been tested though.  Please report if something isn't\n  working :)\n\n* Tries to use FFI where practical (ATM, only x86_64 + some operating\n  systems)\n\n* Falls back to external process methods (`stty` for Unixy systems and\n  powershell for Windows)\n\n* The function `rows-and-cols` hands things off to various helper\n  functions such as `via-ioctl`, `via-winapi`, or `via-shell`.  These\n  are exposed but no particular effort may be made to keep them the\n  same (or around) over time [1].\n\n* When implementing FFI-related bits for Windows, it was helpful to\n  examine [this\n  page](https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types)\n  to figure out what things like `DWORD`, `HANDLE`, etc. are under the\n  covers.  Once the underlying types were understood, [this\n  table](https://janet-lang.org/docs/ffi.html#Primitive-Types) was\n  used to determine a target keyword.  As an example, consider\n  `DWORD`.  According to the page at MS, it is:\n\n      \u003e A 32-bit unsigned integer. The range is 0 through 4294967295\n      \u003e decimal.\n\n  So taking that to mean `uint32_t`, according to the \"primitive\n  types\" table, that could be either `:uint32` or `:u32` (both\n  probably work).\n\n---\n\n[1] The author doesn't find making things private to be worth all of\n    the extra work that often seems to lead to (e.g. testing and\n    investigation typically become more cumbersome).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsogaiu%2Fjanet-termsize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsogaiu%2Fjanet-termsize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsogaiu%2Fjanet-termsize/lists"}