Monday, April 29, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 747  / 2 Years ago, wed, april 27, 2022, 10:14:50

I read this article where is a workaround to add maximum eight keyboard layouts.



But my questions are:




  • I would like to try this, but I see they've written there something with "gnome" in the script. In my Ubuntu, 13.04, I have Unity. What do I do?


  • I would have to do this for four x four keyboard layouts (to have 13 keyboard layouts). This script, however, is designed for two x four keyboard layouts. How do I get the four x four?




I would really appreciate your tips and hints on this. And I would kindly ask you to keep it simple, if possible, because I'm really no expert in both Ubuntu and computers in general.


More From » command-line

 Answers
4

  • In Ubuntu 13.04 forget about gconftool-2 --get /desktop/gnome/peripherals/keyboard/kbd/layouts and use only this command:



    gsettings get org.gnome.libgnomekbd.keyboard layouts


  • I updated the keyboard-layout-switch script for 4x4 keyboard layouts as follow:




#!/bin/bash

default_layout="['ro', 'gr', 'us altgr-intl', 'al']"
layout_two="['ba', 'de deadgraveacute', 'ph', 'gb']"
layout_three="['de deadgraveacute', 'al', 'ara', 'be']"
layout_four="['gb', 'be', 'ro', 'ara']"

current_layout=$(gsettings get org.gnome.libgnomekbd.keyboard layouts)

case $current_layout in
"$default_layout")
new_layout="$layout_two"
;;
"$layout_two")
new_layout="$layout_three"
;;
"$layout_three")
new_layout="$layout_four"
;;
*)
new_layout="$default_layout"
;;
esac

gsettings set org.gnome.libgnomekbd.keyboard layouts "$new_layout"

exit 0


Generally, for nx4 keyboard layouts:



#!/bin/bash

default_layout="['...', '...', '...', '...']"
layout_two="['...', '...', '...', '...']"
layout_three="['...', '...', '...', '...']"
.
.
.
layout_n="['...', '...', '...', '...']"

current_layout=$(gsettings get org.gnome.libgnomekbd.keyboard layouts)

case $current_layout in
"$default_layout")
new_layout="$layout_two"
;;
"$layout_two")
new_layout="$layout_three"
;;
.
.
.
"$layout_n-1")
new_layout="$layout_n"
;;
*)
new_layout="$default_layout"
;;
esac

gsettings set org.gnome.libgnomekbd.keyboard layouts "$new_layout"

exit 0


In rest all things remains valid as in this answer.



Just an observation: look out that the Ctrl+L shortcut will not work with some keyboard layouts (like Arabic keyboard layout for example). So, you must pay attention when you choose the keyboard layouts and the shortcut.



Wish you success when typing!


[#30498] Friday, April 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bjecterless

Total Points: 59
Total Questions: 96
Total Answers: 105

Location: Argentina
Member since Thu, Mar 18, 2021
3 Years ago
bjecterless questions
;