分类 Linux 下的文章

直接这样配置

执行:

mkdir -p ~/.config/environment.d

cat > ~/.config/environment.d/im.conf <<'EOF'
XMODIFIERS=@im=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
EOF

确认:

cat ~/.config/environment.d/im.conf

应该得到:

XMODIFIERS=@im=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx

然后重启电脑。

这里建议直接重启,而不是只重启 Fcitx。因为现在有问题的是已经运行的整个 Plasma 会话,尤其是 plasmashell。Fcitx 官方也说明,修改 environment.d 后最简单可靠的生效方式就是重启系统。

0、安装cython。

pip install cython

1、进入源码所在的目录。
2、新建setup_binary.py

from setuptools import setup
from Cython.Build import cythonize

setup(
    ext_modules=cythonize(
        ["文件1.py", "文件2.py"],
        compiler_directives={"language_level": "3"},
    )
)

3、开始编译

python setup_binary.py build_ext --inplace

4、清理中间文件

rm -rf build
rm -f 文件1.c  文件2.v

背景

loong64架构的安同操作系统中安装微信后,无法使用中文输入法。

解决方法

1、编辑微信的快捷方式。

sudo vim /usr/share/applications/wechat.desktop

2、将正确的环境变量添加进去。
原来:

[Desktop Entry]
Name=wechat
Name[zh_CN]=微信
Exec=/usr/bin/wechat %U
StartupNotify=true
Terminal=false
Icon=/usr/share/icons/hicolor/256x256/apps/wechat.png
Type=Application
Categories=Utility;
Comment=Wechat Desktop
Comment[zh_CN]=微信桌面版

env GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx添加到Exec后面,如下所示:

[Desktop Entry]
Name=wechat
Name[zh_CN]=微信
Exec=env GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx /usr/bin/wechat %U
StartupNotify=true
Terminal=false
Icon=/usr/share/icons/hicolor/256x256/apps/wechat.png
Type=Application
Categories=Utility;
Comment=Wechat Desktop
Comment[zh_CN]=微信桌面版

3、保存,重启微信,问题解决。

1、安装 libpam-google-authenticator

sudo apt update
sudo apt install libpam-google-authenticator -y

2、为每个用户生成 TOTP 密钥

google-authenticator

3、回答显示的问题,默认y就可以。
4、使用微软或者谷歌验证器扫码。
5、拍照记录应急验证码。
6、配置 PAM 模块启用 TOTP

sudo nano /etc/pam.d/sshd

在文件最上方添加以下内容:

auth required pam_google_authenticator.so nullok

如果必须使用两步验证,则:

auth required pam_google_authenticator.so

7、编辑ssh配置。

sudo nano /etc/ssh/sshd_config

修改以下内容:

ChallengeResponseAuthentication yes
UsePAM yes
PasswordAuthentication yes  # 如使用公钥登录可为 no
KbdInteractiveAuthentication yes  # 这一行必不可少,否则不能使用xshell,termius等

8、重启ssh服务,使上述配置生效。

sudo systemctl restart ssh