{"id":25011647,"url":"https://github.com/crizmo/magic-keyboard-linux","last_synced_at":"2026-04-29T18:33:09.950Z","repository":{"id":275820809,"uuid":"927291264","full_name":"crizmo/magic-keyboard-linux","owner":"crizmo","description":"Magic Keyboard (Japanese) Setup for Linux","archived":false,"fork":false,"pushed_at":"2025-02-18T16:21:32.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T03:16:59.637Z","etag":null,"topics":["apple","japanese","japanese-keyboard","keyboard","keys","linux","magic-keyboard"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/crizmo.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":"2025-02-04T18:07:26.000Z","updated_at":"2025-02-18T16:21:36.000Z","dependencies_parsed_at":"2025-02-04T19:30:46.990Z","dependency_job_id":"69131065-6d01-4ab3-bce2-8a0fbc0961d4","html_url":"https://github.com/crizmo/magic-keyboard-linux","commit_stats":null,"previous_names":["crizmo/magic-keyboard-linux"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crizmo/magic-keyboard-linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crizmo%2Fmagic-keyboard-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crizmo%2Fmagic-keyboard-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crizmo%2Fmagic-keyboard-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crizmo%2Fmagic-keyboard-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crizmo","download_url":"https://codeload.github.com/crizmo/magic-keyboard-linux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crizmo%2Fmagic-keyboard-linux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["apple","japanese","japanese-keyboard","keyboard","keys","linux","magic-keyboard"],"created_at":"2025-02-05T05:36:35.846Z","updated_at":"2026-04-29T18:33:09.929Z","avatar_url":"https://github.com/crizmo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Magic Keyboard (Japanese) Setup for Linux\n\nThis guide provides detailed steps to configure your **Apple Magic Keyboard (Japanese layout)** to work properly on Linux, including remapping keys like **Kana (Henkan)** and **Alphanumeric (Muhenkan)** to switch between Kana and Alphanumeric input modes using **Mozc** input method. It also includes instructions on how to switch between Magic Keyboard and basic layouts using shell scripts.\n\n---\n\n## Prerequisites\n\n- **Linux** (tested on Ubuntu).\n- **Apple Magic Keyboard (Japanese Layout)** connected via **Bluetooth**.\n- **Mozc** or another Japanese input method installed via **IBus**.\n\n---\n\n## Step 1: Install Required Packages\n\nTo ensure that the Japanese input method works properly, you need to install **IBus** and **Mozc**.\n\n1. **Install IBus and Mozc:**\n   ```bash\n   sudo apt update\n   sudo apt install ibus ibus-anthy ibus-mozc\n   ```\n\n2. **Restart the IBus daemon:**\n   ```bash\n   ibus-daemon -drx\n   ```\n\n---\n\n## Step 2: Set up IBus Input Method\n\n1. **Configure IBus Input Method:**\n   - Run the following command to open IBus settings:\n     ```bash\n     ibus-setup\n     ```\n   - Under the **Input Method** tab, make sure **Mozc** (Japanese) is added and set as the default input method.\n\n2. **Switch to Japanese Input:**\n   - Use the **IBus** system tray icon to switch to the Japanese input method (Mozc).\n   - Alternatively, you can use the default keyboard shortcut (`Ctrl + Space`) to toggle between input methods.\n\n---\n\n## Step 3: Configure Key Mappings with `.Xmodmap`\n\nYou need to map the **Kana** (Henkan) and **Alphanumeric** (Muhenkan) keys using **xmodmap** to properly switch between input modes.\n\n1. **Create or Edit the `.Xmodmap` File:**\n   - Open or create the `.Xmodmap` file in your home directory:\n     ```bash\n     nano ~/.Xmodmap\n     ```\n   - Add the following lines to map keycodes 130 and 131 (Kana and Alphanumeric keys):\n     ```bash\n     keycode 130 = Henkan_Mode NoSymbol Henkan_Mode\n     keycode 131 = Muhenkan NoSymbol Muhenkan\n     ```\n   - Save and exit the editor (`Ctrl + X`, then `Y`, then `Enter`).\n\n2. **Apply the Key Mappings:**\n   - To apply the mappings immediately, run:\n     ```bash\n     xmodmap ~/.Xmodmap\n     ```\n\n3. **Verify the Key Mappings:**\n   - Run the following command to ensure the key mappings are applied correctly:\n     ```bash\n     xev\n     ```\n   - Press the **Kana** and **Alphanumeric** keys and check if the correct keysyms (Henkan_Mode and Muhenkan) are triggered in the output.\n\n---\n\n## Step 4: Set the Keyboard Layout to Japanese\n\nTo ensure the Kana and Alphanumeric keys are interpreted correctly, set your keyboard layout to **Japanese**.\n\n1. **Set Layout to Japanese:**\n   ```bash\n   setxkbmap -layout jp\n   ```\n\n---\n\n## Step 5: Test the Kana and Alphanumeric Keys\n\n1. **Test Switching Between Input Modes:**\n   - With **Mozc** as the active input method, press the **Kana (かな)** key to switch to Kana mode.\n   - Press the **Alphanumeric (英数)** key to switch back to Alphanumeric mode.\n\n2. **Test the Behavior in `xev`:**\n   - Run `xev` and verify that pressing the **Kana** and **Alphanumeric** keys triggers the correct keysyms (Henkan_Mode and Muhenkan).\n\n---\n\n## Step 6: Make the `.Xmodmap` Changes Permanent\n\nTo automatically apply the `.Xmodmap` settings each time you log in:\n\n1. Open your `.bashrc` or `.profile` file:\n   ```bash\n   nano ~/.bashrc\n   ```\n\n2. Add the following line to apply the `.Xmodmap` file on startup:\n   ```bash\n   xmodmap ~/.Xmodmap\n   ```\n\n3. Save and exit (`Ctrl + X`, then `Y`, then `Enter`).\n\n4. Reload `.bashrc`:\n   ```bash\n   source ~/.bashrc\n   ```\n\n---\n\n## Step 7: Switch Between Basic and Magic Keyboard Layouts\n\nTo easily switch between the **Magic Keyboard layout** and a **basic keyboard layout**, you can use the provided shell scripts: `switch_to_basic.sh` and `switch_to_magic.sh`.\n\n1. **Create the Shell Scripts:**\n   - Create two shell scripts: `switch_to_basic.sh` and `switch_to_magic.sh` in your home directory.\n   \n   - **switch_to_basic.sh**:\n     ```bash\n     #!/bin/bash\n     # Switch to basic keyboard layout (e.g., US layout)\n     setxkbmap -layout us\n     ```\n\n   - **switch_to_magic.sh**:\n     ```bash\n     #!/bin/bash\n     # Switch to Magic Keyboard layout (Japanese layout)\n     setxkbmap -layout jp\n     ```\n\n2. **Make the Scripts Executable:**\n   ```bash\n   chmod +x ~/switch_to_basic.sh\n   chmod +x ~/switch_to_magic.sh\n   ```\n\n3. **Run the Scripts:**\n   - To switch to the basic layout, run:\n     ```bash\n     ~/switch_to_basic.sh\n     ```\n   - To switch to the Magic Keyboard layout, run:\n     ```bash\n     ~/switch_to_magic.sh\n     ```\n\n---\n\n## Troubleshooting\n\n- If the keys still don't work as expected, try restarting the **IBus** daemon:\n  ```bash\n  ibus-daemon -drx\n  ```\n- If key mappings are not applying, recheck your `.Xmodmap` file or manually run `xmodmap ~/.Xmodmap`.\n- Verify the keycodes using `xev` to make sure they match the expected **Kana** and **Alphanumeric** keys.\n\n---\n\n## Additional Resources\n\n- **IBus Documentation**: [IBus Official Site](https://ibus.github.io/)\n- **Mozc Documentation**: [Mozc GitHub](https://github.com/google/mozc)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrizmo%2Fmagic-keyboard-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrizmo%2Fmagic-keyboard-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrizmo%2Fmagic-keyboard-linux/lists"}