1

After my experiments with keyboard layots (to achieve this thing) I lost ability to switch them. Only available layout is En(us). I can switch it and icon in top bar changes but it not affects to real layout.

I have made this script to recover cirillic scripts.

#!/bin/bash

declare -a layout_set=('us' 'ru(winkeys)' 'ua(winkeys)');

curr_layout=`setxkbmap -query | grep "layout" | awk '{print $2}'`;

layout_count=${#layout_set[@]};
for (( i=0; i<$layout_count; i++ ));
do
  if [ ${layout_set[$i]} == $curr_layout ]
  then
    cur_layout_num=$i;
  fi
done

next_layout_num=$(($cur_layout_num + 1));

if [ $next_layout_num -eq $layout_count ]
then
  next_layout_num=0;
fi

setxkbmap -layout ${layout_set[$next_layout_num]};

It works well, but Ubuntu doesn't allow me to assign it to Ctrl+Shift hotkey and I should use another (Super+Space). Also I can't display current layout at top bar.

So, can anybody help me to fix my problem or al least improve my script? With guest account I have no problems but I think creating new user account is not good solution.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.