You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

2 months ago
#!/bin/sh
if [ "$(echo $LANG)" = "ru_RU.UTF-8" ]; then
table=(
"'<Control>Shift_R'" "Control + Правый Shift"
"'<Control>Shift_L'" "Control + Левый Shift"
"'<Control>Shift'" "Control + Shift"
"'<Alt>Shift_R'" "Alt + Правый Shift"
"'<Alt>Shift_L'" "Alt + Левый Shift"
"'<Alt>Shift'" "Alt + Shift"
"'<Ctrl>Space'" "Ctrl + Пробел"
"'<Alt>Space'" "Alt + Пробел"
)
TITLE="Переключение на другую расладку"
TEXT="Выберите комбинацию клавиш для переключения на другую раскладку"
else
table=(
"'<Control>Shift_R'" "Control + Right Shift"
"'<Control>Shift_L'" "Control + Left Shift"
"'<Control>Shift'" "Control + Shift"
"'<Alt>Shift_R'" "Alt + Right Shift"
"'<Alt>Shift_L'" "Alt + Left Shift"
"'<Alt>Shift'" "Alt + Shift"
"'<Ctrl>Space'" "Ctrl + Space"
"'<Alt>Space'" "Alt + Space"
)
TITLE="Switch to another layout"
TEXT="Choose shortcut to switch keyboard layout"
fi
KEYS=$(zenity \
--list \
--title="$TITLE" \
--text="$TEXT" \
--print-column=1 \
--hide-column=1 \
--height=500 \
--column="Layout:HD" \
--column="Description" \
--hide-header \
"${table[@]}"
)
if [ -z $KEYS ]; then
exit 1
fi
if [ $KEYS = "'<Alt>Shift'" ]; then
switch_input_source="'<Alt>Shift_L'"
switch_input_source_backward="'<Alt>Shift_R'"
elif [ $KEYS = "'<Control>Shift'" ]; then
switch_input_source="'<Control>Shift_L'"
switch_input_source_backward="'<Control>Shift_R'"
fi
if [ "${switch_input_source}" != "" -a "${switch_input_source_backward}" != "" ]; then
echo ME
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "[${switch_input_source}]"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "[${switch_input_source_backward}]"
else
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Super>space', 'XF86Keyboard']"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "[$KEYS]"
fi