This commit is contained in:
2026-02-09 07:26:58 +01:00
parent 2a5b2fd9c2
commit 7a5cc56244
10 changed files with 190 additions and 250 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
debug {
render-drm-device "/dev/dri/renderD128"
render-drm-device "/dev/dri/renderD129"
}
// gestures {
+8 -9
View File
@@ -3,17 +3,17 @@
# Description:
# View and manage clipboard history using fzf, with support for
# image previews in compatible terminals.
# image preview in compatible terminals.
# Requirements:
# - cliphist
# - wl-clipboard
# - fzf
# - sixel-query & kgp-query from this repository
# - chafa (for image previews)
# - sixel-query, kgp-query, iterm2-query from this repository
# - chafa (for image preview)
# - ffmpegthumbnailer (optional, for video thumbnails)
# Credits:
# - Original idea and some code adapted from https://github.com/SHORiN-KiWATA/shorinclip
# LICENSE:
# License:
# # MIT License
# #
# # Copyright (c) 2026 shorinkiwata
@@ -95,13 +95,13 @@ _preview_image() {
local file="$1"
if [ "$ENABLE_ICAT" -eq 1 ]; then
printf "\x1b_Ga=d\x1b\\"
chafa -f kitty --animate=off --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
chafa -f kitty --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
elif [ "$ENABLE_SIXEL" -eq 1 ]; then
chafa -f sixels --animate=off --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
chafa -f sixels --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
elif [ "$ENABLE_ITERM2" -eq 1 ]; then
chafa -f iterm2 --animate=off --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
chafa -f iterm2 -size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
else
chafa -f symbols --animate=off --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
chafa -f symbols --size="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
fi
}
export -f _preview_image
@@ -293,4 +293,3 @@ cliphist list | format_clip_list | add_num | fzf \
--preview-window=down:60%,wrap \
--preview "preview {}" \
--bind "enter:execute-silent(bash -c 'copy_selection \"\$1\"' -- {})+accept"
+14 -23
View File
@@ -1,24 +1,20 @@
#!/usr/bin/env bash
# Description:
# Query terminal capabilities for graphics support, including:
# - Kitty Graphics Protocol (KGP)
# - iTerm2 inline images
# - Sixel graphics
# This script will print three lines of output:
# SUPPORT_KGP=1 or 0
# SUPPORT_ITERM2=1 or 0
# SUPPORT_SIXEL=1 or 0
# Query terminal capabilities for graphics support using escape sequences,
# without relying on environment variables or external tools.
#
# Usage:
# This script will print 1 or more of the following strings to stdout, depending
# on the detected capabilities:
# - "kitty" if Kitty's terminal Graphics Protocol is supported
# - "iterm" if iTerm2's inline image support is detected
# - "sixels" if Sixel graphics support is detected
# Do NOT source this script directly, as it will modify the terminal state
# and print its result directly to stdout.
# Instead, use command substitution to capture the output, for example:
# eval "$(graphics-query)"
# or parse the output manually.
#
# See also:
# - kgp-query: specifically checks for Kitty Graphics Protocol support
# - kgp-query: specifically checks for Kitty's terminal Graphics Protocol support
# - iterm2-query: specifically checks for iTerm2 inline image support
# - sixel-query: specifically checks for Sixel graphics support
@@ -43,9 +39,11 @@ stty -echo -icanon min 1 time 0
printf "%s%s%s" "$ITERM2_QUERY_CODE" "$KGP_QUERY_CODE" "$FENCE_CODE" > /dev/tty
response=""
support_kgp=0
support_iterm2=0
support_sixel=0
response=""
while true; do
IFS= read -r -N 1 -t 0.3 char || {
[ -z "$char" ] && break
@@ -70,7 +68,6 @@ while true; do
fi
done
support_sixel=0
if [[ "$response" =~ $'\x1b'\[\?([0-9;]*)c ]]; then
params="${BASH_REMATCH[1]}"
@@ -85,19 +82,13 @@ if [[ "$response" =~ $'\x1b'\[\?([0-9;]*)c ]]; then
fi
if [ "$support_kgp" -eq 1 ]; then
echo "SUPPORT_KGP=1"
else
echo "SUPPORT_KGP=0"
echo "kitty"
fi
if [ "$support_iterm2" -eq 1 ]; then
echo "SUPPORT_ITERM2=1"
else
echo "SUPPORT_ITERM2=0"
echo "iterm"
fi
if [ "$support_sixel" -eq 1 ]; then
echo "SUPPORT_SIXEL=1"
else
echo "SUPPORT_SIXEL=0"
echo "sixels"
fi
@@ -1,43 +0,0 @@
#!/usr/bin/env python3
# Description:
# Adjust the SDR brightness setting in Hyprland's monitor configuration file.
# Useful for adjusting brightness when HDR is enabled.
import sys
import os
if __name__ == "__main__":
if len(sys.argv) != 2:
new_brightness = 1
else:
try:
new_brightness = float(sys.argv[1])
if new_brightness < 1 or new_brightness > 1.5:
raise ValueError()
except Exception as e:
new_brightness = 1
print(f"Setting SDR brightness to: {new_brightness}\n")
config_path = os.path.expanduser("~/.config/hypr/hyprland/monitors.conf")
if not os.path.exists(config_path):
print(f"Configuration file {config_path} does not exist.")
sys.exit(1)
with open(config_path, 'r') as file:
lines = file.readlines()
for line in lines:
if "sdrbrightness" in line:
old_line = line.strip()
new_line = f" sdrbrightness = {new_brightness}\n"
lines[lines.index(line)] = new_line
print(f"Updated: {old_line} to {new_line.strip()}\n")
break
with open(config_path, 'w') as file:
file.writelines(lines)
print(f"New {config_path} content: \n")
with open(config_path, 'r') as file:
print(file.read())
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Description:
# Quick snippet for rofi + emoji + wl-copy
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Based on: https://gist.github.com/XVilka/8346728
awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
@@ -1,13 +0,0 @@
#!/usr/bin/env bash
# Description:
# Restart xdg-desktop-portal and xdg-desktop-portal-hyprland to fix screen sharing issues.
# From hyprland documentation.
sleep 1
killall -e xdg-desktop-portal-hyprland
killall -e xdg-desktop-portal-wlr
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland -v &
sleep 2
/usr/lib/xdg-desktop-portal &
+1
View File
@@ -2,6 +2,7 @@
!.gitignore
!05-done.fish
!10-env.fish
!10-kitty.fish
!10-niri-env.fish
!10-sshs.fish
!50-prompt.fish
@@ -0,0 +1,5 @@
# Workaround: https://github.com/kovidgoyal/kitty/issues/9416
if test "$TERM" = "xterm-kitty"; and kitty --version | grep -q "0.45.0"
set -xg TERM "xterm-256color"
set -xg TERMINFO "/usr/share/terminfo"
end
+2 -2
View File
@@ -1,3 +1,5 @@
> 本篇内容**完全**由 Gemini 生成,虽未验证其准确性,但确实能工作,遂记录于此。
这是一个关于 **Linux (Arch) 宿主机** + **Linux (Gentoo) 客户机** 在 KVM/QEMU 环境下启用 **Virtio-GPU 3D 加速** 遇到黑屏问题的**非完整**排查与解决记录。
## What
@@ -21,7 +23,6 @@
```
- **现象**
- 虚拟机启动后黑屏,无法进入图形界面。
- SSH 连接正常,系统内核正常运行。
- SPICE 窗口内能看到鼠标光标(表示连接建立),但无画面。
@@ -92,7 +93,6 @@ sudo systemctl restart libvirtd
在 Gentoo Guest 内部,确保驱动栈完整。
1. **Portage 配置** ( 或其他位置)
- `/etc/portage/make.conf`
```conf