Skip to content

Arch Linux 折腾记

包管理

安装:
ArchlinuxCN
archlinuxcn-keyring
yay

输入法 fcitx5

安装:
fcitx5-im
fcitx5-chinese-addons
fcitx5-breeze

Vim

自动切换输入法(参考 VIM输入法切换,不使用插件 - No Wander):

分别在中文和英文输入状态下,执行 fcitx5-remote -n 得到此时的 input method name,我这里得到的结果分别是 keyboard-uspinyin

退出插入模式时,先保存当前输入法状态,再切换到英文输入法;
进入插入模式时,若之前保存的输入法状态为中文,则切换到中文。

bash
let fcitx5state=system("fcitx5-remote")
autocmd VimEnter * :silent call system("fcitx5-remote -s keyboard-us")
autocmd InsertLeave * :silent let fcitx5state=system("fcitx5-remote -n") | silent call system("fcitx5-remote -s keyboard-us")
autocmd InsertEnter * :silent if fcitx5state == "pinyin\n" | call system("fcitx5-remote -s pinyin") | endif

将 Tab 显示为 🡢:

bash
set list
set listchars=tab:🡢\ ,extends:>,precedes:<

两格缩进:

bash
set tabstop=2 shiftwidth=2 expandtab

使用 :Q 退出插入模式(因为常常按 Q 的时候忘了松开 Shift):

bash
:command Q q

VSCode

Linux 键盘重映射不生效(参考 Keyboard mappings with setxkbmap on Linux not working):

往 VSCode 设置里添加 "keyboard.dispatch": "keyCode",然后重启 VSCode。

Firefox 浏览器

Getting back KDE Plasma native open / save dialogs

Set widget.use-xdg-desktop-portal.file-picker to 1 in about:config.

https://superuser.com/questions/1653533/how-to-switch-back-to-firefox-old-style-of-tabs

layout.css.devPixelsPerPx 1.4

https://www.reddit.com/r/kde/comments/hdquxl/how_do_i_make_firefox_open_files_on_dolphin/

Replace GTK+ file dialog with alternative

touchpad - Precise scrolling in Firefox?
Solution: Add MOZ_USE_XINPUT2=1 to /etc/environment.

Stuck tooltips never disappear on Linux when switching to another app, until I switch to Firefox tab and hover the source of the tooltip
Solution: Add MOZ_GTK_TITLEBAR_DECORATION=system to /etc/environment.

声音

Output audio to multiple headphones at the same time

bash
pactl load-module module-combine-sink sink_name=my-combine-sink sinks=node1,node2,node3,...

Maybe outdated.

问题:Firefox 停止播放视频后(包括暂停一段时间再播放),所有系统音频停止工作(听不到声音,但声卡设备状态均正常),重启 wireplumber 才能恢复。

解决:https://www.reddit.com/r/archlinux/comments/umxi53/comment/i84prb9

Copy /usr/share/wireplumber/main.lua.d/50-alsa-config.lua into /etc/wireplumber/main.lua.d/ and find the ["session.suspend-timeout-seconds"] and set it to 0. Restart wireplumber.

https://unix.stackexchange.com/questions/676846/how-do-i-disable-audio-sink-suspend-on-idle-using-wireplumber-in-fedora-35-so-th

KDE kwin

No shadows around some windows in kde 5.7

Affected applications: some electron apps (linuxqq, clash-for-windows), wine apps (deepin-wine-wechat).

It's a result of something called "client side decorations".

Applications can tell Kwin "I want to draw my own decorations". Since shadows are usually part of the decoration the application would also need to draw the shadow, but sadly CSD applications don't do this.

If you are feeling committed you can manually add Kwin rules to force-draw a decoration without a titlebar (giving them shadows).

Solution:

In [ System settings ] -> [ Window management ] -> [ Window rules ] -> [ Appearance & Fixes ] , set [ No titlebar ] and frame to No.

或者:Alt + F3,更多操作,配置特殊应用程序设置,将「无标题栏和边框」设为「否」。

In [ System settings ] -> [ Application Style ] -> [ Window decoration ] -> [ Breeze theme setting ] -> [ Window specific overrides ], Set [ border size ] to No border size and set [ Hide Window title bar ] to yes.

QQ, Tim, 微信 | 即时通讯

Linux QQ 3.0 (Electron)

https://aur.archlinux.org/packages/linuxqq-nt-bwrap

官网:https://im.qq.com/linuxqq/index.shtml

deepin wine

https://github.com/vufa/deepin-wine-wechat-arch/https://github.com/countstarlight/deepin-wine-tim-arch

bash
-#[multilib]
-#Include = /etc/pacman.d/mirrorlist
+[multilib]
+Include = /etc/pacman.d/mirrorlist

设置 DPI:

bash
/opt/apps/com.qq.weixin.deepin/files/run.sh winecfg
/opt/apps/com.qq.office.deepin/files/run.sh winecfg

触控板手势

https://www.cnblogs.com/xiaozhang9/p/6157934.html

安装:
libinput-gestures
xdotool

bash
sudo gpasswd -a $USER input
cp /etc/libinput-gestures.conf $HOME/.config/libinput-gestures.conf

编辑 $HOME/.config/libinput-gestures.conf

bash
# 3指左右滑动: 切换虚拟桌面
gesture swipe left 3 xdotool set_desktop --relative 1
gesture swipe right 3 xdotool set_desktop --relative -- -1
gesture swipe up 3 xdotool key XF86MonBrightnessUp     # 3指上划: 提高亮度
gesture swipe down 3 xdotool key XF86MonBrightnessDown # 3指下划: 降低亮度

gesture pinch in 2 xdotool key ctrl+minus  # 2指捏: 缩小
gesture pinch out 2 xdotool key ctrl+plus  # 2指张: 放大

重启 libinput-gestures-setup 生效

bash
libinput-gestures-setup stop
libinput-gestures-setup start

zsh

安装 zsh

bash
sudo pacman -S zsh

设置 zsh 为默认 shell(重新登录 shell 生效)

bash
chsh -s /usr/bin/zsh

安装 Oh My Zsh

bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装主题:Powerlevel10k Clone the repository:

bash
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

中国用户可以使用 gitee.com 上的官方镜像加速下载.

bash
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

可选:安装 nerd font。

git 设置代理

bash
git config --global http.proxy "http://127.0.0.1:7890"
git config --global https.proxy "http://127.0.0.1:7890"

解压缩 中文编码

安装 unzip-natspec(AUR)

命令 unzip test.zip

蓝牙

Maybe outdated.

https://wiki.archlinux.org/title/Bluetooth_(简体中文)#配对

https://bbs.archlinux.org/viewtopic.php?id=222083

sudo pacman -S pulseaudio-bluetooth

sudo nano /etc/bluetooth/main.conf

add line "Enable=Source,Sink,Media,Socket" under [general]

字体配置 Font Configuration

字体配置 - Arch Wiki

Examples: