diff options
-rwxr-xr-x | urilaunch | 6 | ||||
-rwxr-xr-x | xwindowURI | 35 |
2 files changed, 39 insertions, 2 deletions
@@ -3,10 +3,12 @@ #you'll probably want to change my gopher-get line to be something useful to you. exec copy_start_nevermind.sh \ "$(cat \ - <(printf "%s\n" $(xclip -o | head -n1)) \ + <(printf "%s\n" "$(xclip -o | head -n1)") \ + <(printf "%s\n" "$(xclip -o -selection clipboard | head -n1)") \ + <(xdotool getwindowfocus | xargs xwindowURI) \ <(printf "\n") \ <(gopher-get gopher://batou/0/links.txt) \ <(cat ~/.cache/uristart.log | sort | uniq) \ - | dmenu -l 10 -p urilaunch\> \ + | choose 'urilaunch>' \ | cut '-d ' -f1 )" diff --git a/xwindowURI b/xwindowURI new file mode 100755 index 0000000..6e9235a --- /dev/null +++ b/xwindowURI @@ -0,0 +1,35 @@ +#!/bin/sh +if [ ! "$1" ];then + id="$(xwinID)" +else + id="$1" +fi + +class=$(xclass -id "$id") +#echo "$class" + +case "$class" in +mupdf) + basename="$(xwintitle "$id" | rev | cut '-d ' -f5- | rev)" + echo "b: $basename" + page="$(xwintitle "$id" | tr ' ' '\n' | grep '[0-9][0-9]*/[0-9][0-9]*' | cut -d/ -f1)" + echo "$page" + 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")" + echo "a: $abspath" + echo "b: $basename" + if [ "$(basename "$abspath")" = "$basename" ];then + printf "file://%s#page=%s\n" "$(uriescape "$abspath")" "$page" + exit 0 + fi + done + ;; +Navigator) + xwintitle "$id" | rev | cut '-d ' -f4 | rev + ;; +*) + echo "class: $class" + ;; +esac |