diff options
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | dotfiles/bash/.bashrc | 5 | ||||
| -rw-r--r-- | dotfiles/cargo/.cargo/config.toml | 10 | ||||
| -rw-r--r-- | dotfiles/git/.gitconfig | 4 | ||||
| -rw-r--r-- | dotfiles/mpv/.config/haruna/custom-commands.conf | 7 | ||||
| -rw-r--r-- | dotfiles/mpv/.config/mpv/scripts/embedded-lyrics.lua | 28 | ||||
| -rw-r--r-- | etc/dae/config.dae | 64 | ||||
| -rw-r--r-- | etc/shadowsocks-rust/s.json | 18 | ||||
| -rwxr-xr-x | scripts/aur.sh | 9 | ||||
| -rwxr-xr-x | scripts/dev.sh | 12 | ||||
| -rwxr-xr-x | scripts/install_packages.sh | 9 | ||||
| -rwxr-xr-x | scripts/pnpm.sh | 10 | ||||
| -rwxr-xr-x | scripts/stow.sh | 2 | ||||
| -rw-r--r-- | scripts/system.sh | 24 |
14 files changed, 198 insertions, 20 deletions
@@ -3,15 +3,21 @@ ## 需求 - 使用 stow 备份用户目录配置 (scripts/stow.sh) + - 需求1:代理、镜像站、常用操作 的环境变量配置 + - 需求2:mpv/haruna 加载歌词字幕 + - 需求3:vscode、bitwarden 避免使用 kde 全局菜单 + - 需求4:vscode 用户配置同步 - 使用 shell 脚本维护以下内容 - 软件包的安装 (scripts/install_packages.sh) - - Node.js 开发环境 (scripts/pnpm.sh) + - 开发环境处理,包含 Node.js、rustup (scripts/dev.sh) - code oss 插件安装 (scripts/install_vscode_extensions.sh) - 系统服务配置备份和恢复 (scripts/system.sh) + - 需求5:终端字体在高分辨率下能看清 + - 需求6:代理服务自动配置 + - 需求7:启用 modem 服务 + - 需求8:kde 指纹配置 + - aur (scripts/aur.sh) ## todo -- mpv 配置 -- aur -- 指纹识别 -- 加密信息处理 (scripts/system.sh)
\ No newline at end of file +- 加密信息处理 (scripts/system.sh), sops + age/gpg diff --git a/dotfiles/bash/.bashrc b/dotfiles/bash/.bashrc index 0826f83..c34e43a 100644 --- a/dotfiles/bash/.bashrc +++ b/dotfiles/bash/.bashrc @@ -17,6 +17,11 @@ export RUSTUP_DIST_SERVER=https://mirror.nju.edu.cn/rustup eval "$(fnm env --use-on-cd)" +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' +bind '"\eOA": history-search-backward' +bind '"\eOB": history-search-forward' + # # pnpm # export PNPM_HOME='/home/shu/.local/share/pnpm' # case ":$PATH:" in diff --git a/dotfiles/cargo/.cargo/config.toml b/dotfiles/cargo/.cargo/config.toml new file mode 100644 index 0000000..a6f0783 --- /dev/null +++ b/dotfiles/cargo/.cargo/config.toml @@ -0,0 +1,10 @@ +[source.crates-io] +replace-with = 'mirror' + +[source.mirror] +registry = "sparse+https://mirrors.cernet.edu.cn/crates.io-index/" + +[registries.mirror] +index = "sparse+https://mirrors.cernet.edu.cn/crates.io-index/" + +# 参考 https://help.mirrors.cernet.edu.cn/crates.io-index/
\ No newline at end of file diff --git a/dotfiles/git/.gitconfig b/dotfiles/git/.gitconfig index a675a80..4d36f82 100644 --- a/dotfiles/git/.gitconfig +++ b/dotfiles/git/.gitconfig @@ -14,3 +14,7 @@ conflictStyle = zdiff3 [alias] l = log --oneline +[pull] + rebase = true +[http "https://github.com"] + proxy = socks5h://127.0.0.1:1080 diff --git a/dotfiles/mpv/.config/haruna/custom-commands.conf b/dotfiles/mpv/.config/haruna/custom-commands.conf new file mode 100644 index 0000000..bc4890d --- /dev/null +++ b/dotfiles/mpv/.config/haruna/custom-commands.conf @@ -0,0 +1,7 @@ +Counter=1 + +[Command_0] +Command=load-script "~/.config/mpv/scripts/embedded-lyrics.lua" +Order=0 +OsdMessage= +Type=startup diff --git a/dotfiles/mpv/.config/mpv/scripts/embedded-lyrics.lua b/dotfiles/mpv/.config/mpv/scripts/embedded-lyrics.lua new file mode 100644 index 0000000..9b9a705 --- /dev/null +++ b/dotfiles/mpv/.config/mpv/scripts/embedded-lyrics.lua @@ -0,0 +1,28 @@ +-- embedded-lyrics.lua +-- 尝试将音频文件内嵌的 LYRICS 标签作为字幕加载 + +local function load_embedded_lyrics() + local lyrics = mp.get_property("metadata/by-key/LYRICS") + + if not lyrics or lyrics == "" then + mp.msg.warn("未找到内嵌的 LYRICS 标签") + return + end + + -- 创建一个临时文件来存放歌词 + local tmp_path = os.tmpname() .. ".lrc" + local file = io.open(tmp_path, "w") + if not file then + mp.msg.error("无法创建临时文件") + return + end + file:write(lyrics) + file:close() + + -- 加载为字幕 + mp.commandv("sub-add", tmp_path, "select") + mp.msg.info("已从元数据加载内嵌歌词") +end + +-- 当文件加载完成时触发 +mp.register_event("file-loaded", load_embedded_lyrics) diff --git a/etc/dae/config.dae b/etc/dae/config.dae new file mode 100644 index 0000000..a6a26ac --- /dev/null +++ b/etc/dae/config.dae @@ -0,0 +1,64 @@ +global { + wan_interface: auto + auto_config_kernel_parameter: true + log_level: info + + # Keep the original domain when dialing through the proxy. This also makes + # domain-based routing independent from the IP returned by the local DNS. + dial_mode: domain + allow_insecure: false +} + +# Reuse the local Shadowsocks SOCKS5 listener instead of duplicating the +# remote server address and password in this configuration. +node { + # local_ss: 'socks5://127.0.0.1:8888' + + # Direct Shadowsocks node example using the SIP002 URI format. Replace the + # cipher, password, host, and port, then uncomment it. Base64 is encoding, + # not encryption, so keep the real link under secret/. + # example_ss: 'ss://YWVzLTEyOC1nY206dGVzdA@example.com:8388#example-ss' + ss: 'ss://aes-256-gcm:xxxxxxxxxx@xxxx:1234' +} + +group { + proxy { + filter: name(ss) + policy: fixed(0) + } +} + +# Let dae observe DNS queries so that routing rules can match domain names. +dns { + upstream { + router: 'udp://192.168.8.1:53' + direct_dns: 'tcp+udp://223.5.5.5:53' + } + + routing { + request { + qname(suffix: l) -> router + qname(suffix: lan) -> router + fallback: direct_dns + } + + response { + fallback: accept + } + } +} + +routing { + # Shadowsocks must reach its remote server directly to avoid a proxy loop. + pname(sslocal) -> direct + + # Keep local, multicast, and other private destinations direct. + dip(224.0.0.0/3, 'ff00::/8') -> direct + dip(geoip:private) -> direct + + # Route mainland China IPs directly. Everything else uses the proxy, so + # overseas destinations do not need to be maintained in a domain list. + dip(geoip:cn) -> direct + + fallback: proxy +}
\ No newline at end of file diff --git a/etc/shadowsocks-rust/s.json b/etc/shadowsocks-rust/s.json new file mode 100644 index 0000000..7454408 --- /dev/null +++ b/etc/shadowsocks-rust/s.json @@ -0,0 +1,18 @@ +{ + "server": "x.xxx", + "server_port": 1111, + "password": "xxxxxxxxxxxxxxxx", + "timeout": 300, + "method": "aes-256-gcm", + "locals": [ + { + "local_address": "127.0.0.1", + "local_port": 1080 + }, + { + "local_address": "127.0.0.1", + "local_port": 3128, + "protocol": "http" + } + ] +}
\ No newline at end of file diff --git a/scripts/aur.sh b/scripts/aur.sh new file mode 100755 index 0000000..81568e3 --- /dev/null +++ b/scripts/aur.sh @@ -0,0 +1,9 @@ +#/bin/bash + +# https://aur.archlinux.org/packages/yay + +GIT_PATH_YAY="/tmp/git_yay" + +git clone https://aur.archlinux.org/yay.git $GIT_PATH_YAY +cd $GIT_PATH_YAY && makepkg -si +yay -S wechat rapidraw xpadneo-dkms
\ No newline at end of file diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100755 index 0000000..10cf726 --- /dev/null +++ b/scripts/dev.sh @@ -0,0 +1,12 @@ +#/bin/bash + +CURRENT_VERSION=24 +FNM_NODE_DIST_MIRROR=https://mirrors.nju.edu.cn/nodejs-release/ + +fnm install $CURRENT_VERSION +fnm use $CURRENT_VERSION +npm i -g pnpm +pnpm setup +pnpm i -g serve tiddlywiki @deepseek-ai/dsh + +rustup default stable
\ No newline at end of file diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh index 2c648b3..d3ee0f3 100755 --- a/scripts/install_packages.sh +++ b/scripts/install_packages.sh @@ -1,8 +1,9 @@ #/bin/bash -PKG_BASE="kde-applications-meta chromium code shadowsocks-rust dae base-devel git git-delta vim uv fnm stow bind lsof eza bat bat-extras htop jq less unzip 7zip wget" -PKG_HARDWARE="usb_modeswitch solaar brightnessctl terminus-font" +PKG_BASE="kde-applications-meta chromium code shadowsocks-rust dae base-devel git git-delta sops age vim uv fnm stow fastfetch" +PKG_SYSTEM="bind lsof eza bat bat-extras htop jq less unzip 7zip wget usbutils nmap httpie" +PKG_HARDWARE="modemmanager usb_modeswitch solaar brightnessctl terminus-font fprintd libfprint" PKG_DEV="go rustup plantuml caddy docker docker-buildx docker-compose" -PKG_DESKTOP="bitwarden telegram-desktop darktable digikam obs-studio fcitx5 fcitx5-chinese-addons fcitx5-configtool fcitx5-pinyin-zhwiki" +PKG_DESKTOP="bitwarden telegram-desktop darktable digikam obs-studio blender haruna mpv fcitx5 fcitx5-chinese-addons fcitx5-configtool fcitx5-pinyin-zhwiki steam" -sudo pacman -Syu --needed $PKG_BASE $PKG_HARDWARE $PKG_DEV $PKG_DESKTOP
\ No newline at end of file +sudo pacman -Syu --needed $PKG_BASE $PKG_SYSTEM $PKG_HARDWARE $PKG_DEV $PKG_DESKTOP
\ No newline at end of file diff --git a/scripts/pnpm.sh b/scripts/pnpm.sh deleted file mode 100755 index 90259db..0000000 --- a/scripts/pnpm.sh +++ /dev/null @@ -1,10 +0,0 @@ -#/bin/bash - -CURRENT_VERSION=24 -export FNM_NODE_DIST_MIRROR=https://mirrors.nju.edu.cn/nodejs-release/ - -fnm install $CURRENT_VERSION -fnm use $CURRENT_VERSION -npm i -g pnpm -pnpm setup -pnpm i -g serve tiddlywiki @deepseek-ai/dsh
\ No newline at end of file diff --git a/scripts/stow.sh b/scripts/stow.sh index d4322e4..8bdcd5b 100755 --- a/scripts/stow.sh +++ b/scripts/stow.sh @@ -2,7 +2,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DOTFILE_DIR="$(cd $SCRIPT_DIR && cd ../dotfiles && pwd)" -echo $DOTFILE_DIR +# echo $DOTFILE_DIR # add link cd $DOTFILE_DIR && stow -d $DOTFILE_DIR -t $HOME --no-folding --adopt */
\ No newline at end of file diff --git a/scripts/system.sh b/scripts/system.sh index 31864b9..fdd7e16 100644 --- a/scripts/system.sh +++ b/scripts/system.sh @@ -3,6 +3,10 @@ # 脏标记:0=不需要重建 UKI,1=需要 MKINITCPIO=0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ETC_DIR="$(cd $SCRIPT_DIR && cd ../etc && pwd)" +echo $ETC_DIR + setup_vconsole_font() { sudo sed -i 's/^\(FONT=.*\)$/# \1\nFONT=ter-132n/' /etc/vconsole.conf @@ -111,9 +115,29 @@ routing { EOF } +setup_modem() { + sudo systemctl enable --now ModemManager.service +} + +setup_fprint() { + # --- system-local-login(KDE 锁屏/系统登录)--- + sudo sed -i '/pam_fprintd\.so/d' /etc/pam.d/system-local-login + sudo sed -i '/^auth[[:space:]]\+include[[:space:]]\+system-login/i auth sufficient pam_fprintd.so' /etc/pam.d/system-local-login + + # --- polkit-1 --- + [ -f /etc/pam.d/polkit-1 ] || sudo cp /usr/lib/pam.d/polkit-1 /etc/pam.d/polkit-1 + sudo sed -i '/pam_fprintd\.so/d' /etc/pam.d/polkit-1 + sudo sed -i '/^auth[[:space:]]\+include[[:space:]]\+system-auth/i auth sufficient pam_fprintd.so' /etc/pam.d/polkit-1 + + # --- kde-fingerprint --- + [ -f /etc/pam.d/kde-fingerprint ] || sudo cp /usr/lib/pam.d/kde-fingerprint /etc/pam.d/kde-fingerprint +} + setup_vconsole_font setup_shadowsocks setup_dae +setup_modem +setup_fprint # 统一重建一次 if [ "$MKINITCPIO" -eq 1 ]; then |
