{"id":13687321,"url":"https://github.com/leshow/i3ipc","last_synced_at":"2025-04-22T19:30:47.439Z","repository":{"id":41445859,"uuid":"173667122","full_name":"leshow/i3ipc","owner":"leshow","description":"Types and bindings for communicating with i3 in Haskell","archived":false,"fork":false,"pushed_at":"2021-11-14T01:38:57.000Z","size":90,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T21:36:09.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/leshow.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":"2019-03-04T03:27:13.000Z","updated_at":"2024-11-15T23:16:49.000Z","dependencies_parsed_at":"2022-08-01T00:18:12.175Z","dependency_job_id":null,"html_url":"https://github.com/leshow/i3ipc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Fi3ipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Fi3ipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Fi3ipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leshow%2Fi3ipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leshow","download_url":"https://codeload.github.com/leshow/i3ipc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250308203,"owners_count":21409224,"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":[],"created_at":"2024-08-02T15:00:52.489Z","updated_at":"2025-04-22T19:30:47.154Z","avatar_url":"https://github.com/leshow.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"# i3ipc\n\n[![Build Status](https://travis-ci.com/leshow/i3ipc.svg?branch=master)](https://travis-ci.com/leshow/i3ipc)\n\nHaskell type-safe bindings for working with i3 using it's unix socket IPC. Sway is supposed to be protocl compatible with i3, I've included a function to bind to sway's socket also.\n\n## Subscribing\n\nSubscribe to events:\n\n```haskell\nimport qualified I3IPC.Subscribe         as Sub\nimport           I3IPC                   ( subscribe )\nimport           Control.Monad.IO.Class\n\n-- will print all events\nmain :: IO ()\nmain = liftIO $ subscribe print [Sub.Workspace, Sub.Window]\n```\n\nAn example of explicitly matching on some events and printing their fields:\n\n```haskell\nimport qualified I3IPC.Subscribe               as Sub\nimport           I3IPC.Event\nimport           I3IPC                         ( subscribe )\nimport           Control.Monad.IO.Class\n\nmain :: IO ()\nmain = liftIO $ subscribe handle [Sub.Workspace, Sub.Window]\n where\n  handle :: MonadIO m =\u003e Either String Event -\u003e m ()\n  handle (Right evt) = case evt of\n    Workspace WorkspaceEvent { wrk_current } -\u003e print wrk_current\n    Window WindowEvent { win_container } -\u003e print win_container\n    _ -\u003e error \"No other event types\"\n  handle (Left err) = error err\n```\n\n## Sending Messages\n\nSending Messages to i3:\n\n```haskell\nimport           I3IPC              ( connecti3\n                                    , getWorkspaces\n                                    )\nimport           Control.Monad.IO.Class                                    \n\nmain :: IO ()\nmain = do\n    soc \u003c- liftIO $ connecti3\n    print $ getWorkspaces soc\n```\n\nAlternatively, you can ignore the convenience functions and construct these messages yourself:\n\n```haskell\nimport qualified I3IPC.Message     as Msg\nimport           I3IPC              ( connecti3\n                                    , receiveMsg\n                                    )\nimport           Control.Monad.IO.Class                                    \n\nmain :: IO ()\nmain = do\n    soc \u003c- liftIO $ connecti3\n    print $ Msg.sendMsg soc Msg.Workspaces \u003e\u003e receiveMsg soc\n```\n\n## Community\n\nI'm happy to take PRs or suggestions, or simply fix issues for this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshow%2Fi3ipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleshow%2Fi3ipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshow%2Fi3ipc/lists"}