-- 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: a656aaee1da9afcb5470032d8aa644c41b10ceb8:
path_to:
revision_to:

git.thebackupbox.net

xtools

git://git.thebackupbox.net/xtools

commit a656aaee1da9afcb5470032d8aa644c41b10ceb8
Author: epoch <epoch@enzo.thebackupbox.net>
Date:   Tue Nov 23 10:26:45 2021 +0000

    made it output the windows class in a copy-able way. now has firefox+plugin and mpv support

diff --git a/xwindowURI b/xwindowURI

index 35eb92cf1366b29b76ddca5e503ed65f73f21aa7..

index ..37601af1829f0988402f85799309a3e4af199f57 100755

--- a/xwindowURI
+++ b/xwindowURI
@@ -8,8 +8,8 @@ fi
 classA=$(xclass -id "$id" | head -n1)
 classB=$(xclass -id "$id" | tail -n1)

-case "$class" in
-mupdf)
+case "$classA:$classB" 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
@@ -22,7 +22,28 @@ mupdf)
     fi
   done
 ;;
+Navigator:Firefox)
+  ## you'll need the URL in the titlebar somehow. I use https://github.com/erichgoldman/add-url-to-window-title
+  ## if you do it differently, you'll need to edit this pipeline to extract it out ofc.
+  xwintitle "$id" | rev | cut '-d ' -f4 | rev
+;;
+gl:mpv)
+  rm -f /tmp/mpv-pos
+  xdotool key --window "$id" ctrl+x
+  basename="$(xwintitle "$id" | rev | cut '-d ' -f3- | rev)"
+  while [ ! -s /tmp/mpv-pos ];do sleep .1;done
+  t="$(time2seconds "$(cat /tmp/mpv-pos)")"
+  for PID in $(pgrep mpv);do
+    argv1="$(cat /proc/$PID/cmdline | tr '\0' '\n' | sed -n 2p)"
+    cd "$(readlink /proc/$PID/cwd)"
+    abspath="$(normalpath "$argv1")"
+    printf "file://%s#t=%s\n" "$(uriescape "$abspath")" "$t"
+    rm -f /tmp/mpv-pos
+    exit 0
+  done
+  rm -f /tmp/mpv-pos
+;;
 *)
-  printf "I dunno. classA: '%s' classB: '%s'\n" "$classA" "$classB"
+  printf "window-class:%s:%s\n" "$classA" "$classB"
 ;;
 esac

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 15:00:58 2024