Compare commits

..

8 Commits

Author SHA1 Message Date
3cf506fedf more about kmscon 2025-12-18 19:19:55 +01:00
4a9d8189b1 kmscon 2025-12-18 17:34:55 +01:00
7483a7acb4 kmscon 2025-12-18 17:27:37 +01:00
673a30e1df 👐 foo: too lazy to come up with a helpful commit message :) 2025-12-16 21:48:57 +01:00
809de7f5a3 👐 foo: too lazy to come up with a helpful commit message :) 2025-12-16 21:45:53 +01:00
8fc4fd63ff script: add playlive 2025-12-16 00:46:54 +01:00
d5ed8744f6 fix emojis not displaying 2025-12-15 23:01:24 +01:00
915dc9faf0 Update README.md 2025-12-07 07:07:11 +01:00
11 changed files with 210 additions and 21 deletions

View File

@@ -73,11 +73,11 @@ This setup is currently only adapted for Niri.
- `lyrics`, scrolling lyrics player, depends on [a small utility](https://github.com/Uyanide/Spotify_Lyrics) from myself <small>(which also happens to be my frist Golang program :D)</small>. - `lyrics`, scrolling lyrics player, depends on [a small utility](https://github.com/Uyanide/Spotify_Lyrics) from myself <small>(which also happens to be my frist Golang program :D)</small>.
- `lyrics-single`, similar to `lyrics`, but only with a single line and can be easily embeded into the status bar. - `lyrics-single`, similar to `lyrics`, but only with a single line and can be easily embeded into the status bar.
## Swww ## Awww (Swww)
The wallpaper will be automatically blurred when there is a window in focus, which is implemented in the [wallpaper-daemon](https://github.com/Uyanide/dotfiles/blob/main/scripts/wallpaper-daemon) script. The wallpaper will be automatically blurred when there is a window in focus, which is implemented in the [wallpaper-daemon](https://github.com/Uyanide/dotfiles/blob/main/config/scripts/.local/scripts/wallpaper-daemon) script.
This feature is only enabled in Niri. Swww also manages wallpapers of the Hyprland setup, yet only in the regular way. This feature is only enabled in Niri. Awww also manages wallpapers of the Hyprland setup, yet only in the regular way.
## Wallpaper & Colortheme ## Wallpaper & Colortheme

View File

@@ -120,7 +120,7 @@ cpu_load_color=39F900,FDFD09,FF0000
### Display per process memory usage ### Display per process memory usage
## Show resident memory and other types, if enabled ## Show resident memory and other types, if enabled
procmem # procmem
# procmem_shared # procmem_shared
# procmem_virt # procmem_virt

View File

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

View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Description:
# Play the video embedded in a live photo file (or so-called Motion Photo).
# The literal tags differ between manufacturers, so this script looks for
# the common 'ftyp' box that indicates the start of an MP4 video stream
# instead of "MotionPhotoVideo" or "EmbeddedVideo" or something.
#
# Requirements:
# - mpv or vlc media player installed.
#
# Usage:
# - playlive <file>
# - case `config/scripts/.local/share/applications/playlive.desktop` is installed,
# right-click on a live photo file in file manager and choose "Open With..." ->
# "Play Live Photo".
set -euo pipefail
if [ -z "${1:-}" ]; then
echo "Usage: $0 <file>" >&2
exit 1
fi
play_cmd=()
if command -v mpv >/dev/null 2>&1; then
play_cmd=(mpv --title="Live Photo View" --keep-open=no --loop-file=no --loop-playlist=no --idle=no)
elif command -v vlc >/dev/null 2>&1; then
play_cmd=(vlc --play-and-exit)
else
echo "Error: No suitable media player found." >&2
exit 1
fi
file="$1"
if [ ! -f "$file" ]; then
echo "Error: File '$file' not found." >&2
exit 1
fi
tmp_video=$(mktemp --suffix=.mp4)
trap 'rm -f "$tmp_video"' EXIT
offset=$(grep -aobP "ftyp(mp42|isom)" "$file" | tail -n 1 | cut -d: -f1 || true)
if [ -z "$offset" ]; then
echo "Error: No valid video stream found in '$file'." >&2
exit 1
fi
mp4_offset=$((offset - 3))
tail -c "+$mp4_offset" "$file" > "$tmp_video"
"${play_cmd[@]}" "$tmp_video"

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=Play Live Photo
Comment=Play embedded video from Live Photos
Exec=/home/kolkas/.local/scripts/playlive %f
Icon=multimedia-video-player
Terminal=false
Categories=AudioVideo;Video;Utility;
MimeType=image/jpeg;image/heic;image/heif;

View File

@@ -4,7 +4,7 @@
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env" [ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
[ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH" [ -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 && { command -v nvim >/dev/null 2>&1 && {
export EDITOR=nvim export EDITOR=nvim

View File

@@ -91,12 +91,11 @@ if type -q tty-clock
end end
if type -q git if type -q git
function acp function gcp
git add . || return 1
if test (count $argv) -eq 0 if test (count $argv) -eq 0
git commit -m "👐 foo: too lazy to come up with a helpful commit message :)" || return 1 git commit -a -m "👐 foo: too lazy to come up with a helpful commit message :)" || return 1
else else
git commit -m "$argv" || return 1 git commit -a -m "$argv" || return 1
end end
git push git push
end end

View File

@@ -1,6 +0,0 @@
if string match -q '*ghostty*' $TERM; and test -n "$XDG_CURRENT_DESKTOP"; and test "$XDG_CURRENT_DESKTOP" = "niri"
if test "$ghostty_niri_initialized" != "1"
set -xg ghostty_niri_initialized 1
niri msg action set-column-width 50%
end
end

View File

@@ -27,8 +27,6 @@
<edit mode="assign" name="hinting"><bool>true</bool></edit> <edit mode="assign" name="hinting"><bool>true</bool></edit>
<edit mode="assign" name="hintstyle"><const>hintslight</const></edit> <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
<edit mode="assign" name="rgba"><const>none</const></edit> <edit mode="assign" name="rgba"><const>none</const></edit>
<edit mode="assign" name="embeddedbitmap"><bool>false</bool></edit>
<edit mode="assign" name="lcdfilter"><const>lcddefault</const></edit>
</match> </match>
<!-- For danmuku --> <!-- For danmuku -->
@@ -46,7 +44,7 @@
<prefer> <prefer>
<family>Sarasa UI SC</family> <family>Sarasa UI SC</family>
<family>Sarasa UI J</family> <family>Sarasa UI J</family>
<family>Noto color Emoji</family> <family>Noto Color Emoji</family>
<family>Symbols Nerd Font</family> <family>Symbols Nerd Font</family>
</prefer> </prefer>
</alias> </alias>

133
memo/kmscon.md Normal file
View File

@@ -0,0 +1,133 @@
> 鬼知道这有什么意义,但是在 tty 里用 monospace 和 cjk 字体真的很酷
## 安装
AUR - `kmscon`
## 启用
```sh
sudo ln -s '/usr/lib/systemd/system/kmsconvt@.service' '/etc/systemd/system/autovt@.service'
```
以及保留 tty1 为 getty
```sh
sudo systemctl enable getty@tty1.service
```
理由:
- kmscon 中通过命令行启动图形 session 会遇到问题。
- 通常 tty1 用于运行图形界面,不需要 kmscon 提供的各种特性。
## 修改默认配置
```sh
sudo systemctl edit autovt@.service
```
然后添加以下内容:
```ini
[Service]
ExecStart=
ExecStart=/usr/bin/kmscon --vt=%I --seats=seat0 --no-switchvt
```
解释:
- 默认的 `ExecStart` 携带的参数会覆盖所有配置文件中的对应项,需要先清空。
- 保留默认参数 `--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` 用于设置字体和大小。
### 关于自动登录的补充说明
如果想让 kmscon 在自动登录的同时启动非登陆 shell (例如 fish),可以将配置改为:
```conf
login=/usr/bin/su - kolkas -s /usr/local/bin/fish-login-wrapper
```
其中 `fish-login-wrapper` 内容为:
```sh
#!/bin/bash
if [ -f /etc/profile ]; then
source /etc/profile
fi
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
# 设置环境变量以供后续脚本检测
export IS_KMSCON=1
# 设定 fastfetch 的 logo 类型为 logo (config/shell/.config/fish/post.d/fetch.fish 会读取该变量)
export fetch_logo_type=logo
exec /usr/bin/fish
```
如果不需要读取 profile 文件而直接将 fish 作为登陆 shell可以将配置改为
```conf
login=/usr/bin/su - kolkas -s /usr/bin/fish --login
```
### 关于字体的补充说明
- kmscon 上 2 字符宽的 nerd font 图标会被裁剪至 1 字符宽。可以使用带有 Mono 后缀的 Meslo 系字体作为首选字体,它的图标字符只有 1 字符宽。
- [Archwiki - KMSCON](https://wiki.archlinux.org/title/KMSCON) 上提供了另一种更改字体的方法,即修改 fontconfig 配置,具体做法为在 monospace 字体族中前置添加字体。但这会影响所有使用 fontconfig 和 monospace 字体族的程序,个人认为并非首选。
## 检测当前终端是否为 kmscon
> 以下代码片段适用于 fish shell
检测所有祖先进程中是否有 kmscon
```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
```
或如果配置了 [环境变量](#关于自动登录的补充说明)
```sh
if test -n "$IS_KMSCON"
# 在 kmscon 中
end
```