{"id":19061256,"url":"https://github.com/madhead/shyriiwook","last_synced_at":"2025-10-29T20:37:09.287Z","repository":{"id":216903231,"uuid":"733252359","full_name":"madhead/shyriiwook","owner":"madhead","description":"Switch keyboard layouts programmatically!","archived":false,"fork":false,"pushed_at":"2025-03-17T20:31:41.000Z","size":176,"stargazers_count":25,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-24T06:53:24.933Z","etag":null,"topics":["gnome","gnome-extension","gnome-shell","gnome-shell-extension","keyboard","keyboard-layout","keyboard-layout-switcher"],"latest_commit_sha":null,"homepage":"https://extensions.gnome.org/extension/6691/shyriiwook","language":"JavaScript","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/madhead.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["madhead"]}},"created_at":"2023-12-18T22:56:27.000Z","updated_at":"2025-04-08T11:44:49.000Z","dependencies_parsed_at":"2024-01-13T16:11:33.312Z","dependency_job_id":"62a98b75-a9d3-456d-aca7-e2eebe4c9195","html_url":"https://github.com/madhead/shyriiwook","commit_stats":null,"previous_names":["madhead/shyriiwook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madhead%2Fshyriiwook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madhead%2Fshyriiwook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madhead%2Fshyriiwook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madhead%2Fshyriiwook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madhead","download_url":"https://codeload.github.com/madhead/shyriiwook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250580705,"owners_count":21453531,"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","gnome-extension","gnome-shell","gnome-shell-extension","keyboard","keyboard-layout","keyboard-layout-switcher"],"created_at":"2024-11-09T00:19:43.133Z","updated_at":"2025-10-29T20:37:04.241Z","avatar_url":"https://github.com/madhead.png","language":"JavaScript","funding_links":["https://github.com/sponsors/madhead"],"categories":[],"sub_categories":[],"readme":"= Shyriiwook\n\nSwitch keyboard layouts programmatically!\n\n== The Problem\n\nIt's a shame that there is no easy way to switch keyboard input layout programmatically in Ubuntu (GNOME).\nAll the existing solutions are flawed in some way or another:\n\n* `gsettings set org.gnome.desktop.input-sources …`, found in many answers in the Internet is not working anymore in the latest Ubuntu versions.\n* `setxkbmap …` doesn't play well with the GNOME Shell.\nIt switches the layout, but the UI doesn't reflect the change and you cannot switch languages with the keyboard shortcut anymore untill you restart.\n* The `gdbus call … method org.gnome.Shell.Eval` is deprecated \u0026 disabled due to the security reasons with the `Eval` method.\n* Finally, the `org.gnome.Shell.Shell.Eval` https://github.com/ramottamado/eval-gjs[replacement] is really sketchy, and it's essentially the same powerfulr `Eval` but from a third-party dev from GitHub.\n\n== The Solution\n\nhttps://extensions.gnome.org/extension/6691/shyriiwook[Shyriiwook] is a GNOME Shell extension that allows to switch keyboard layouts programmatically.\nThe extension exposes a D-Bus interface, that could be used to query for the available layouts and to switch between them via `gdbus call …`.\nHowever, it is programmed to only switch between the layouts, and does not expose a security breach like the `Eval` method.\n\n== Usage\n\nFirst, install the extension.\nYou could find it in the https://extensions.gnome.org/extension/6691/shyriiwook[GNOME Extensions].\nJust follow the instructions.\n\nAlternatively, you could use the https://github.com/mjakeman/extension-manager[Extension Manager] app to find `Shyriiwook` and install it from there.\n\nFinally, you could \u003c\u003cbuilding,build\u003e\u003e the extension from the source code and install it manually.\n\nAfter the extension is installed, you could use the `gdbus` tool to query for the available layouts and to switch between them.\n\nTo query for the available layouts, run:\n\n[source, bash]\n----\ngdbus introspect --session --dest org.gnome.Shell --object-path /me/madhead/Shyriiwook --only-properties\n----\n\nIt will output something like this:\n\n[source, bash]\n----\nnode /me/madhead/Shyriiwook {\n  interface me.madhead.Shyriiwook {\n    properties:\n      readonly as availableLayouts = ['us', 'by+ru'];\n      readonly s currentLayout = 'us';\n  };\n};\n----\n\nThese `availableLayouts` could be used to switch between the layouts, just pass one of them as an argument to the `activate` method:\n\n[source, bash]\n----\ngdbus call --session --dest org.gnome.Shell --object-path /me/madhead/Shyriiwook --method me.madhead.Shyriiwook.activate \"by+ru\"\n----\n\nThe `currentLayout` property, obviously, contains the current layout.\n\nThat's it!\nNow you could use those in your scripts, or even bind it to a keyboard shortcut in Gnome settings.\nTo do that, add a new custom shortcut with the `dbus call …` command under the \"Settings\" → \"Keyboard\" → \"Keyboard Shortcuts\" → \"View and Customise Shortcuts\" → \"Custom Shortcuts\".\n\n[#building]\n== Building from source\n\nFirst, https://help.gnome.org/users/gnome-help/stable/gnome-version.html.en[determine] your GNOME version.\nStarting from GNOME 45 some of the APIs used by the extension have changed, so you need to build the extension with the correct version.\n\nTo build the extension, you need to have the Make build tool installed.\n\nThen, just run:\n\n[source, bash]\n----\nmake 42 # To build for the GNOME 42\nmake 45 # To build for the GNOME 45\n----\n\nThe `build` directory will contain the extension in a corresponding subdirectory.\n\nTo build the extension ZIP archive, run:\n\n[source, bash]\n----\nmake extension-42\nmake extension-45\n----\n\nIf you want to tinker with the extension, you could symlink the directory to the extensions directory:\n\n[source, bash]\n----\nln -s $(pwd)/42 ~/.local/share/gnome-shell/extensions/shyriiwook@madhead.me\n----\n\nTo build and install the extension, you could run\n[source, bash]\n----\nmake install\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadhead%2Fshyriiwook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadhead%2Fshyriiwook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadhead%2Fshyriiwook/lists"}