{"id":17316080,"url":"https://github.com/ankostis/gnome-shell-quick-lang-switch","last_synced_at":"2025-04-09T07:10:32.600Z","repository":{"id":39719783,"uuid":"419698056","full_name":"ankostis/gnome-shell-quick-lang-switch","owner":"ankostis","description":"Gnome-shell extension to quickly switch keyboard language layout (no switcher popup)","archived":false,"fork":false,"pushed_at":"2025-02-12T18:12:06.000Z","size":120,"stargazers_count":71,"open_issues_count":2,"forks_count":9,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-02T05:08:10.324Z","etag":null,"topics":["gnome-shell-extension","i18n","keyboard-layout","languages"],"latest_commit_sha":null,"homepage":"https://extensions.gnome.org/extension/4559/quick-lang-switch/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankostis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2021-10-21T11:37:48.000Z","updated_at":"2025-02-12T06:47:04.000Z","dependencies_parsed_at":"2024-06-11T20:41:28.747Z","dependency_job_id":"ea03cff1-0d97-472b-8815-ba3857ecd57f","html_url":"https://github.com/ankostis/gnome-shell-quick-lang-switch","commit_stats":{"total_commits":36,"total_committers":5,"mean_commits":7.2,"dds":"0.11111111111111116","last_synced_commit":"f4b01352ef26dbfc7c9b48bf35c2ab4895e7b008"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankostis%2Fgnome-shell-quick-lang-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankostis%2Fgnome-shell-quick-lang-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankostis%2Fgnome-shell-quick-lang-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankostis%2Fgnome-shell-quick-lang-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankostis","download_url":"https://codeload.github.com/ankostis/gnome-shell-quick-lang-switch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994122,"owners_count":21030050,"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":["gnome-shell-extension","i18n","keyboard-layout","languages"],"created_at":"2024-10-15T13:11:34.472Z","updated_at":"2025-04-09T07:10:32.581Z","avatar_url":"https://github.com/ankostis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gnome-shell: Quick language Switch extension\n\nA *X11*/*Wayland* extension to quickly switch keyboard language layouts,\nthat bypass the switcher popup and preserves the focus of the active window/widget.\n\n## Install\nInstall it from [Gnome-extensions site](https://extensions.gnome.org/extension/4559/quick-lang-switch/), or directly from GitHub with this command:\n```bash\ngit clone https://github.com/ankostis/gnome-shell-quick-lang-switch ~/.local/share/gnome-shell/extensions/quick-lang-switch@ankostis.gmail.com\n```\n\nand then ensure it is enabled:\n```bash\ngnome-extensions info quick-lang-switch@ankostis.gmail.com\ngnome-extensions enable quick-lang-switch@ankostis.gmail.com\n```\nIf the 1st command above reports that extension does not exist,\nlogout and re-login (required for *Wayland*).\n\n## Rational\n\nThe language switcher popup by default takes ~0.7sec to appear,\nmeaning that roughly 2-4 strokes are lost till the switch completes.\nThis affects heavily users typing languages with non-latin based alphabets\n(e.g. Greek, Cyrilic, Arabic, Japanese), particularly when writting technical documents.\n\nFurthermore, the popup messes with the focus of the active window/widget,\n(eg. IntelliJ's search popup gets closed, the active widget loses focus when\nthe screen is shared, etc).\n\nHence the many relevant questions on the web:\n\n* https://askubuntu.com/questions/972926/how-to-not-show-keyboard-layout-chooser-popup-when-changing-language-in-gnome-3/\n* https://itectec.com/unixlinux/how-to-change-keyboard-layout-in-gnome-3-from-command-line/\n* https://askubuntu.com/questions/1123163/modeless-stateless-layout-language-switching-with-caps-lock-again-18-04-lts-bi/\n* https://askubuntu.com/questions/969784/fast-switch-input-source-via-capslock-button-in-ubuntu-17-10/\n* https://askubuntu.com/questions/1084049/switch-layouts-with-one-key-on-18-04-bug/\n* https://askubuntu.com/questions/1200586/ubuntu-19-very-slow-f-keys-response-and-input-language-switch/\n* https://unix.stackexchange.com/questions/316998/how-to-change-keyboard-layout-in-gnome-3-from-command-line/\n* https://askubuntu.com/questions/209597/how-do-i-change-keyboards-from-the-command-line/\n* https://askubuntu.com/questions/1056802/how-to-assign-caps-lock-first-lang-and-shiftcaps-lock-second-lang-in-ubuntu/\n* https://askubuntu.com/questions/1134629/manipulate-the-default-shortcut-superspace-for-switching-to-next-input-source-w/\n* https://askubuntu.com/questions/998077/how-to-disable-the-keyboard-layouts-choosing-screen-in-gnome/\n* https://askubuntu.com/questions/1048805/how-can-i-switch-keyboard-source-quickly-in-ubuntu-18-04-gnome-shell/\n\nSince `gsettings` cannot reliably switch keyboard layouts both on *X* and *Wayland*,\nsome of the recipes above suggest binding a \"custom keyboard shortcut\" to a bash-script\nperforming the switch through *dbus* command, which bypasses the popup.\n\nUnfortunately since Gnome-shell v41 (e.g. pushed downstream to *Debian unstable \"SID\"* roughly on Sept 2021)\n*dbus* no longer allows calling method  `org.gnome.Shell.Eval` with arbitrary code,\ndue to [security concerns](https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943).\nThe workaround to keep using *dbus* is to [use a custom `eval` method](https://askubuntu.com/questions/1406542/shortcuts-for-keyboard-layout-ubuntu-22-04/1428946#1428946),\nbut this extension cuts to the chase.\n\nFurthemore, since the extension does not define a *custom-shortcut*,\nall keyboard customizations with `gnome-tweak-tool`/`setxkbmap` in X11 or *Wayland*\nstill work fine, on all Gnome versions.\n\n## Improvements\n\nA better solution would be to modify the [original `ui/status/keyboard.js` code](https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/status/keyboard.js#L407-410)\nto skip the switcher-popup based on some new boolen preference (e.g. settable from `Tweaks` ),\nas requested by [gnome-shell#2945](https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2945) issue.\n\nIf you want to [switch between **multiple layouts** immediately](https://askubuntu.com/questions/1406542/shortcuts-for-keyboard-layout-ubuntu-22-04/1428946#1428946),\nie. without cycling through them,\nthere is now (June 2023) [Osamu Aoki's extension](https://extensions.gnome.org/extension/6066/shortcuts-to-activate-input-methods/).\n\n**TIP:** to facilitate typing while switching language, you may assign\n the _\"Switch to next/previous input source\"_ keyboard shortcut to a single keystroke,\nlike **[SysRq/Print]** or **[CapsLock]** keys.\n![Screenshot of Gnome Tweaks tool to enable **[CapsLock]** as language switcher](CapsLockSwitcherSettings.png)\n\n## Release instructions\n\n0. Test the code:\n   * Follow the extension's logs with: `journalctl  -fg 'quick`.\n   * [Install the extension locally](https://gjs.guide/extensions/development/creating.html#extension-js):\n\n     ```bash\n     cd ~/.local/share/gnome-shell/extensions\n     ln -s \u003cyour-project-folder\u003e quick-lang-switch@loca\n     ```\n\n     \u003e **Note:** Unfortunately testing the extension under *Wayland* in a nested gnome-shell,\n     \u003e as _gnome-shell_ docs suggest, does not work for the language switch key,\n     \u003e because it is consumed by the outer shell; you must re-login to reload your changes.\n\n   * Cycle with 3+ layouts installed.\n   * Enable, disable, re-enable extension and check that both the switcher popup\n     and the immediate cycling work fine in each state.\n   * Check both **Xorg** and **Wayland**.\n\n1. Discover the latest version present in the  *Gnome-extensions site* (link above).\n2. Populate the [Changes](#Changes) section, below, for the discovered `version + 1`.\n3. `git tag -sm '\u003cmsg\u003e'  v\u003clatest-release + 1\u003e`\n4. `git push origin main --tag`\n5. Archive the extension \u0026 include the commit-id as a zip-comment\n   (the `-z` option sets the git-hash as zip's comment):\n\n   ```bash\n   git rev-parse HEAD | \\\n       zip ../gnome-shell-quick-lang-switch-$(git describe).zip \\\n       -z \\\n       extension.js \\\n       metadata.json\n   ```\n\n6. Upload it in https://extensions.gnome.org/upload/\n7. Convert the tag into a GitHub release, paste the changelog and attach archive as an asset.\n\n## Changes\n\n\n### 11 Feb 2024, v13: +shell-v48\n\n### 8 Dec 2024, v12: +shell-v47\n\n### 17 Apr 2024, v11: +shell-v46\n\n### 15 Nov 2023, v10: gdm \u0026 lock-screen: REJECTED\n\n* feat: mark `metadata.js` as working also in gdm \u0026 lock-sreen.\n* [Rejected by Gnome-extensions site](https://extensions.gnome.org/review/48228),\n  because it `gdm` is not allowed on ego extensions since they are not going\n  to be installed as system extension.\n\n### 12 Nov 2023, v9: ECMAScript-modules (ESM) for shell-v45\n\n**NOTE:** the new code is incompatible with previous gnome-shell-44 and below.\nIn case bugs are discovered, old releases would have to be bugfixed separately.\n\n* FEAT/REFACT: revamp code for ESM modules, thanks to @hankjura (Yury thankjura).\n  * feat: old imports system wouldn't working on gnome-shell-45.\n  * refact: rename classname from `Extension` --\u003e `QuickLangSwitchExtension`\n  * refact: use console.log/warn.error\n* refact: cycle layouts WITHOUT checking conjecutive nulls.\n  Maybe conjecutive null check was a relic from when their keys were non-ints\n  (if that era ever existed).\n* fix: had forgotten `return` in the 2 bail-out/error conditional branches,\n  indeterminate action would have happen then (not really tested :-().\n* doc: coallesce demand for this plugin in StackOverflow.\n\n### 31 Jul 2023, v8: cycle-backward, fix restoring switcher popup\n\n* FEAT: bind also `switch-input-source-backward`\n  (fix [#4](https://github.com/ankostis/gnome-shell-quick-lang-switch/issues/4).\n  thanks to [Yevhen Popok](https://github.com/xalt7x), [@PotatoXPC](https://github.com/PotatoXPC))\n* FIX: previously, disabling the extension and reinstating the switcher popup\n  would brake repeated cycling, making it impossible to cycle further than\n  the immediate next layout, not without first releasing keys and re-pressing them.\n  - FIX: this could possibly also fix [#5](https://github.com/ankostis/gnome-shell-quick-lang-switch/issues/5)\n    crashing when disabling the extensein (can't be sure, couldn't reproduce).\n* refact: refetch sourceManager on each cycie-call, in case it has changed\n  (instead of storing it in a global var on initialization).\n* doc: comments describe new method's provenance\n* doc: enhance README from user feedback \u0026 SO;  mention similar extension by Osamu Aoki,\n  better for multiple layouts.\n* DOC: add LICENSE file AGPL.\n* DOC: describe implementation provenance and challenges in comments.\n\n### 6 Apr 2023, v7: \u003c= gnome-44\n\n* version: 3.28, 3.30, 3.34, 3.32, 3.36, 3.38, 40, 41, 42, 43, 44\n* thanks to [Oleg Arefyev](https://github.com/imareo)'s\n  [PR#9](https://github.com/ankostis/gnome-shell-quick-lang-switch/pull/9).\n\n### 23 Oct 2022, v6: \u003c= gnome-43\n\nversion: 3.28, 3.30, 3.34, 3.32, 3.36, 3.38, 40, 41, 42, 43\n\n### 27 May 2022, v5: \u003c= gnome-42\n\nversion: 3.28, 3.30, 3.34, 3.32, 3.36, 3.38, 40, 41, 42\n\n### 2 Nov 2021, v4: \u003c= gnome-41\n\nversion: 3.28, 3.30, 3.34, 3.32, 3.36, 3.38, 40, 41\n\n### 22 Oct 2021, v3: gnome-40 \u0026 41\n\nversion: 40, 41\n\n### 21 Oct 2021, v1: re-bind `switch-input-source` shortcut to direct switch\n\nIt re-binds the `'switch-input-source'` shortcut:\n\n* when enabled, the shortcut delegates to the direct-switching method `InputSourceManager._modifiersSwitcher`, and\n* when disabled, it the shortcut is restored to the original `InputSourceManager._switchInputSource` method.\n  Note, it won't reset it to any previous monkeypatches.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankostis%2Fgnome-shell-quick-lang-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankostis%2Fgnome-shell-quick-lang-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankostis%2Fgnome-shell-quick-lang-switch/lists"}