S
S
SOTVM2019-04-28 13:11:11
linux
SOTVM, 2019-04-28 13:11:11

How to switch layout from script?

problem: filed through xmacroplay , opening Caja in two panels at once + each with its own address.
those. I have a shortcut/icon hanging on my panel that opens my default file manager via a crutch

2caja.sh , which says
#!/bin/sh
#запуск caja в двухпанельном режиме
caja ~/
echo "Delay 1 KeyStrPress F3 KeyStrRelease F3 KeyStrPress Control_L KeyStrPress l KeyStrRelease l KeyStrRelease Control_L KeyStrPress slash KeyStrRelease slash KeyStrPress t KeyStrRelease t KeyStrPress m KeyStrRelease m KeyStrPress p KeyStrRelease p KeyStrPress Return KeyStrRelease Return"|xmacroplay ":0.0"

those. opening caja + click F3 (open dual-pane mode) ,
+ click Control_L +L (focus on the address bar of the panel (by default it is left)),
+ blah blah blah (write the desired address + Enter)
OK
everything is fine, BUT if in this time the layout is RU, then it writes to me in the address bar in Russian,
which means that in order for it to work, I need to
force the layout to switch to EN before executing the xmacroplay command (i.e. at the beginning of the script).
how is it
undesend? accessible state? :)
ps
did like this = works
#!/bin/bash
## запуск Caja в двухпанельном режиме с разными адресами в панелях
## левая /tmp  , правая по умолчанию ~/
if
## в настройках клавы ,должна быть включена опция  Use keyboard LED to show alternative layout 
## если горит Scroll_Lock т.е. включена RU локаль ,
[ $(xset q | grep -Po 'LED mask:\s*\K\d+') -eq '00001006' ]
then
## то переключаем на US , имитируя нажатие Caps_Lock (у меня так настроено переключение раскладки)
echo "KeyStrPress  Caps_Lock KeyStrRelease Caps_Lock"|xmacroplay ":0.0"
fi

caja ~/ &
## задержка ,чтобы успел открыться окно Caja
sleep 0.5

## собственно команды для xmacroplay имитирующих нажатия кнопок клавы
## F3 открыть вторую панель
## Control_L+l  передача фокуса в адресное поле 1-ой панели
## вписываем путь /tmp   и жмакаем Enter
echo "Delay 1 KeyStrPress F3 KeyStrRelease F3 Delay 1 KeyStrPress Control_L KeyStrPress l KeyStrRelease l KeyStrRelease Control_L  KeyStrPress slash KeyStrRelease slash KeyStrPress t KeyStrRelease t KeyStrPress m KeyStrRelease m KeyStrPress p KeyStrRelease p  KeyStrPress Return KeyStrRelease Return"|xmacroplay ":0.0"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitsliputsli, 2019-04-28
@sotvm

setxkbmap us

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question