{"id":25758203,"url":"https://github.com/gkzhb/yabai-spaces","last_synced_at":"2025-05-13T00:35:38.241Z","repository":{"id":118133120,"uuid":"540402030","full_name":"gkzhb/yabai-spaces","owner":"gkzhb","description":"Display yabai space label in menu bar","archived":false,"fork":false,"pushed_at":"2025-03-13T09:14:22.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T05:11:11.018Z","etag":null,"topics":["swiftbar","swiftbar-plugin","swiftbar-plugins","yabai"],"latest_commit_sha":null,"homepage":"","language":"Python","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/gkzhb.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}},"created_at":"2022-09-23T11:10:00.000Z","updated_at":"2025-03-13T09:14:27.000Z","dependencies_parsed_at":"2025-02-26T16:37:56.571Z","dependency_job_id":"f4e929fc-1231-49f3-b241-998f451f4805","html_url":"https://github.com/gkzhb/yabai-spaces","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkzhb%2Fyabai-spaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkzhb%2Fyabai-spaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkzhb%2Fyabai-spaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkzhb%2Fyabai-spaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkzhb","download_url":"https://codeload.github.com/gkzhb/yabai-spaces/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850536,"owners_count":21973662,"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":["swiftbar","swiftbar-plugin","swiftbar-plugins","yabai"],"created_at":"2025-02-26T16:37:39.072Z","updated_at":"2025-05-13T00:35:38.208Z","avatar_url":"https://github.com/gkzhb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yabai Spaces\n\nA swiftbar plugin displays yabai spaces, inspired by [SxC97/Yabai-Spaces](https://github.com/SxC97/Yabai-Spaces).\n\n## Features\n\n\u003cimg width=\"478\" alt=\"image\" src=\"https://user-images.githubusercontent.com/36144635/204783828-ccbcf4aa-b423-404e-a5a9-de6c8a3eb245.png\"\u003e\n\n- Display yabai spaces in Mac OS menu bar.\n  - Separate spaces belonging to different monitors (two monitors in the above image, and spaces of them are separated by '\u003e')\n  - Highlight current space for each monitor and markup focused space (displayed spaces are in red, focused space is wrapped by '\u003c\u003c' '\u003e\u003e')\n  - Show up yabai spaces' labels, and you can easily customize them in a\n  simple script\n\n## Requirements\n\n- Python 3\n- [koekeishiya/yabai](https://github.com/koekeishiya/yabai)\n- [SwiftBar](https://github.com/swiftbar/SwiftBar) or [xbar (the BitBar reboot)](https://github.com/matryer/xbar) (not tested for xbar)\n- [chipsenkbeil/choose: Fuzzy matcher for OS X that uses both std{in,out} and a native GUI](https://github.com/chipsenkbeil/choose)(optional): you can use my [Raycast plugin](https://github.com/gkzhb/raycast-yabai) which provides a better UI\n- Fira Code Nerd font(optional): you can use other fonts or characters for the separator.\n\n## Installation \u0026 Usage\n\n### Yabai Spaces in menu bar\n\nCopy [`yabai.1d.py`](./yabai.1d.py) to your SwiftBar/xbar plugin's directory. And set the variable value of `YABAI_SPACES_PATH` in the file.\n\nIf SwiftBar is running, you may see Yabai Spaces in your menu bar.\n\u003e If SwiftBar is running and you cannot see it, it might be there is no enough\nspace to display Yabai Spaces.\n\n\nThere is another file [`yabai-simp.1d.py`](./yabai-simp.1d.py) that shows visible yabai spaces only, which occupies less space in the menu bar.\n\n\nYou'd better press `Command` key and at the same time drag Yabai Spaces menu bar\nitem to the most right to try to avoid it being hidden when there are plenty of menu\nbar tray icons and no space left to display Yabai Spaces.\n\nAdd these to your `.yabairc` to rerender Yabai Spaces after some yabai events to\nensure it presents the latest status of spaces:\n\n```bash\n# update yabai-spaces in status bar\nyabai -m signal --add event=space_changed action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\nyabai -m signal --add event=window_focused action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\nyabai -m signal --add event=display_added action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\nyabai -m signal --add event=display_removed action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\nyabai -m signal --add event=display_changed action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\nyabai -m signal --add event=display_moved action=\"open -gj 'swiftbar://refreshplugin?name=yabai'\"\n```\n\nYou can customize [`yabai.1d.py`](./yabai.1d.py) script as you need.\n\nFor example, change the font by set `CUSTOM_FONT` variable.\nIf you want to customize how the space is displayed, you can edit\n`get_space_display_string` function.\n\n### Persist Yabai Space Labels\n\nWhen you restart Yabai, all the labels of spaces will be reset. And here comes\nthe scripts to persist these data.\n\nExecuting [`rename-space.fish`](./rename-space.fish) (bind this script to a hotkey in skhd is\nrecommended) will prompt [`choose`](https://github.com/chipsenkbeil/choose) to rename current\nfocused space's label and persist latest labels to a local csv file\n`$HOME/.yabai-labels.csv` which contains `(space index, label)` pairs.\n\nOne more step is to load these space labels on the startup of yabai:\nadd `restore-space-labels.fish` to your `.yabairc` configuration like this\n\n```bash\n# restore space labels\n/path/to/yabai-spaces/restore-space-labels.fish\n```\n\n#### About rename space label\n\n\u003cimg width=\"829\" alt=\"image\" src=\"https://user-images.githubusercontent.com/36144635/204808747-2e0c84c8-d33b-420b-9ab8-ac88f4fc4242.png\"\u003e\n\nIn `choose`, you get a default '»' in the selection list. This selection item represents\nclearing the space label. Press `Enter` to choose a selection item in `choose`.\n\nType any new label you want in `choose` and press `Enter`, and you'll get your\nspace label renamed.\n\nIf you want to cancel renaming space in `choose`, use `Esc`.\n\n### Display skhd mode\n\nSince skhd command-line does not provide methods to get current skhd mode, we need\nto store it to somewhere which I choose a temp file `/tmp/skhd_mode`.\n\nExecuting [`skhd-mode.py`](./skhd-mode.py) with no arguments will print currently\nsaved skhd mode. Execute it with arguments to save the argument string\nas new skhd mode. You can put this script in your shell `PATH`.\n\nWhat's more, in skhd config, [`skhd-mode.py`](./skhd-mode.py) with mode name as\nargument should be executed when skhd enters a mode.\n\nFor example, when entering `default` mode, execute `skhd-mode.py`(assuming\nit's in shell `PATH`) with mode\nname and then refresh yabai swiftbar plugin.\n```\n:: default : skhd-mode.py default; open -gj 'swiftbar://refreshplugin?name=yabai'\n```\n\n[`yabai.1d.py`](./yabai.1d.py) uses this script to get current skhd mode and\ndisplays it.\n\n\u003cimg width=\"503\" alt=\"image\" src=\"https://user-images.githubusercontent.com/36144635/204805131-22364c41-0084-4c6e-b32e-7fb80420aa7e.png\"\u003e\n\nIf `skhd-mode.py` is not in your shell `PATH`, you should not only change the\nscript path in skhd config above, but also set the variable\n`YABAI_SPACES_PATH` in `yabai.1d.py`.\n\n## Changelog\n\n- v0.1\n  - Add skhd mode display and related scripts\n  - Replace Fish shell scripts with Python scripts\n  - Update requirements and add some screenshots in README\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkzhb%2Fyabai-spaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkzhb%2Fyabai-spaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkzhb%2Fyabai-spaces/lists"}