fetch: add sixel-query & update sixel files; update kgp-query with better timeout handling
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -36,7 +36,7 @@ binds {
|
||||
Alt+Space { spawn-sh "pkill -x rofi || rofi -show drun"; }
|
||||
|
||||
// Actions
|
||||
Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; }
|
||||
Mod+V { spawn "shorinclip-wrap"; }
|
||||
Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; }
|
||||
Ctrl+Alt+Delete { spawn-sh "pkill -x wlogout || wlogout -p layer-shell"; }
|
||||
Print { spawn "niri" "msg" "action" "screenshot-screen"; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
|
||||
|
||||
debug {
|
||||
render-drm-device "/dev/dri/renderD129"
|
||||
render-drm-device "/dev/dri/renderD128"
|
||||
}
|
||||
|
||||
// gestures {
|
||||
|
||||
@@ -19,18 +19,16 @@ FENCE_CODE=$(printf "\033[c")
|
||||
# Set terminal to raw mode with timeout as 0.5s
|
||||
stty_orig=$(stty -g)
|
||||
trap 'stty "$stty_orig"' EXIT
|
||||
stty -echo -icanon min 0 time 5
|
||||
stty -echo -icanon min 1 time 0
|
||||
|
||||
printf "%s%s" "$QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
|
||||
response=""
|
||||
ret=1
|
||||
while true; do
|
||||
char=$(dd bs=1 count=1 2>/dev/null) || break
|
||||
|
||||
if [ -z "$char" ]; then
|
||||
break
|
||||
fi
|
||||
IFS= read -r -N 1 -t 0.3 char || {
|
||||
[ -z "$char" ] && break
|
||||
}
|
||||
|
||||
response+="$char"
|
||||
|
||||
|
||||
@@ -85,15 +85,16 @@ trap cleanup EXIT INT TERM
|
||||
|
||||
sudo mount "/dev/mapper/$LUKS_MAPPER_NAME" "$LUKS_MOUNT_POINT"
|
||||
|
||||
sudo chown "$(whoami):$(whoami)" "$LUKS_MOUNT_POINT"
|
||||
|
||||
echo "[INFO] Successfully mounted at $LUKS_MOUNT_POINT." >&2
|
||||
echo "[INFO] Exit this shell to unmount and close the LUKS volume." >&2
|
||||
|
||||
cd "$LUKS_MOUNT_POINT"
|
||||
USER_SHELL="${SHELL:-/bin/bash}"
|
||||
if [[ "$USER_SHELL" == *"/bash" ]]; then
|
||||
"$USER_SHELL" --rcfile <(cat ~/.bashrc 2>/dev/null; printf '%s\n' 'PS1="\[\e[1;31m\][LUKS]\[\e[0m\][\u@\h \W]\$ "') -i
|
||||
"$USER_SHELL" --rcfile <(
|
||||
cat ~/.bashrc 2>/dev/null
|
||||
printf '%s\n' 'PS1="\[\e[1;31m\][LUKS]\[\e[0m\][\u@\h \W]\$ "'
|
||||
) -i
|
||||
else
|
||||
"$USER_SHELL"
|
||||
fi
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
pkill -f "ghostty -e shorinclip" || ghostty -e shorinclip
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Ensure in a interactive terminal
|
||||
[ ! -t 0 ] && exit 1
|
||||
|
||||
# Construct query
|
||||
QUERY_CODE=$(printf "\033[c")
|
||||
|
||||
# Set terminal to raw mode with timeout as 0.5s
|
||||
stty_orig=$(stty -g)
|
||||
trap 'stty "$stty_orig"' EXIT
|
||||
stty -echo -icanon min 1 time 0
|
||||
|
||||
printf "%s" "$QUERY_CODE" >/dev/tty
|
||||
|
||||
response=""
|
||||
while true; do
|
||||
IFS= read -r -N 1 -t 0.3 char || {
|
||||
[ -z "$char" ] && break
|
||||
}
|
||||
|
||||
response+="$char"
|
||||
|
||||
if [[ "$char" = "c" ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ ${#response} -gt 1024 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$response" =~ $'\x1b'\[\?([0-9;]*)c ]]; then
|
||||
params="${BASH_REMATCH[1]}"
|
||||
|
||||
IFS=';' read -ra codes <<< "$params"
|
||||
|
||||
for code in "${codes[@]}"; do
|
||||
if [[ "$code" == "4" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 1
|
||||
@@ -1,7 +1,9 @@
|
||||
if not set -q fetch_logo_type
|
||||
if type -q kgp-query; and kgp-query
|
||||
set -g fetch_logo_type kitty
|
||||
else if type -q kgp-query
|
||||
else if type -q sixel-query; and sixel-query
|
||||
set -g fetch_logo_type sixel
|
||||
else if type -q kgp-query; or type -q sixel-query
|
||||
set -g fetch_logo_type logo
|
||||
else
|
||||
set -g fetch_logo_type auto
|
||||
|
||||
Reference in New Issue
Block a user