英文:
How can I force changing the keyboard layout in Linux in IDE?
问题
当我升级到Debian 12后,我在JetBrains和NetBeans IDE中遇到了一个新问题,这些Java应用程序无法更改键盘布局,当我将键盘布局更改为瑞典语一会儿,然后立即切换回英语!
所以我的问题是:我无法在所有基于Java的IDE中更改键盘布局,如何在IDE中解决这个问题?
顺便说一下,我查看了这个主题和其他类似的主题:
英文:
When I upgraded to debian 12, I have new problem with jetbreans and netbeans ide, These java application can't change keyboard layouts, when I change keyboard layout to Swedish for one moment then back to English immediately!
So my problem is: I can't change keyboard layout in all IDE's based on java, how to fix this problem in ide?
BTW, I flowed this topic and other topics look like this:
答案1
得分: 1
依赖于您的NVIDIA驱动程序,我在我的生活博客中写过这个问题。
总结
没有通常的解决方法可以完全修复这个问题,但您可以使用我的替代解决方案:
测试 setxkbmap
$ sudo apt-get install x11-xkb-utils
$ setxkbmap -query
rules: evdev
model: pc105
layout: us,ir
然后您可以手动更改语言:(您可以将您的语言替换为 sv
或 ru
,而不是 ir
)
$ setxkbmap us,ir
$ setxkbmap ir,us
然后安装 xkblayout-state
:
$ sudo apt-get install libx11-dev git
$ mkdir temp
$ cd temp
$ git clone https://github.com/nonpop/xkblayout-state.git
$ cd xkblayout-state
$ make
$ make install
现在您需要在一个安全路径中创建一个名为 key.sh
的新文件,不要更改此文件或其父文件夹的名称,内容如下:
不要忘记将 ir
替换为您的语言,如 sv
:
#!/bin/bash
outkbd=$(xkblayout-state print "%s")
uskbd="us"
#echo $outkbd
if [[ "$outkbd" == "$uskbd" ]]
then
#echo "us" switch to ir
setxkbmap ir,us
else
#echo "ir" witch to us
setxkbmap us,ir
fi
现在使它可执行:
$ chmod +x key.sh
最后,为此定义一个新的快捷键,并在您的IDE中使用它,如下所示:
英文:
It's depends on you NVIDIA drivers, I have write about this on my life blog
Summery
There is no usual solution to fix this problem completely, but You, can use my alternative solution:
test setxkbmap
$ sudo apt-get install x11-xkb-utils
$ setxkbmap -query
rules: evdev
model: pc105
layout: us,ir
then you can change you language manual: ( you can replace your language here like sv
or ru
instead ir
)
$ setxkbmap us,ir
$ setxkbmap ir,us
Then install xkblayout-state
:
$ sudo apt-get install libx11-dev git
$ mkdir temp
$ cd temp
$ git clone https://github.com/nonpop/xkblayout-state.git
$ cd xkblayout-state
$ make
$ make install
now you have to make new file key.sh
in safe path where you don't rename this or parent folders with this content:
Don't forget replace ir
with your lang like sv
:
#!/bin/bash
outkbd=$(xkblayout-state print "%s")
uskbd="us"
#echo $outkbd
if [[ "$outkbd" == "$uskbd" ]]
then
#echo "us" switch to ir
setxkbmap ir,us
else
#echo "ir" witch to us
setxkbmap us,ir
fi
Now make it executable:
$ chmod +x key.sh
Finally define new shortcut for this and use it in your ide like this:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论