- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
#!/bin/bash
trap "logkeys -k && echo $'\n'Exit! && exit 0" SIGINT SIGTERM
while true
do
sleep 0.2
layout=$(xset -q | grep LED | awk {' print $10 '} | cut -c5)
if [[ $layout == 0 ]] && [[ $layoutmode == 0 ]]
then
echo layout US, US keymap already started
continue
elif [[ $layout == 1 ]] && [[ $layoutmode == 1 ]]
then
echo layout RU, RU keymap already started
continue
elif [[ $layout == 0 ]] && [[ $layoutmode == 1 ]]
then
echo layout 0,layoutmode 1,Kill and Start us,layoutmode=0
exec logkeys -k&
exec logkeys -s --no-func-keys -o /var/log/key.log&
layoutmode=0
elif [[ $layout == 1 ]] && [[ $layoutmode == 0 ]]
then
echo layout 1,layoutmode 0,Kill and Start ru,layoutmode=1
exec logkeys -k&
exec logkeys -m /etc/logkeys/ru.map -s --no-func-keys -o /var/log/key.log&
layoutmode=1
else
if [[ $layout == 1 ]]
then
echo layout 1,logkeys Kill and Start
exec logkeys -k&
exec logkeys -m /etc/logkeys/ru.map -s --no-func-keys -o /var/log/key.log&
layoutmode=1
else
echo layout 0,logkeys Kill and Start
exec logkeys -k&
exec logkeys -s --no-func-keys -o /var/log/key.log&
layoutmode=0
fi
fi
done
Комментарии (0) RSS
Добавить комментарий