This commit is contained in:
2025-12-18 17:27:37 +01:00
parent 673a30e1df
commit 7483a7acb4
4 changed files with 104 additions and 3 deletions

View File

@@ -1,13 +1,13 @@
output "eDP-1" {
// off
mode "2560x1600@240"
mode "2560x1600@60.002"
scale 1.25
background-color "#1e1e2e"
backdrop-color "#1e1e2e"
}
output "eDP-2" {
mode "2560x1600@60"
mode "2560x1600@60.002"
scale 1.25
background-color "#1e1e2e"
backdrop-color "#1e1e2e"

View File

@@ -4,7 +4,7 @@
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
[ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH"
[ -x "$HOME/.local/scripts/ssh-init" ] && eval "$(ssh-init)"
[ -x "$HOME/.local/scripts/ssh-init" ] && eval "$(ssh-init)" >/dev/null 2>&1
command -v nvim >/dev/null 2>&1 && {
export EDITOR=nvim

View File

@@ -2,6 +2,10 @@ if not set -q fetch_logo_type
set -g fetch_logo_type auto
end
if ps -e -o pid,comm | grep -q (pgrep kmscon)
set -g fetch_logo_type logo
end
if not set -q fetch_color
set -g fetch_color "#89b4fa"
end

97
memo/kmscon.md Normal file
View File

@@ -0,0 +1,97 @@
> 鬼知道这有什么意义,但是在 tty 里用 monospace 和 cjk 字体真的很酷
## 安装
AUR - `kmscon`
## 在所有 VT (虚拟终端) 上启用
```bash
sudo ln -s '/usr/lib/systemd/system/kmsconvt@.service' '/etc/systemd/system/autovt@.service'
```
以及保留 tty1 给 getty 使用:
```bash
sudo systemctl enable getty@tty1.service
```
理由:
1. kmscon 中通过命令行启动图形 session 会遇到问题。
2. 通常 tty1 用于运行图形界面,不需要 kmscon 提供的各种特性。
## 修改默认配置
```bash
sudo systemctl edit autovt@.service
```
然后添加以下内容:
```ini
[Service]
ExecStart=
ExecStart=/usr/bin/kmscon --vt=%I --seats=seat0 --no-switchvt
```
解释:
1. 默认的 `ExecStart` 携带的单数会覆盖所有配置文件,需要先清空。
2. 保留默认参数 `--login` 前的部分,因为我看不出不这么做的理由。
然后就可以在 `/etc/kmscon/kmscon.conf` 添加自定义的配置了。
例如:
```conf
login=/bin/login -p -f kolkas
font-name=MesloLGM Nerd Font Mono, Maple Mono NF CN
font-size=14
```
其中:
- `login=/bin/login -p -f kolkas` 指定自动登录用户。
- `font-name``font-size` 用于设置字体和大小。
## 关于字体的补充说明
1. kmscon 上 2 字符宽的 nerd font 图标会被裁剪至 1 字符宽。因此我使用 MesloLGM Nerd Font Mono 作为首选字体,它的图标字符只有 1 字符宽。
2. [Archwiki - KMSCON](https://wiki.archlinux.org/title/KMSCON) 上提供了另一种更改字体的方法,即修改 fontconfig 配置,具体做法为在 monospace 字体族中前置添加字体。但这会影响所有使用 fontconfig 和 monospace 字体族的程序,包括图形界面中的终端模拟器。因此我选择直接在 kmscon 的配置文件中指定字体。
## 检测当前终端是否为 kmscon
> 以下代码片段适用于 fish shell
检测父进程和祖父进程是否为 kmscon
```sh
if ps -e -o pid,comm | grep -q (pgrep kmscon)
# 在 kmscon 中
end
```
或者更精细地检测所有祖先进程 (fish)
```sh
function is_kmscon
set -l pid %self
while test $pid -gt 1
set -l info (ps -o ppid=,comm= -p $pid | string trim)
set -l ppid (echo $info | awk '{print $1}')
set -l name (echo $info | awk '{print $2}')
if string match -q "kmscon" $name
return 0
end
set pid $ppid
end
return 1
end
if is_kmscon
# 在 kmscon 中
end
```