{"id":13341346,"url":"https://github.com/disruptek/swayipc","last_synced_at":"2025-07-04T03:05:30.022Z","repository":{"id":78132308,"uuid":"199055999","full_name":"disruptek/swayipc","owner":"disruptek","description":"swayipc (i3ipc) for Nim","archived":false,"fork":false,"pushed_at":"2020-12-30T17:11:30.000Z","size":101,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T16:18:30.942Z","etag":null,"topics":["client","i3","i3ipc","ipc","library","manager","nim","sway","swaymsg","swaywm","wayland","window","x11"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/disruptek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"disruptek"}},"created_at":"2019-07-26T17:29:31.000Z","updated_at":"2023-04-15T09:42:57.000Z","dependencies_parsed_at":"2023-02-24T02:00:21.673Z","dependency_job_id":null,"html_url":"https://github.com/disruptek/swayipc","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/disruptek/swayipc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fswayipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fswayipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fswayipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fswayipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/disruptek","download_url":"https://codeload.github.com/disruptek/swayipc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fswayipc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263437174,"owners_count":23466362,"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":["client","i3","i3ipc","ipc","library","manager","nim","sway","swaymsg","swaywm","wayland","window","x11"],"created_at":"2024-07-29T19:25:24.423Z","updated_at":"2025-07-04T03:05:29.978Z","avatar_url":"https://github.com/disruptek.png","language":"Nim","funding_links":["https://github.com/sponsors/disruptek","https://www.buymeacoffee.com/disruptek"],"categories":[],"sub_categories":[],"readme":"# swayipc\n\n[![Test Matrix](https://github.com/disruptek/swayipc/workflows/CI/badge.svg)](https://github.com/disruptek/swayipc/actions?query=workflow%3ACI)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/disruptek/swayipc?style=flat)](https://github.com/disruptek/swayipc/releases/latest)\n![Minimum supported Nim version](https://img.shields.io/badge/nim-1.0.8%2B-informational?style=flat\u0026logo=nim)\n[![License](https://img.shields.io/github/license/disruptek/swayipc?style=flat)](#license)\n[![buy me a coffee](https://img.shields.io/badge/donate-buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/disruptek)\n\nIt's like swaymsg (in sway) or i3ipc (in i3) but in native Nim.\n\nYou might find these docs for i3ipc useful: https://i3wm.org/docs/ipc.html\n\nSee also [the useful examples below](#examples).\n\n## Documentation\nSee [the documentation for the swayipc module](https://disruptek.github.io/swayipc/swayipc.html) as generated directly from the source.\n\n## Usage\n```nim\nimport asyncdispatch\nfrom strutils import spaces\n\nimport swayipc\n\nproc dump(tree: TreeReply; indent=0) =\n  echo indent.spaces, tree.id, \" \", tree.`type`\n  for n in tree.nodes:\n    n.dump(indent + 2)\n  for n in tree.floating_nodes:\n    n.dump(indent + 2)\n\nvar\n  # connect to a compositor at an optional socket path\n  compositor = waitFor newCompositor(\"../some/path\")\n  # synchronous tree retrieval\n  reply = compositor.invoke(GetTree)\n\ndump(reply.tree)\n#1 root\n#  2147483647 output\n#    2147483646 workspace\n#  15 output\n#    26 workspace\n#      28 con\n#      39 con\n#      49 floating_con\n#    37 workspace\n#      36 con\n#    38 workspace\n#      34 con\n#    50 workspace\n#      6 floating_con\n#    7 workspace\n#      5 con\n\n# you can pass extra arguments for a command (as strings)\nreply = waitFor GetBarConfig.invoke(\"status\")\nassert reply.bar.config.mode == \"hide\"\n\n# you can invoke `send` to instantiate the compositor\nblock:\n  var\n    compositor = waitFor RunCommand.send(\"opacity 0.5\")\n\n    # receive the reply\n    receipt = waitFor compositor.recv()\n\n    # maybe you want to twiddle your own json?\n    js = receipt.data\n\n    # or, nah, that's silly...\n    reply = receipt.reply\n\n  # multiple command results are returned as a sequence\n  assert reply.ran[0].success\n\n# an example subscription iterator:\niterator focusChanges(): WindowEvent =\n  let compositor = waitFor Subscribe.send(\"[\\\"window\\\"]\")\n  while true:\n    let receipt = waitFor compositor.recv()\n    if receipt.kind != EventReceipt:\n      continue\n    if receipt.event.kind != Window:\n      continue\n    if receipt.event.change != \"focus\":\n      continue\n    yield receipt.event.window\n\nfor window in focusChanges():\n  echo window.name, \" now has focus\"\n```\n\n## Examples\n- [reposition and resize floating windows matching any of a series of regexps](https://github.com/disruptek/xs/blob/master/geometry.nim)\n- [automagically adjust the opacity of windows according to whether they are focussed](https://github.com/disruptek/xs/blob/master/autoopacity.nim)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fswayipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisruptek%2Fswayipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fswayipc/lists"}