{"id":51036382,"url":"https://github.com/ttak0422/meian.nvim","last_synced_at":"2026-06-22T06:32:27.618Z","repository":{"id":356740719,"uuid":"1233490699","full_name":"ttak0422/meian.nvim","owner":"ttak0422","description":"Reflect macOS Light / Dark Mode changes into running Neovim instances in real time.","archived":false,"fork":false,"pushed_at":"2026-05-09T13:28:01.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-09T15:32:05.317Z","etag":null,"topics":["macos","neovim"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/ttak0422.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-09T02:45:50.000Z","updated_at":"2026-05-09T13:23:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ttak0422/meian.nvim","commit_stats":null,"previous_names":["ttak0422/meian.nvim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ttak0422/meian.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttak0422%2Fmeian.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttak0422%2Fmeian.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttak0422%2Fmeian.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttak0422%2Fmeian.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttak0422","download_url":"https://codeload.github.com/ttak0422/meian.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttak0422%2Fmeian.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34637937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["macos","neovim"],"created_at":"2026-06-22T06:32:27.464Z","updated_at":"2026-06-22T06:32:27.610Z","avatar_url":"https://github.com/ttak0422.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    meian.nvim\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  Reflect macOS Light / Dark Mode changes into running Neovim instances in real time.\n\u003c/p\u003e\n\n## Overview\n\n`meian.nvim` ships with a small Swift watcher that subscribes to the system's `AppleInterfaceThemeChangedNotification`.\nWhen the appearance changes, the watcher pushes the new mode (`light` or `dark`) into every running Neovim by calling `nvim --server \u003csocket\u003e --remote-send`,\nwhich invokes `require('meian').apply(\u003cmode\u003e)` inside each instance.\n\nA single watcher process is shared across all Neovim instances via `flock(2)` on a lock file.\n\n## Requirements\n\n- macOS\n- Neovim 0.10+\n\n## Install\n\n```nix\n{\n  inputs.meian-nvim.url = \"github:ttak0422/meian.nvim\";\n\n  # ...\n  programs.neovim.plugins = [\n    {\n      plugin = inputs.meian-nvim.packages.${pkgs.system}.default;\n      type = \"lua\";\n      config = ''\n        require(\"meian\").setup({\n          on_change = function(mode)\n            vim.cmd.colorscheme(mode == \"dark\" and \"habamax\" or \"default\")\n          end,\n        })\n      '';\n    }\n  ];\n}\n```\n\n## Configuration\n\n```lua\nrequire(\"meian\").setup({\n  -- Apply the current mode immediately on startup. (default: true)\n  apply_initial = true,\n\n  -- Called after every mode switch. Set the colorscheme here.\n  on_change = function(mode) -- \"light\" | \"dark\"\n    vim.cmd.colorscheme(mode == \"dark\" and \"habamax\" or \"default\")\n  end,\n\n  -- Disable the plugin (also disabled automatically on non-macOS).\n  enabled = true,\n})\n```\n\n`vim.o.background` is set automatically before `on_change` is called, so themes that consult `\u0026background` will already see the new value.\n\n## API\n\n| function                       | description                                              |\n| ------------------------------ | -------------------------------------------------------- |\n| `require('meian').apply(mode)` | Apply `\"light\"` or `\"dark\"` (called by the watcher).     |\n| `require('meian').refresh()`   | Read the current system appearance and apply it.         |\n| `require('meian').current()`   | Return `\"light\"` or `\"dark\"` for the current OS setting. |\n\nUser commands:\n\n- `:MeianApply` — re-detect the system mode and apply.\n- `:MeianApply light` / `:MeianApply dark` — apply explicitly.\n\n## How it works\n\n```\n                                    ┌───────────────────────┐\n  AppleInterfaceThemeChanged ─────▶ │   meian-watcher       │\n                                    │   (singleton, flock)  │\n                                    └──────────┬────────────┘\n                                               │\n                               reads \u003cbase-dir\u003e/subscribers/*.json\n                                               │\n            ┌──────────────────────────────────┼──────────────────────────────────┐\n            │                                  │                                  │\n            ▼                                  ▼                                  ▼\n   nvim --server $sock1 ...            nvim --server $sock2 ...            nvim --server $sockN ...\n```\n\n- Each Neovim writes `subscribers/\u003cpid\u003e.json` containing its `v:servername` and `v:progpath`, and removes it on `VimLeavePre`.\n- The watcher acquires a non-blocking `flock` on `watch.lock`. \n  A second watcher started by another Neovim sees the lock as taken and exits immediately, leaving exactly one watcher running.\n- If `nvim --remote-send` fails for a subscriber (e.g. Neovim crashed without cleanup),\n  the watcher removes the stale subscriber file.\n- The watcher exits after 60s without any subscribers, so it does not\n  linger when no Neovim is running.\n\nThe base directory is `$XDG_RUNTIME_DIR/meian-mac-appearance` when set,\notherwise `/tmp/meian-mac-appearance`:\n\n```\n\u003cbase-dir\u003e/\n├── watch.lock                  # singleton lock, holds watcher PID\n└── subscribers/\n    ├── 12345.json              # { \"socket\": ..., \"pid\": ..., \"nvim\": ... }\n    └── 67890.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttak0422%2Fmeian.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttak0422%2Fmeian.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttak0422%2Fmeian.nvim/lists"}