scripts/qutebrowser: add hardware acceleration flags

This commit is contained in:
Michele Guerini Rocco 2023-03-07 18:19:23 +01:00
parent 85bf0db0a3
commit 8916cd5ad6
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -1,14 +1,19 @@
#!/bin/sh #!/bin/sh
bin=$(env PATH="$(echo "$PATH" | sed "s|$(dirname "$0"):||g")" sh -c 'command -v qutebrowser') bin=$(env PATH="$(echo "$PATH" | sed "s|$(dirname "$0"):||g")" sh -c 'command -v qutebrowser')
flags="--qt-flag ignore-gpu-blocklist
--qt-flag enable-gpu-rasterization
--qt-flag enable-native-gpu-memory-buffers
--qt-flag num-raster-threads=4
--qt-flag enable-oop-rasterization"
if pgrep qutebrowser >/dev/null; then if pgrep qutebrowser >/dev/null; then
exec "$bin" "$@" exec "$bin" $flags "$@"
else else
url="$1" url="$1"
ver='1.6.3' ver='1.6.3'
proto=1 proto=1
sock="$XDG_RUNTIME_DIR/qutebrowser/ipc-$(printf "%s" "$USER" | md5sum | cut -d\ -f1)" sock="$XDG_RUNTIME_DIR/qutebrowser/ipc-$(printf "%s" "$USER" | md5sum | cut -d\ -f1)"
fmt='{"args": ["%s"], "target_arg": null, "version": "%s", "protocol_version": %d, "cwd": "%s"}\n' fmt='{"args": ["%s"], "target_arg": null, "version": "%s", "protocol_version": %d, "cwd": "%s"}\n'
printf "$fmt" "$url" "$ver" "$proto" "$PWD" | nc -U "$sock" 2>/dev/null || exec "$bin" "$@" & printf "$fmt" "$url" "$ver" "$proto" "$PWD" | nc -U "$sock" 2>/dev/null || exec "$bin" $flags "$@" &
fi fi