trying to get the current string written in the search bar in Firefox to be copied to my clipboard, than translating it like it was written in Hebrew keyboard layout, than pasting the translated string, and then changing keyboard layout.
#!/bin/bash
declare -A engToHeb=(
[q]="/" [w]="'"
[e]="ק" [r]="ר" [t]="א" [y]="ט" [u]="ו"
[i]="ן" [o]="ם" [p]="פ"
[a]="ש" [s]="ד" [d]="ג" [f]="כ" [g]="ע"
[h]="י" [j]="ח" [k]="ל" [l]="ך" [;]="ף"
[z]="ז" [x]="ס" [c]="ב"
[v]="ה" [b]="נ" [n]="מ"
[m]="צ"
[,]="ת"
[ ]=" "
)
declare -A hebToEng=(
[/]="q" [\']="w" [ק]="e" [ר]="r" [א]="t" [ט]="y" [ו]="u"
[ן]="i" [ם]="o" [פ]="p" [ש]="a" [ד]="s" [ג]="d" [כ]="f"
[ע]="g" [י]="h" [ח]="j" [ל]="k" [ך]="l" [ף]=";"
[ז]="z" [ס]="x" [ב]="c" [ה]="v" [נ]="b" [מ]="n" [צ]="m"
[ ]=" "
)
xdotool keyup Shift+Super+Left key shift+Home
xdotool keyup Shift+Super+Left key ctrl+x
word=$(xclip -o -selection clipboard)
for ((i=0;i<${#word};i++))
do
my_char=${word:$i:1}
new_word+=${engToHeb[$my_char]}
new_word+=${hebToEng[$my_char]}
done
echo $new_word | xclip -selection clipboard
xdotool keyup Shift+Super+Left key ctrl+v
xdotool keyup Shift+Super+Left key alt+shift
alt shift is a bind for toggeling to hebrew/english