-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: xtools action: commit revision: path_from: revision_from: 94ae39bd704434a134b90f1abaffd72f39275b4e: path_to: revision_to:
commit 94ae39bd704434a134b90f1abaffd72f39275b4e Author: epoch <epoch@enzo.thebackupbox.net> Date: Mon Nov 22 06:37:53 2021 +0000 init diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..fac29c3e76f39434cd9f86094781fd34f4324499 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.PHONEY: install + +PREFIX:=/usr/local + +all: + +install: + install -t $(PREFIX)/bin xclass + install -t $(PREFIX)/bin xwindowURI + install -t $(PREFIX)/bin xwinID + install -t $(PREFIX)/bin xwintitle + install -t $(PREFIX)/bin xrl diff --git a/xclass b/xclass new file mode 100755 index 0000000000000000000000000000000000000000..c34c27de7365e033a428dcedc25337ce0c386732 --- /dev/null +++ b/xclass @@ -0,0 +1,2 @@ +#!/bin/sh +xprop "$@" WM_CLASS | cut -d= -f2 | sed 's/^/[/;s/$/]/' | jq -r '.[]' diff --git a/xrl b/xrl new file mode 100755 index 0000000000000000000000000000000000000000..ac87734b9d66df39e9c8c58d5869fb538eae506c --- /dev/null +++ b/xrl @@ -0,0 +1,3 @@ +#!/bin/sh +xrdb -load ~/.config/X/resources +find ~/.config/X/resources.d -type f | tr '\n' '\0' | xargs -0n1 xrdb -merge diff --git a/xwinID b/xwinID new file mode 100755 index 0000000000000000000000000000000000000000..aa3b0c5ef786cd0dcd3aed8638819432d3282072 --- /dev/null +++ b/xwinID @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo $[$(xwininfo | grep ^xwin | head -n2 | tail -n1 | cut '-d ' -f4)] diff --git a/xwindowURI b/xwindowURI new file mode 100755 index 0000000000000000000000000000000000000000..35eb92cf1366b29b76ddca5e503ed65f73f21aa7 --- /dev/null +++ b/xwindowURI @@ -0,0 +1,28 @@ +#!/bin/sh +if [ ! "$1" ];then + id="$(xwinID)" +else + id="$1" +fi + +classA=$(xclass -id "$id" | head -n1) +classB=$(xclass -id "$id" | tail -n1) + +case "$class" in +mupdf) + basename="$(xwintitle "$id" | cut '-d ' -f1)" + page="$(xwintitle "$id" | tr ' ' '\n' | grep '[0-9][0-9]*/[0-9][0-9]*' | cut -d/ -f1)" + for PID in $(pgrep mupdf);do + argv1="$(cat /proc/$PID/cmdline | tr '\0' '\n' | sed -n 2p)" + cd "$(readlink /proc/$PID/cwd)" + abspath="$(normalpath "$argv1")" + if [ "$(basename "$abspath")" = "$basename" ];then + printf "file://%s#page=%s\n" "$abspath" "$page" + exit 0 + fi + done +;; +*) + printf "I dunno. classA: '%s' classB: '%s'\n" "$classA" "$classB" +;; +esac diff --git a/xwintitle b/xwintitle new file mode 100755 index 0000000000000000000000000000000000000000..1948b9a2f7437bf73b5f451f68fd4dc027603843 --- /dev/null +++ b/xwintitle @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +if [ "$1" ];then + xwininfo -id "$1" | grep ^xwin | head -n2 | tail -n1 | cut '-d ' -f5- | jq -r . +else + xwininfo | grep ^xwin | head -n2 | tail -n1 | cut '-d ' -f5- | jq -r . +fi
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 16:33:49 2024