{"id":19155924,"url":"https://github.com/lyokha/g3kb-switch","last_synced_at":"2025-06-13T14:03:25.967Z","repository":{"id":43043354,"uuid":"227850906","full_name":"lyokha/g3kb-switch","owner":"lyokha","description":"CLI keyboard layout switcher for Gnome Shell","archived":false,"fork":false,"pushed_at":"2025-05-05T20:11:22.000Z","size":117,"stargazers_count":54,"open_issues_count":2,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T00:41:44.376Z","etag":null,"topics":["cli","gnome","gnome-3","gnome-shell","keyboard-layout-switcher","vim-xkbswitch"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyokha.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}},"created_at":"2019-12-13T13:53:32.000Z","updated_at":"2025-05-03T03:40:30.000Z","dependencies_parsed_at":"2024-06-24T23:25:49.598Z","dependency_job_id":"c47a6e59-c5db-42c3-ae29-86c3878bf73d","html_url":"https://github.com/lyokha/g3kb-switch","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fg3kb-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fg3kb-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fg3kb-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fg3kb-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyokha","download_url":"https://codeload.github.com/lyokha/g3kb-switch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253655919,"owners_count":21943072,"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":["cli","gnome","gnome-3","gnome-shell","keyboard-layout-switcher","vim-xkbswitch"],"created_at":"2024-11-09T08:32:42.910Z","updated_at":"2025-05-12T00:41:52.191Z","avatar_url":"https://github.com/lyokha.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# g3kb-switch\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/lyokha/g3kb-switch/master.svg)](https://results.pre-commit.ci/latest/github/lyokha/g3kb-switch/master)\n[![github/workflow](https://github.com/lyokha/g3kb-switch/actions/workflows/main.yml/badge.svg)](https://github.com/lyokha/g3kb-switch/actions)\n\nThis is a CLI keyboard layout switcher for _Gnome 3_ and _4x_. It is not based\non the X interface but rather implements direct D-Bus messaging with the Gnome\nShell.\n\n## Installation\n\n\u003ca href=\"https://repology.org/project/g3kb-switch/versions\"\u003e\u003cimg align=\"right\" src=\"https://repology.org/badge/vertical-allrepos/g3kb-switch.svg\" alt=\"Packaging status\"\u003e\u003c/a\u003e\n\n### Install\n\nYou can directly install this program by:\n\n_In Arch Linux_, this program can be got from\n[AUR](https://aur.archlinux.org/packages/g3kb-switch).\n\n```ShellSession\nparu -S g3kb-switch\n```\n\n_In Fedora_.\n\n```ShellSession\nsudo dnf install g3kb-switch\n```\n\n_In Nix / NixOS_, official repository have included it.\n\n```ShellSession\nnix-env -iA nixos.g3kb-switch\n```\n\nYou can just run this program without installing it to your OS by\n\n```ShellSession\nnix run 'github#lyokha/g3kb-switch' -- --help\n```\n\n### Prerequisites\n\nBuild requires _glib-2.0_, so you need to install the corresponding development\npackage.\n\n_In Ubuntu._\n\n```ShellSession\nsudo apt-get install libglib2.0-dev\n```\n\n_In Fedora / RHEL / CentOS._\n\n```ShellSession\nsudo dnf install glib2-devel\n```\n\n_In Gentoo._\n\n```ShellSession\nsudo emerge -av dev-libs/glib\n```\n\nCommands may differ in other Linux distributions.\n\n### Gnome 45 and newer\n\nBuild and install the switcher.\n\n```ShellSession\ncmake -Bbuild\ncmake --build build\nsudo cmake --install build\n```\n\nIn _Gnome 41_ and newer, the switcher will only work with _G3kbSwitch Gnome\nShell extension_, because method _org.gnome.Shell.Eval_ which was used in the\noriginal implementation of the switcher is now disabled for security reasons.\nNote that in _Gnome 41_ through _44_ the extension differs from that which is\nrequired in _Gnome 45_, see build instructions for older Gnome versions in the\nnext section.\n\nYou can use [unsafe-mode-menu](https://github.com/linushdot/unsafe-mode-menu) to\ntoggle unsafe mode.\n\nAfter installing the extension, restart Gnome Shell for changes to take effect.\n\nIt is wise to make sure that the extension is enabled and works correctly. To\nenable the extension, use program _gnome-extensions-app_ or command-line program\n_gnome-extensions_.\n\n```ShellSession\n$ gnome-extensions enable g3kb-switch@g3kb-switch.org\n$ gnome-extensions info g3kb-switch@g3kb-switch.org\ng3kb-switch@g3kb-switch.org\n  Name: G3kbSwitch\n  Description: G3kbSwitch helper\n  Path: /usr/local/share/gnome-shell/extensions/g3kb-switch@g3kb-switch.org\n  URL: https://github.com/lyokha/g3kb-switch\n  Version: 1\n  State: ENABLED\n```\n\nA small smoke-test of the extension.\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\n```ShellSession\n$ gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.List\n(true, '[{\"key\":\"0\",\"value\":\"ru\"},{\"key\":\"1\",\"value\":\"us\"}]')\n$ gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.Get\n(true, '1')\n$ gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.Set 1\n(true, '')\n```\n\n\u003c!-- markdownlint-enable MD013 --\u003e\n\n### Older versions of Gnome (41 through 44)\n\nOlder versions of Gnome Shell require a different implementation of the\nextension. In this case, the cmake configuration step requires one extra option.\n\nBuild and install the switcher.\n\n```ShellSession\ncmake -Bbuild -DG3KBSWITCH_WITH_LEGACY_GNOME_SHELL_EXTENSION=ON\ncmake --build build\nsudo cmake --install build\n```\n\n### Even older versions of Gnome (3.x and 40)\n\nEven older versions of Gnome Shell expose method _org.gnome.Shell.Eval_ which\nmeans that the switcher can be built to work with this method rather than using\nthe extension. In this case, the cmake configuration step requires one extra\noption.\n\nBuild and install the switcher.\n\n```ShellSession\ncmake -Bbuild -DG3KBSWITCH_WITH_GNOME_SHELL_EXTENSION=OFF\ncmake --build build\nsudo cmake --install build\n```\n\n### Package\n\nAfter `cmake --build build`, run:\n\n```ShellSession\ncd build\n# generate *.deb for debian/ubuntu\ncpack -G DEB\n# generate *.rpm for redhat\ncpack -G RPM\n```\n\n## Usage\n\n```ShellSession\nUsage: g3kb-switch [-p]      Show the current layout group\n       g3kb-switch -l        Show available layout groups\n       g3kb-switch -n        Switch to the next layout group\n       g3kb-switch -s ARG    Switch to layout group ARG\n       g3kb-switch -h        Show this message and exit\n       g3kb-switch -v        Show the program version and exit\n```\n\n## Integration with vim-xkbswitch\n\nBasically, put in _.vimrc_ lines\n\n```vim\nlet g:XkbSwitchEnabled = 1\nlet g:XkbSwitchLib = '/usr/local/lib64/libg3kbswitch.so'\n```\n\nVariable _g:XkbSwitchLib_ must contain the actual path to the installed library.\nThe path can be found with _pkg-config_.\n\n```ShellSession\n$ pkg-config g3kb-switch --variable libpath\n/usr/local/lib64/libg3kbswitch.so\n```\n\nNotice that setting this variable is optional because vim-xkbswitch tries its\nbest to autodetect the path.\n\nSee details about configuration rules for vim-xkbswitch\n[here](https://github.com/lyokha/vim-xkbswitch#basic-configuration).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyokha%2Fg3kb-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyokha%2Fg3kb-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyokha%2Fg3kb-switch/lists"}